Commit 1ec8c58b authored by Armin Rauschenberger's avatar Armin Rauschenberger
Browse files

automation

parent e8ba6460
......@@ -201,8 +201,10 @@ joinet <- function(Y,X,family="gaussian",nfolds=10,foldid=NULL,type.measure="dev
if(family=="gaussian"){
return(x)
} else if(family=="binomial"){
return(log(1/(1-x)))
if(any(x<0|x>1)){stop("Invalid!",call.=FALSE)}
return(log(x/(1-x)))
} else if(family=="poisson"){
if(any(x<0)){stop("Invalid!",call.=FALSE)}
return(log(x))
} else {
stop("Family not implemented.",call.=FALSE)
......
......@@ -84,7 +84,7 @@
<p>The <code>mixnet</code> manuscript is in preparation. Click <a href="https://CRAN.R-project.org/package=mixnet">here</a> for the R package.</p>
<p>The <code>joinet</code> manuscript is in preparation. Click <a href="https://CRAN.R-project.org/package=joinet">here</a> for the R package.</p>
<div id="reference" class="section level2">
<h2 class="hasAnchor">
<a href="#reference" class="anchor"></a>Reference</h2>
......
......@@ -9,6 +9,16 @@ X <- matrix(rnorm(n*p),nrow=n,ncol=p)
family <- c("gaussian","binomial","poisson")
foldid <- palasso:::.folds(y=Y[,2],nfolds=5)
testthat::test_that("link-mean",{
x <- stats::rnorm(n=100)
for(family in c("gaussian","binomial","poisson")){
mean <- joinet:::.mean.function(x,family=family)
link <- joinet:::.link.function(mean,family=family)
cond <- all(abs(x-link)<1e-06)
testthat::expect_true(cond)
}
})
for(alpha in c(0.05,0.95)){
object <- joinet::joinet(Y=Y,X=X,family=family,alpha.base=alpha,foldid=foldid)
......
......@@ -7,7 +7,7 @@ vignette: >
%\VignetteEncoding{UTF-8}
---
The `mixnet` manuscript is in preparation. Click [here](https://CRAN.R-project.org/package=mixnet) for the R package.
The `joinet` manuscript is in preparation. Click [here](https://CRAN.R-project.org/package=joinet) for the R package.
## Reference
......
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