Gitlab is now using https://gitlab.lcsb.uni.lu as it's primary address. Please update your bookmarks. FAQ.

Commit 17b33c0a authored by Armin Rauschenberger's avatar Armin Rauschenberger
Browse files

automation

parent 52e1a1d7
X
cor(X)
cor <- cor(X)
diag(cor)
cor
sample(1:10,size=1)
sample(1:10,size=1.5)
sample(1:10,size=1.6)
sample(1:10,size=1.7)
sample(1:10,size=1.9)
sample(1:10,size=2.0)
y <- sign(y) * abs(y)^frame$k[j]
hist(sign(y) * abs(y)^1)
y <- rnorm(1000)
hist(sign(y) * abs(y)^1)
hist(sign(y) * abs(y)^2)
hist(sign(y) * abs(y)^5)
hist(sign(y) * abs(y)^0.5)
hist(sign(y) * abs(y)^0.1)
hist(sign(y) * abs(y)^0.1,breaks=50)
hist(sign(y) * abs(y)^0.1,breaks=20)
hist(sign(y) * abs(y)^0.1,breaks=10)
hist(sign(y) * abs(y)^0,breaks=50)
hist(sign(y) * abs(y)^Inf,breaks=50)
hist(sign(y) * abs(y)^Inf,breaks=50,xlim=c(-2,2))
hist(sign(y) * abs(y)^Inf,breaks=20,xlim=c(-2,2))
hist(sign(y) * abs(y)^Inf,breaks=10,xlim=c(-2,2))
hist(sign(y) * abs(y)^Inf,breaks=breaks,xlim=c(-2,2))
hist(sign(y) * abs(y)^Inf,breaks=50,xlim=c(-2,2))
hist(sign(y) * abs(y)^Inf,breaks=50,xlim=c(-2,2))
hist(sign(y) * abs(y)^Inf,breaks=50,xlim=c(-1,1))
hist(sign(y)*abs(y)^Inf,breaks=50,xlim=c(-1,1))
hist(sign(y)*abs(y)^99,breaks=50,xlim=c(-1,1))
hist(sign(y)*abs(y)^9,breaks=50,xlim=c(-1,1))
hist(sign(y)*abs(y)^1,breaks=50,xlim=c(-1,1))
hist(sign(y)*abs(y)^1,breaks=50,xlim=c(-1,1))
y
y <- rnorm(1000)
hist(sign(y)*abs(y)^1,breaks=50)
hist(sign(y)*abs(y)^50,breaks=50)
hist(sign(y)*abs(y)^10,breaks=50)
hist(sign(y)*abs(y)^0.1,breaks=50)
hist(sign(y)*abs(y)^0.2,breaks=50)
0^0.2
-0.0001^0.2
(-0.0001)^0.2
(-0.001)^0.2
(-0.01)^0.2
(0.01)^0.2
(0.01)^0.05
(0.01)^0.05
(0.01)^0.05
(0.01)^0.001
(0.01)^0.000001
?quantile
?quantile
?optim
f=expression(x^2+3*x)
D(f,'x')
f <- expression(x^2+3*x+a)
D(f,'x')
f <- expression(x^2+3*x+a)
D(f,'x')
f <- expression(x^a+3*x)
D(f,'x')
f <- expression((1-pi)*z+pi*phi)
D(f,'x')
D(f,'pi')
f <- expression((1-pi)*z+pi*phi)
D(f,'pi')
f <- expression(sum(a+b))
D(f,'pi')
0^1
?ddnorm
?dnorm
?quantile
hist(rnorm(10000))
hist(rnorm(10000)^2)
x <- rnorm(10000)^2
hist(x)
x <- rnorm(10000)
hist(x)
hist(sign(x)*abs(x)^2)
hist(sign(x)*abs(x)^2,breaks=50)
hist(sign(x)*abs(x)^10,breaks=50)
hist(sign(x)*abs(x)^5,breaks=50)
hist(sign(x)*abs(x)^2,breaks=50)
hist(sign(x)*abs(x)^(-2),breaks=50)
hist(sign(x)*abs(x)^(-1),breaks=50)
hist(sign(x)*abs(x)^(-0.2),breaks=50)
80/5
80/30
80/5
hist(sign(x)*abs(x)^(-0.2),breaks=50)
hist(sign(x)*abs(x)^(10),breaks=50)
hist(sign(x)*abs(x)^(50),breaks=50)
range(x)
range(x)
hist(sign(x)*abs(x)^(50),breaks=50)
hist(sign(x)*abs(x)^(50),breaks=50,xlim=c(-1,1))
hist(sign(x)*abs(x)^(50),breaks=5000,xlim=c(-1,1))
hist(sign(x)*abs(x)^(10),breaks=5000,xlim=c(-1,1))
hist(sign(x)*abs(x)^(10),breaks=5000000,xlim=c(-1,1))
hist(sign(x)*abs(x)^(3),breaks=5000000,xlim=c(-1,1))
hist(sign(x)*abs(x)^(3),1e+06,xlim=c(-1,1))
hist(sign(x)*abs(x)^(3),10000,xlim=c(-1,1))
hist(sign(x)*abs(x)^(3),10000,xlim=c(-1,1))
hist(sign(x)*abs(x)^(3),10000,xlim=c(-2,2))
range(sign(x)*abs(x)^(3))
range(sign(x)*abs(x)^(1))
range(sign(x)*abs(x)^(5))
(-1)^1000
(-1.1)^1000
(-1)^1000
(-0.9)^1000
?p.adjust
set.seed(1)
#devtools::install_github("rauschenberger/palasso",ref="4802b1d")
#devtools::install_github("rauschenberger/cornet",
# ref="bcfdcc0",dependencies=FALSE)
# devtools::install_github("rauschenberger/decline",ref="cb187ec",dependencies=FALSE)
rm(list=ls(all.names=TRUE))
.source <- .target <- "C:/Users/armin.rauschenberger/Desktop/cornet/analysis"
# --- Preparing data. ---
load(file.path(.source,"ppmi_2018-11-20.RData"),verbose=TRUE)
if(any(Y[,"visit0"]!=X$"MOCA-MCATOT",na.rm=TRUE)){stop("Mismatch.")}
if(any(rownames(Y)!=rownames(X))){stop("Mismatch.")}
Y <- Y[,-1]
X <- decline::curate_missing(X)
X <- decline::curate_hidden(X)
X <- decline::curate_levels(X)
X <- decline::curate_constant(X)
#--- multiple imputation ---
set.seed(1)
names <- colnames(X)
colnames(X) <- paste0("x",seq_len(ncol(X)))
X_imp <- list()
for(i in seq_len(10)){
X_imp[[i]] <- missRanger::missRanger(data = X, pmm.k = 3, num.trees = 100) # before without pmm.k and num.trees
colnames(X_imp[[i]]) <- names
}
# --- Cross-validating models. ---
names <- paste0(rep(c("lasso","ridge"),each=4),seq_len(4))
loss <- fit <- pval <- list()
for(i in seq_along(X_imp)){
loss[[i]] <- fit[[i]] <- pval[[i]] <- list()
cat("i =",i,"\n")
x <- scale(decline::curate_dummies(as.data.frame(X_imp[[i]])))
for(j in seq_along(names)){
cat("j =",j," ")
alpha <- 1*(substr(names[j],start=1,stop=5)=="lasso")
index <- as.numeric(substr(names[j],start=6,stop=6))
y <- Y[,index]
cond <- !is.na(y)
set.seed(i)
loss[[i]][[names[j]]] <- cornet:::cv.cornet(y=y[cond],cutoff=25.5,
X=x[cond,],alpha=alpha)
set.seed(i)
fit[[i]][[names[j]]] <- cornet::cornet(y=y[cond],cutoff=25.5,
X=x[cond,],alpha=alpha)
set.seed(i)
pval[[i]][[names[j]]] <- cornet:::.test(y=y[cond],cutoff=25.5,
X=x[cond,],alpha=alpha)
}
}
save(loss,fit,pval,file=file.path(.target,"application.RData"))
#--- interpretation ---
load(file.path(.target,"application.RData"),verbose=TRUE)
names <- c(paste0("lasso",1:4),paste0("ridge",1:4))
frame <- data.frame(row.names=names)
for(i in names){
# proportion of data sets with deviance decrease
dev <- as.data.frame(t(sapply(loss,function(x) x[[i]]$deviance)))
frame[i,"dev.prop"] <- round(mean(dev$combined < dev$binomial),digits=2)
# deviance change in percent
dec <- (dev$combined-dev$binomial)/dev$binomial
frame[i,"dev.min"] <- round(100*min(dec),digits=1)
frame[i,"dev.max"] <- round(100*max(dec),digits=1)
# proportion of data sets with AUC increase
auc <- as.data.frame(t(sapply(loss,function(x) x[[i]]$auc)))
frame[i,"auc.prop"] <- round(mean(auc$combined > auc$binomial),digits=2)
# quantiles weight parameter
q <- round(quantile(sapply(fit,function(x) x[[i]]$pi.min),probs=c(0,0.5,1)),digits=2)
frame[i,"pi.min"] <- q[1]
frame[i,"pi.med"] <- q[2]
frame[i,"pi.max"] <- q[3]
# quantiles scale parameter
q <- round(quantile(sapply(fit,function(x) x[[i]]$sigma.min),probs=c(0,0.5,1)),digits=2)
frame[i,"sd.min"] <- q[1]
frame[i,"sd.med"] <- q[2]
frame[i,"sd.max"] <- q[3]
# significance based on multi-split
pvalue <- sapply(pval,function(x) median(unlist(x[[i]])))
frame[i,"pval.min"] <- signif(min(pvalue),digits=2)
frame[i,"pval.max"] <- signif(max(pvalue),digits=2)
frame[i,"pval.prop"] <- round(mean(pvalue<0.05),digits=2)
}
frame
writeLines(text=capture.output(utils::sessionInfo()),
con=file.path(.target,"info_app.txt"))
?auc
?pROC::auc
response <- rep(c(0,1),times=c(50,50))
predictor <- runif(100)
auc(response,predictor)
pROC::auc(response,predictor)
pROC::auc(response,predictor)
response <- rep(c(0,1),times=c(95,5))
pROC::auc(response,predictor)
pROC::auc(response,predictor)
pROC::auc(response,predictor)
pROC::auc(response,predictor)
response <- rep(c(0,1),times=c(95,5))
response <- rep(c(0,1),times=c(95,5)); predictor <- runif(100)
pROC::auc(response,predictor)
response <- rep(c(0,1),times=c(95,5)); predictor <- runif(100)
pROC::auc(response,predictor)
response <- rep(c(0,1),times=c(95,5)); predictor <- runif(100)
pROC::auc(response,predictor)
response <- rep(c(0,1),times=c(95,5)); predictor <- runif(100)
pROC::auc(response,predictor)
response <- rep(c(0,1),times=c(95,5)); predictor <- 0
pROC::auc(response,predictor)
response <- rep(c(0,1),times=c(95,5)); predictor <- rep(0,times=100)
pROC::auc(response,predictor)
response <- rep(c(0,1),times=c(95,5)); predictor <- rep(1,times=100)
pROC::auc(response,predictor)
?missRanger
?missRanger::missRanger
install.packages(c("assertthat", "backports", "callr", "cli", "clipr", "curl", "devtools", "digest", "evaluate", "foreach", "fs", "git2r", "glmnet", "highr", "iterators", "knitr", "markdown", "mime", "openssl", "palasso", "parsedate", "pillar", "pkgbuild", "processx", "purrr", "rcmdcheck", "Rcpp", "rematch2", "remotes", "rhub", "rlang", "rmarkdown", "rsconnect", "rstudioapi", "rversions", "sys", "testthat", "tibble", "tinytex", "usethis", "whoami", "xfun", "xml2"))
##############
### cornet ###
##############
#--- generate toydata ----------------------------------------------------------
set.seed(1)
#toydata <- NULL
#save(toydata,file=file.path("C:/Users/armin.rauschenberger/Desktop/package/cornet/data/toydata.R"))
#--- compile package -----------------------------------------------------------
rm(list=ls())
name <- "cornet"
#load("D:/cornet/package/toydata.RData")
pkg <- "C:/Users/armin.rauschenberger/Desktop/cornet/cornet"
setwd(dir=pkg)
devtools::as.package(x=pkg,create=FALSE)
devtools::load_all(path=pkg)
#usethis::use_data(toydata,overwrite=TRUE)
devtools::document(pkg=pkg)
unlink(file.path(pkg,"vignettes","figure"),recursive=TRUE)
#all <- dir(file.path(pkg,"vignettes"))
#delete <- "..."
#sapply(delete,function(x) file.remove(file.path(pkg,"vignettes",x)))
setwd(dir=pkg)
unlink(file.path(pkg,"docs"),recursive=TRUE)
pkgdown::build_site(pkg=pkg)
file.remove(file.path(pkg,c(".Rbuildignore",".Rhistory")))
usethis::use_build_ignore(files=c("Readme.Rmd",".travis.yml","_pkgdown.yml","docs","cran-comments.md","appveyor.yml",".Rhistory"))
devtools::check(pkg=pkg,quiet=FALSE,manual=TRUE)
devtools::install(pkg=pkg,upgrade=FALSE)
##############
### mixnet ###
##############
#--- generate toydata ----------------------------------------------------------
set.seed(1)
#toydata <- NULL
#save(toydata,file=file.path("C:/Users/armin.rauschenberger/Desktop/package/cornet/data/toydata.R"))
#--- compile package -----------------------------------------------------------
rm(list=ls())
name <- "mixnet"
#load("D:/cornet/package/toydata.RData")
pkg <- "C:/Users/armin.rauschenberger/Desktop/mixnet/mixnet"
setwd(dir=pkg)
devtools::as.package(x=pkg,create=FALSE)
devtools::load_all(path=pkg)
#usethis::use_data(toydata,overwrite=TRUE)
devtools::document(pkg=pkg)
unlink(file.path(pkg,"vignettes","figure"),recursive=TRUE)
setwd(dir=pkg)
unlink(file.path(pkg,"docs"),recursive=TRUE)
pkgdown::build_site(pkg=pkg)
file.remove(file.path(pkg,c(".Rbuildignore",".Rhistory")))
usethis::use_build_ignore(files=c("Readme.Rmd",".travis.yml","_pkgdown.yml","docs","cran-comments.md","appveyor.yml",".Rhistory"))
devtools::check(pkg=pkg,quiet=FALSE,manual=TRUE)
devtools::install(pkg=pkg,upgrade=FALSE)
cornet::.check
cornet:::.check
file.remove(file.path(pkg,c(".Rbuildignore",".Rhistory")))
usethis::use_build_ignore(files=c("Readme.Rmd",".travis.yml","_pkgdown.yml","docs","cran-comments.md","appveyor.yml",".Rhistory"))
#--- generate toydata ----------------------------------------------------------
set.seed(1)
#toydata <- NULL
#save(toydata,file=file.path("C:/Users/armin.rauschenberger/Desktop/package/cornet/data/toydata.R"))
#--- compile package -----------------------------------------------------------
rm(list=ls())
name <- "mixnet"
#load("D:/cornet/package/toydata.RData")
pkg <- "C:/Users/armin.rauschenberger/Desktop/mixnet/mixnet"
setwd(dir=pkg)
devtools::as.package(x=pkg,create=FALSE)
devtools::load_all(path=pkg)
#usethis::use_data(toydata,overwrite=TRUE)
devtools::document(pkg=pkg)
unlink(file.path(pkg,"vignettes","figure"),recursive=TRUE)
setwd(dir=pkg)
unlink(file.path(pkg,"docs"),recursive=TRUE)
pkgdown::build_site(pkg=pkg)
file.remove(file.path(pkg,c(".Rbuildignore",".Rhistory")))
usethis::use_build_ignore(files=c("Readme.Rmd",".travis.yml","_pkgdown.yml","docs","cran-comments.md","appveyor.yml",".Rhistory"))
devtools::check(pkg=pkg,quiet=FALSE,manual=TRUE)
?palasso:::.folds
palasso::.folds
palasso:::.folds
cornet:::.check
usethis::use_build_ignore(files=c("Readme.Rmd",".travis.yml","_pkgdown.yml","docs","cran-comments.md","appveyor.yml",".Rhistory"))
?usethis::use_build_ignore
file.remove(file.path(pkg,c(".Rbuildignore",".Rhistory")))
usethis::use_build_ignore(files=c("Readme.Rmd",".travis.yml","_pkgdown.yml","docs","cran-comments.md","appveyor.yml",".Rhistory"))
usethis::use_build_ignore(files=c("Readme.Rmd",".travis.yml","_pkgdown.yml","docs","cran-comments.md","appveyor.yml",".Rhistory"))
pkg
set.seed(1)
rm(list=ls())
name <- "mixnet"
pkg <- "C:/Users/armin.rauschenberger/Desktop/mixnet/mixnet"
setwd(dir=pkg)
devtools::as.package(x=pkg,create=FALSE)
devtools::load_all(path=pkg)
#usethis::use_data(toydata,overwrite=TRUE)
devtools::document(pkg=pkg)
?unlink
unlink(file.path(pkg,"vignettes","figure"),recursive=TRUE)
setwd(dir=pkg)
unlink(file.path(pkg,"docs"),recursive=TRUE)
pkgdown::build_site(pkg=pkg)
usethis::use_build_ignore(files=c("Readme.Rmd",".travis.yml","_pkgdown.yml","docs","cran-comments.md","appveyor.yml",".Rhistory"))
file.remove(file.path(pkg,c(".Rbuildignore",".Rhistory")))
usethis::use_build_ignore(files=c("Readme.Rmd",".travis.yml","_pkgdown.yml","docs","cran-comments.md","appveyor.yml",".Rhistory"))
devtools::check(pkg=pkg,quiet=FALSE,manual=TRUE)
devtools::spell_check(pkg=pkg)
devtools::check_rhub(pkg=pkg)
#pkg <- "C:/Users/armin.rauschenberger/Desktop/mixnet/mixnet"
setwd(pkg)
pkg
system("git remote set-url origin https://rauschenberger:Eu57Rom!@github.com/rauschenberger/mixnet.git")
system("git remote -v")
system("git add --all")
system("git commit -m \"automation\"")
system("git push origin master") # GitHub
#install.packages("plsgenomics")
data(Ecoli,package="plsgenomics")
install.packages("plsgenomics")
install.packages("BiocManager")
BiocManager::install("mixOmics")
##############
### mixnet ###
##############
#--- generate toydata ----------------------------------------------------------
set.seed(1)
#toydata <- NULL
#save(toydata,file=file.path("C:/Users/armin.rauschenberger/Desktop/package/cornet/data/toydata.R"))
#--- compile package -----------------------------------------------------------
rm(list=ls())
name <- "mixnet"
#load("D:/cornet/package/toydata.RData")
pkg <- "C:/Users/armin.rauschenberger/Desktop/mixnet/mixnet"
setwd(dir=pkg)
devtools::as.package(x=pkg,create=FALSE)
devtools::load_all(path=pkg)
#usethis::use_data(toydata,overwrite=TRUE)
devtools::document(pkg=pkg)
unlink(file.path(pkg,"vignettes","figure"),recursive=TRUE)
setwd(dir=pkg)
unlink(file.path(pkg,"docs"),recursive=TRUE)
pkgdown::build_site(pkg=pkg)
#file.remove(file.path(pkg,c(".Rbuildignore",".Rhistory")))
#usethis::use_build_ignore(files=c("Readme.Rmd",".travis.yml","_pkgdown.yml","docs","cran-comments.md","appveyor.yml",".Rhistory"))
devtools::check(pkg=pkg,quiet=FALSE,manual=TRUE)
devtools::install(pkg=pkg,upgrade=FALSE)
#install.packages("plsgenomics")
data(Ecoli,package="plsgenomics")
X <- Ecoli$CONNECdata
Y <- Ecoli$GEdata
loss <- mixnet:::cv.mixnet(Y=Y,X=X)
loss
loss["meta",]<loss["base",]
mean(loss["meta",]<loss["base",])
mean(loss["meta",]<loss["base",])
#install.packages("BiocManager")
#BiocManager::install("mixOmics")
data(liver.toxicity,package="mixOmics")
X <- liver.toxicity$gene
Y <- liver.toxicity$clinic
Y$Cholesterol.mg.dL. <- -Y$Cholesterol.mg.dL.
loss <- mixnet:::cv.mixnet(Y=Y,X=X)
mean(loss["meta",]<loss["base",])
loss
mean(loss["meta",]<=loss["base",])
sum(loss["meta",]<=loss["base",])/sum(loss["meta",]<=loss["base",])
sum(loss["meta",]<=loss["base",])/sum(loss["meta",]<=loss["base",])
sum(loss["meta",]<=loss["base",])/sum(loss["base",]<=loss["none",])
loss
#install.packages("plsgenomics")
data(Ecoli,package="plsgenomics")
X <- Ecoli$CONNECdata
Y <- Ecoli$GEdata
loss <- mixnet:::cv.mixnet(Y=Y,X=X)
rowMeans(loss)
mean(loss["meta",]<=loss["base",])
data(Ecoli,package="plsgenomics")
X <- Ecoli$CONNECdata
Y <- Ecoli$GEdata
loss <- mixnet:::cv.mixnet(Y=Y,X=X)
mean(loss["meta",]<=loss["base",])
##############
### mixnet ###
##############
#--- generate toydata ----------------------------------------------------------
set.seed(1)
#toydata <- NULL
#save(toydata,file=file.path("C:/Users/armin.rauschenberger/Desktop/package/cornet/data/toydata.R"))
#--- compile package -----------------------------------------------------------
rm(list=ls())
name <- "mixnet"
#load("D:/cornet/package/toydata.RData")
pkg <- "C:/Users/armin.rauschenberger/Desktop/mixnet/mixnet"
setwd(dir=pkg)
devtools::as.package(x=pkg,create=FALSE)
devtools::load_all(path=pkg)
#usethis::use_data(toydata,overwrite=TRUE)
devtools::document(pkg=pkg)
unlink(file.path(pkg,"vignettes","figure"),recursive=TRUE)
setwd(dir=pkg)
unlink(file.path(pkg,"docs"),recursive=TRUE)
pkgdown::build_site(pkg=pkg)
#file.remove(file.path(pkg,c(".Rbuildignore",".Rhistory")))
#usethis::use_build_ignore(files=c("Readme.Rmd",".travis.yml","_pkgdown.yml","docs","cran-comments.md","appveyor.yml",".Rhistory"))
devtools::check(pkg=pkg,quiet=FALSE,manual=TRUE)
devtools::install(pkg=pkg,upgrade=FALSE)
#devtools::build(pkg=pkg)
#devtools::build(pkg=pkg,binary=TRUE) # only for zip file
#.rs.restartR()
#pkg <- "C:/Users/armin.rauschenberger/Desktop/cornet/cornet"
#version <- substring(text=readLines(file.path(pkg,"DESCRIPTION"))[[2]],first=10)
#archive <- paste0("C:/Users/armin.rauschenberger/Desktop/cornet/cornet_",version,".zip")
#utils::install.packages(archive,repos=NULL)
#--- upload package ------------------------------------------------------------
#pkg <- "C:/Users/armin.rauschenberger/Desktop/mixnet/mixnet"
setwd(pkg)
system("git remote set-url origin https://rauschenberger:Eu57Rom!@github.com/rauschenberger/mixnet.git")
system("git remote -v")
system("git add --all")
system("git commit -m \"automation\"")
system("git push origin master") # GitHub
##############
### mixnet ###
##############
#--- generate toydata ----------------------------------------------------------
set.seed(1)
#toydata <- NULL
#save(toydata,file=file.path("C:/Users/armin.rauschenberger/Desktop/package/cornet/data/toydata.R"))
#--- compile package -----------------------------------------------------------
rm(list=ls())
name <- "mixnet"
#load("D:/cornet/package/toydata.RData")
pkg <- "C:/Users/armin.rauschenberger/Desktop/mixnet/mixnet"
setwd(dir=pkg)
devtools::as.package(x=pkg,create=FALSE)
devtools::load_all(path=pkg)
#usethis::use_data(toydata,overwrite=TRUE)
devtools::document(pkg=pkg)
unlink(file.path(pkg,"vignettes","figure"),recursive=TRUE)
setwd(dir=pkg)
unlink(file.path(pkg,"docs"),recursive=TRUE)
pkgdown::build_site(pkg=pkg)
#file.remove(file.path(pkg,c(".Rbuildignore",".Rhistory")))
#usethis::use_build_ignore(files=c("Readme.Rmd",".travis.yml","_pkgdown.yml","docs","cran-comments.md","appveyor.yml",".Rhistory"))
devtools::check(pkg=pkg,quiet=FALSE,manual=TRUE)
devtools::install(pkg=pkg,upgrade=FALSE)
#devtools::build(pkg=pkg)
#devtools::build(pkg=pkg,binary=TRUE) # only for zip file
#.rs.restartR()
#pkg <- "C:/Users/armin.rauschenberger/Desktop/cornet/cornet"
#version <- substring(text=readLines(file.path(pkg,"DESCRIPTION"))[[2]],first=10)
#archive <- paste0("C:/Users/armin.rauschenberger/Desktop/cornet/cornet_",version,".zip")
#utils::install.packages(archive,repos=NULL)
#--- upload package ------------------------------------------------------------
#pkg <- "C:/Users/armin.rauschenberger/Desktop/mixnet/mixnet"
setwd(pkg)
system("git remote set-url origin https://rauschenberger:Eu57Rom!@github.com/rauschenberger/mixnet.git")
system("git remote -v")
system("git add --all")
system("git commit -m \"automation\"")
system("git push origin master") # GitHub
set.seed(1)
#toydata <- NULL
#save(toydata,file=file.path("C:/Users/armin.rauschenberger/Desktop/package/cornet/data/toydata.R"))
#--- compile package -----------------------------------------------------------
rm(list=ls())
name <- "joinet"
#load("D:/cornet/package/toydata.RData")
pkg <- "C:/Users/armin.rauschenberger/Desktop/joinet/joinet"
setwd(dir=pkg)
devtools::as.package(x=pkg,create=FALSE)
devtools::load_all(path=pkg)
#usethis::use_data(toydata,overwrite=TRUE)
devtools::document(pkg=pkg)
unlink(file.path(pkg,"vignettes","figure"),recursive=TRUE)
setwd(dir=pkg)
unlink(file.path(pkg,"docs"),recursive=TRUE)
pkgdown::build_site(pkg=pkg)
#file.remove(file.path(pkg,c(".Rbuildignore",".Rhistory")))
#usethis::use_build_ignore(files=c("Readme.Rmd",".travis.yml","_pkgdown.yml","docs","cran-comments.md","appveyor.yml",".Rhistory"))
devtools::check(pkg=pkg,quiet=FALSE,manual=TRUE)
devtools::install(pkg=pkg,upgrade=FALSE)
Package: mixnet
Package: joinet
Version: 0.0.1
Title: Multivariate Regression
Description: Implements high-dimensional multivariate regression by stacking (Rauschenberger et al. 2019).
......
# Generated by roxygen2: do not edit by hand
S3method(coef,mixnet)
S3method(predict,mixnet)
S3method(weights,mixnet)
export(cv.mixnet)
export(mixnet)
S3method(coef,joinet)
S3method(predict,joinet)
S3method(weights,joinet)
export(cv.joinet)
export(joinet)
importFrom(stats,weights)
......@@ -2,7 +2,7 @@
#--- Main function -------------------------------------------------------------
#' @export
#' @aliases mixnet-package
#' @aliases joinet-package
#' @title
#' Multivariate Elastic Net Regression
#'
......@@ -69,9 +69,9 @@
#' n <- 30; q <- 2; p <- 20
#' Y <- matrix(rnorm(n*q),nrow=n,ncol=q)
#' X <- matrix(rnorm(n*p),nrow=n,ncol=p)
#' object <- mixnet(Y=Y,X=X)
#' object <- joinet(Y=Y,X=X)
#'
mixnet <- function(Y,X,family="gaussian",nfolds=10,foldid=NULL,type.measure="deviance",alpha.base=0,alpha.meta=0,...){
joinet <- function(Y,X,family="gaussian",nfolds=10,foldid=NULL,type.measure="deviance",alpha.base=0,alpha.meta=0,...){
#--- temporary ---
# family <- "gaussian"; nfolds <- 10; foldid <- NULL; type.measure <- "deviance"
......@@ -181,7 +181,7 @@ mixnet <- function(Y,X,family="gaussian",nfolds=10,foldid=NULL,type.measure="dev
names(base) <- names(meta) <- paste0("y",seq_len(q))
info <- data.frame(q=q,p=p,family=family,type.measure=type.measure)
list <- list(base=base,meta=meta,info=info)
class(list) <- "mixnet"
class(list) <- "joinet"
return(list)
}
......@@ -209,7 +209,7 @@ mixnet <- function(Y,X,family="gaussian",nfolds=10,foldid=NULL,type.measure="dev
}
}
#--- Methods for class "mixnet" -----------------------------------------------
#--- Methods for class "joinet" -----------------------------------------------
#' @export
#' @title
......@@ -219,7 +219,7 @@ mixnet <- function(Y,X,family="gaussian",nfolds=10,foldid=NULL,type.measure="dev
#' Predicts outcome from features with stacked model.
#'
#' @param object
#' \link[mixnet]{mixnet} object
#' \link[joinet]{joinet} object
#'
#' @param newx