Commit b26321f2 authored by Armin Rauschenberger's avatar Armin Rauschenberger
Browse files

automation

parent f50d3a09
...@@ -3,8 +3,8 @@ Version: 0.0.0 ...@@ -3,8 +3,8 @@ Version: 0.0.0
Title: Elastic Net for Dichotomised Outcomes Title: Elastic Net for Dichotomised Outcomes
Description: Implements lasso and ridge regression for dichotomised outcomes. Description: Implements lasso and ridge regression for dichotomised outcomes.
Depends: R (>= 3.0.0) Depends: R (>= 3.0.0)
Imports: glmnet, MASS, weights, palasso, colorspace Imports: glmnet, MASS, weights, palasso
Suggests: knitr, testthat Suggests: knitr, testthat, RColorBrewer
Authors@R: person("Armin","Rauschenberger",email="a.rauschenberger@vumc.nl",role=c("aut","cre")) Authors@R: person("Armin","Rauschenberger",email="a.rauschenberger@vumc.nl",role=c("aut","cre"))
VignetteBuilder: knitr VignetteBuilder: knitr
License: GPL-3 License: GPL-3
......
...@@ -303,7 +303,15 @@ plot.cornet <- function(x,...){ ...@@ -303,7 +303,15 @@ plot.cornet <- function(x,...){
k <- 100 k <- 100
levels <- stats::quantile(x$cvm,probs=seq(from=0,to=1,length.out=k+1)) levels <- stats::quantile(x$cvm,probs=seq(from=0,to=1,length.out=k+1))
col <- colorspace::diverge_hsv(n=k)
## RColorBrewer
if("RColorBrewer" %in% .packages(all.available=TRUE)){
pal <- rev(c("white",RColorBrewer::brewer.pal(n=9,name="Blues")))
col <- grDevices::colorRampPalette(colors=pal)(k)
} else {
col <- grDevices::heat.colors(n=k)
}
nsigma <- length(x$sigma) nsigma <- length(x$sigma)
npi <- length(x$pi) npi <- length(x$pi)
...@@ -324,7 +332,7 @@ plot.cornet <- function(x,...){ ...@@ -324,7 +332,7 @@ plot.cornet <- function(x,...){
graphics::axis(side=1,at=c(1,ssigma,nsigma),labels=signif(x$sigma[c(1,ssigma,nsigma)],digits=2)) graphics::axis(side=1,at=c(1,ssigma,nsigma),labels=signif(x$sigma[c(1,ssigma,nsigma)],digits=2))
graphics::axis(side=2,at=c(1,spi,npi),labels=signif(x$pi[c(1,spi,npi)],digits=2)) graphics::axis(side=2,at=c(1,spi,npi),labels=signif(x$pi[c(1,spi,npi)],digits=2))
# point for tuned parameters # point for tuned parameters
graphics::points(x=ssigma,y=spi,pch=4,col="black",cex=1) graphics::points(x=ssigma,y=spi,pch=4,col="white",cex=1)
} else { } else {
# axes with standard labels # axes with standard labels
at <- seq(from=1,to=nsigma,length.out=5) at <- seq(from=1,to=nsigma,length.out=5)
...@@ -334,7 +342,7 @@ plot.cornet <- function(x,...){ ...@@ -334,7 +342,7 @@ plot.cornet <- function(x,...){
# points for selected parameters # points for selected parameters
isigma <- sapply(x$sigma.min,function(y) which(x$sigma==y)) isigma <- sapply(x$sigma.min,function(y) which(x$sigma==y))
ipi <- sapply(x$pi.min,function(y) which(x$pi==y)) ipi <- sapply(x$pi.min,function(y) which(x$pi==y))
graphics::points(x=isigma,y=ipi,pch=4,col="black",cex=1) graphics::points(x=isigma,y=ipi,pch=4,col="white",cex=1)
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment