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

vignette

parent f01b9f84
...@@ -273,12 +273,14 @@ joinet <- function(Y,X,family="gaussian",nfolds=10,foldid=NULL,type.measure="dev ...@@ -273,12 +273,14 @@ joinet <- function(Y,X,family="gaussian",nfolds=10,foldid=NULL,type.measure="dev
#' with \eqn{n} rows (samples) and \eqn{q} columns (variables). #' with \eqn{n} rows (samples) and \eqn{q} columns (variables).
#' #'
#' @examples #' @examples
#' if(!grepl('SunOS',Sys.info()['sysname'])){
#' n <- 50; p <- 100; q <- 3 #' n <- 50; p <- 100; q <- 3
#' X <- matrix(rnorm(n*p),nrow=n,ncol=p) #' X <- matrix(rnorm(n*p),nrow=n,ncol=p)
#' Y <- replicate(n=q,expr=rnorm(n=n,mean=rowSums(X[,1:5]))) #' Y <- replicate(n=q,expr=rnorm(n=n,mean=rowSums(X[,1:5])))
#' Y[,1] <- 1*(Y[,1]>median(Y[,1])) #' Y[,1] <- 1*(Y[,1]>median(Y[,1]))
#' object <- joinet(Y=Y,X=X,family=c("binomial","gaussian","gaussian")) #' object <- joinet(Y=Y,X=X,family=c("binomial","gaussian","gaussian"))
#' predict(object,newx=X) #' predict(object,newx=X)
#' }
#' #'
predict.joinet <- function(object,newx,type="response",...){ predict.joinet <- function(object,newx,type="response",...){
if(length(list(...))!=0){warning("Ignoring argument.",call.=FALSE)} if(length(list(...))!=0){warning("Ignoring argument.",call.=FALSE)}
...@@ -345,7 +347,6 @@ predict.joinet <- function(object,newx,type="response",...){ ...@@ -345,7 +347,6 @@ predict.joinet <- function(object,newx,type="response",...){
#' #'
#' @examples #' @examples
#' if(!grepl('SunOS',Sys.info()['sysname'])){ #' if(!grepl('SunOS',Sys.info()['sysname'])){
#' 1+1
#' n <- 50; p <- 100; q <- 3 #' n <- 50; p <- 100; q <- 3
#' X <- matrix(rnorm(n*p),nrow=n,ncol=p) #' X <- matrix(rnorm(n*p),nrow=n,ncol=p)
#' Y <- replicate(n=q,expr=rnorm(n=n,mean=rowSums(X[,1:5]))) #' Y <- replicate(n=q,expr=rnorm(n=n,mean=rowSums(X[,1:5])))
...@@ -414,11 +415,13 @@ coef.joinet <- function(object,...){ ...@@ -414,11 +415,13 @@ coef.joinet <- function(object,...){
#' in the row on the outcomes in the column. #' in the row on the outcomes in the column.
#' #'
#' @examples #' @examples
#' if(!grepl('SunOS',Sys.info()['sysname'])){
#' n <- 50; p <- 100; q <- 3 #' n <- 50; p <- 100; q <- 3
#' X <- matrix(rnorm(n*p),nrow=n,ncol=p) #' X <- matrix(rnorm(n*p),nrow=n,ncol=p)
#' Y <- replicate(n=q,expr=rnorm(n=n,mean=rowSums(X[,1:5]))) #' Y <- replicate(n=q,expr=rnorm(n=n,mean=rowSums(X[,1:5])))
#' object <- joinet(Y=Y,X=X) #' object <- joinet(Y=Y,X=X)
#' weights(object) #' weights(object)
#' }
#' #'
weights.joinet <- function(object,...){ weights.joinet <- function(object,...){
if(length(list(...))!=0){warning("Ignoring argument.",call.=FALSE)} if(length(list(...))!=0){warning("Ignoring argument.",call.=FALSE)}
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#' Y <- replicate(n=q,expr=rnorm(n=n,mean=rowSums(X[,1:5]))) #' Y <- replicate(n=q,expr=rnorm(n=n,mean=rowSums(X[,1:5])))
#' # n samples, p inputs, q outputs #' # n samples, p inputs, q outputs
#' #'
#' if(!grepl('SunOS',Sys.info()['sysname'])){
#' #--- model fitting --- #' #--- model fitting ---
#' object <- joinet(Y=Y,X=X) #' object <- joinet(Y=Y,X=X)
#' # slot "base": univariate #' # slot "base": univariate
...@@ -58,6 +59,7 @@ ...@@ -58,6 +59,7 @@
#' # cross-validated loss #' # cross-validated loss
#' # row "base": univariate #' # row "base": univariate
#' # row "meta": multivariate #' # row "meta": multivariate
#' }
#' #'
NULL NULL
...@@ -4,5 +4,5 @@ pkgdown_sha: ~ ...@@ -4,5 +4,5 @@ pkgdown_sha: ~
articles: articles:
article: article.html article: article.html
joinet: joinet.html joinet: joinet.html
last_built: 2020-11-02T15:36Z last_built: 2020-11-02T17:32Z
...@@ -156,7 +156,6 @@ in a matrix with \(p\) rows (inputs) and \(q\) columns.</p> ...@@ -156,7 +156,6 @@ in a matrix with \(p\) rows (inputs) and \(q\) columns.</p>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='kw'>if</span>(!<span class='fu'><a href='https://rdrr.io/r/base/grep.html'>grepl</a></span>(<span class='st'>'SunOS'</span>,<span class='fu'><a href='https://rdrr.io/r/base/Sys.info.html'>Sys.info</a></span>()[<span class='st'>'sysname'</span>])){ <pre class="examples"><div class='input'><span class='kw'>if</span>(!<span class='fu'><a href='https://rdrr.io/r/base/grep.html'>grepl</a></span>(<span class='st'>'SunOS'</span>,<span class='fu'><a href='https://rdrr.io/r/base/Sys.info.html'>Sys.info</a></span>()[<span class='st'>'sysname'</span>])){
<span class='fl'>1</span>+<span class='fl'>1</span>
<span class='no'>n</span> <span class='kw'>&lt;-</span> <span class='fl'>50</span>; <span class='no'>p</span> <span class='kw'>&lt;-</span> <span class='fl'>100</span>; <span class='no'>q</span> <span class='kw'>&lt;-</span> <span class='fl'>3</span> <span class='no'>n</span> <span class='kw'>&lt;-</span> <span class='fl'>50</span>; <span class='no'>p</span> <span class='kw'>&lt;-</span> <span class='fl'>100</span>; <span class='no'>q</span> <span class='kw'>&lt;-</span> <span class='fl'>3</span>
<span class='no'>X</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/matrix.html'>matrix</a></span>(<span class='fu'><a href='https://rdrr.io/r/stats/Normal.html'>rnorm</a></span>(<span class='no'>n</span>*<span class='no'>p</span>),<span class='kw'>nrow</span><span class='kw'>=</span><span class='no'>n</span>,<span class='kw'>ncol</span><span class='kw'>=</span><span class='no'>p</span>) <span class='no'>X</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/matrix.html'>matrix</a></span>(<span class='fu'><a href='https://rdrr.io/r/stats/Normal.html'>rnorm</a></span>(<span class='no'>n</span>*<span class='no'>p</span>),<span class='kw'>nrow</span><span class='kw'>=</span><span class='no'>n</span>,<span class='kw'>ncol</span><span class='kw'>=</span><span class='no'>p</span>)
<span class='no'>Y</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/lapply.html'>replicate</a></span>(<span class='kw'>n</span><span class='kw'>=</span><span class='no'>q</span>,<span class='kw'>expr</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/stats/Normal.html'>rnorm</a></span>(<span class='kw'>n</span><span class='kw'>=</span><span class='no'>n</span>,<span class='kw'>mean</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/base/colSums.html'>rowSums</a></span>(<span class='no'>X</span>[,<span class='fl'>1</span>:<span class='fl'>5</span>]))) <span class='no'>Y</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/lapply.html'>replicate</a></span>(<span class='kw'>n</span><span class='kw'>=</span><span class='no'>q</span>,<span class='kw'>expr</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/stats/Normal.html'>rnorm</a></span>(<span class='kw'>n</span><span class='kw'>=</span><span class='no'>n</span>,<span class='kw'>mean</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/base/colSums.html'>rowSums</a></span>(<span class='no'>X</span>[,<span class='fl'>1</span>:<span class='fl'>5</span>])))
......
...@@ -160,6 +160,7 @@ to open the vignette.</p> ...@@ -160,6 +160,7 @@ to open the vignette.</p>
<span class='no'>Y</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/lapply.html'>replicate</a></span>(<span class='kw'>n</span><span class='kw'>=</span><span class='no'>q</span>,<span class='kw'>expr</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/stats/Normal.html'>rnorm</a></span>(<span class='kw'>n</span><span class='kw'>=</span><span class='no'>n</span>,<span class='kw'>mean</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/base/colSums.html'>rowSums</a></span>(<span class='no'>X</span>[,<span class='fl'>1</span>:<span class='fl'>5</span>]))) <span class='no'>Y</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/lapply.html'>replicate</a></span>(<span class='kw'>n</span><span class='kw'>=</span><span class='no'>q</span>,<span class='kw'>expr</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/stats/Normal.html'>rnorm</a></span>(<span class='kw'>n</span><span class='kw'>=</span><span class='no'>n</span>,<span class='kw'>mean</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/base/colSums.html'>rowSums</a></span>(<span class='no'>X</span>[,<span class='fl'>1</span>:<span class='fl'>5</span>])))
<span class='co'># n samples, p inputs, q outputs</span> <span class='co'># n samples, p inputs, q outputs</span>
<span class='kw'>if</span>(!<span class='fu'><a href='https://rdrr.io/r/base/grep.html'>grepl</a></span>(<span class='st'>'SunOS'</span>,<span class='fu'><a href='https://rdrr.io/r/base/Sys.info.html'>Sys.info</a></span>()[<span class='st'>'sysname'</span>])){
<span class='co'>#--- model fitting ---</span> <span class='co'>#--- model fitting ---</span>
<span class='no'>object</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='joinet.html'>joinet</a></span>(<span class='kw'>Y</span><span class='kw'>=</span><span class='no'>Y</span>,<span class='kw'>X</span><span class='kw'>=</span><span class='no'>X</span>) <span class='no'>object</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='joinet.html'>joinet</a></span>(<span class='kw'>Y</span><span class='kw'>=</span><span class='no'>Y</span>,<span class='kw'>X</span><span class='kw'>=</span><span class='no'>X</span>)
<span class='co'># slot "base": univariate</span> <span class='co'># slot "base": univariate</span>
...@@ -180,7 +181,8 @@ to open the vignette.</p> ...@@ -180,7 +181,8 @@ to open the vignette.</p>
<span class='no'>loss</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='cv.joinet.html'>cv.joinet</a></span>(<span class='kw'>Y</span><span class='kw'>=</span><span class='no'>Y</span>,<span class='kw'>X</span><span class='kw'>=</span><span class='no'>X</span>) <span class='no'>loss</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='cv.joinet.html'>cv.joinet</a></span>(<span class='kw'>Y</span><span class='kw'>=</span><span class='no'>Y</span>,<span class='kw'>X</span><span class='kw'>=</span><span class='no'>X</span>)
<span class='co'># cross-validated loss</span> <span class='co'># cross-validated loss</span>
<span class='co'># row "base": univariate</span> <span class='co'># row "base": univariate</span>
<span class='co'># row "meta": multivariate</span></div></pre> <span class='co'># row "meta": multivariate</span>
}</div></pre>
</div> </div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar"> <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top"> <nav id="toc" data-toggle="toc" class="sticky-top">
......
...@@ -159,12 +159,14 @@ The slots <code>base</code> and <code>meta</code> each contain a matrix ...@@ -159,12 +159,14 @@ The slots <code>base</code> and <code>meta</code> each contain a matrix
with \(n\) rows (samples) and \(q\) columns (variables).</p> with \(n\) rows (samples) and \(q\) columns (variables).</p>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='no'>n</span> <span class='kw'>&lt;-</span> <span class='fl'>50</span>; <span class='no'>p</span> <span class='kw'>&lt;-</span> <span class='fl'>100</span>; <span class='no'>q</span> <span class='kw'>&lt;-</span> <span class='fl'>3</span> <pre class="examples"><div class='input'><span class='kw'>if</span>(!<span class='fu'><a href='https://rdrr.io/r/base/grep.html'>grepl</a></span>(<span class='st'>'SunOS'</span>,<span class='fu'><a href='https://rdrr.io/r/base/Sys.info.html'>Sys.info</a></span>()[<span class='st'>'sysname'</span>])){
<span class='no'>n</span> <span class='kw'>&lt;-</span> <span class='fl'>50</span>; <span class='no'>p</span> <span class='kw'>&lt;-</span> <span class='fl'>100</span>; <span class='no'>q</span> <span class='kw'>&lt;-</span> <span class='fl'>3</span>
<span class='no'>X</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/matrix.html'>matrix</a></span>(<span class='fu'><a href='https://rdrr.io/r/stats/Normal.html'>rnorm</a></span>(<span class='no'>n</span>*<span class='no'>p</span>),<span class='kw'>nrow</span><span class='kw'>=</span><span class='no'>n</span>,<span class='kw'>ncol</span><span class='kw'>=</span><span class='no'>p</span>) <span class='no'>X</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/matrix.html'>matrix</a></span>(<span class='fu'><a href='https://rdrr.io/r/stats/Normal.html'>rnorm</a></span>(<span class='no'>n</span>*<span class='no'>p</span>),<span class='kw'>nrow</span><span class='kw'>=</span><span class='no'>n</span>,<span class='kw'>ncol</span><span class='kw'>=</span><span class='no'>p</span>)
<span class='no'>Y</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/lapply.html'>replicate</a></span>(<span class='kw'>n</span><span class='kw'>=</span><span class='no'>q</span>,<span class='kw'>expr</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/stats/Normal.html'>rnorm</a></span>(<span class='kw'>n</span><span class='kw'>=</span><span class='no'>n</span>,<span class='kw'>mean</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/base/colSums.html'>rowSums</a></span>(<span class='no'>X</span>[,<span class='fl'>1</span>:<span class='fl'>5</span>]))) <span class='no'>Y</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/lapply.html'>replicate</a></span>(<span class='kw'>n</span><span class='kw'>=</span><span class='no'>q</span>,<span class='kw'>expr</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/stats/Normal.html'>rnorm</a></span>(<span class='kw'>n</span><span class='kw'>=</span><span class='no'>n</span>,<span class='kw'>mean</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/base/colSums.html'>rowSums</a></span>(<span class='no'>X</span>[,<span class='fl'>1</span>:<span class='fl'>5</span>])))
<span class='no'>Y</span>[,<span class='fl'>1</span>] <span class='kw'>&lt;-</span> <span class='fl'>1</span>*(<span class='no'>Y</span>[,<span class='fl'>1</span>]<span class='kw'>&gt;</span><span class='fu'><a href='https://rdrr.io/r/stats/median.html'>median</a></span>(<span class='no'>Y</span>[,<span class='fl'>1</span>])) <span class='no'>Y</span>[,<span class='fl'>1</span>] <span class='kw'>&lt;-</span> <span class='fl'>1</span>*(<span class='no'>Y</span>[,<span class='fl'>1</span>]<span class='kw'>&gt;</span><span class='fu'><a href='https://rdrr.io/r/stats/median.html'>median</a></span>(<span class='no'>Y</span>[,<span class='fl'>1</span>]))
<span class='no'>object</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='joinet.html'>joinet</a></span>(<span class='kw'>Y</span><span class='kw'>=</span><span class='no'>Y</span>,<span class='kw'>X</span><span class='kw'>=</span><span class='no'>X</span>,<span class='kw'>family</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"binomial"</span>,<span class='st'>"gaussian"</span>,<span class='st'>"gaussian"</span>)) <span class='no'>object</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='joinet.html'>joinet</a></span>(<span class='kw'>Y</span><span class='kw'>=</span><span class='no'>Y</span>,<span class='kw'>X</span><span class='kw'>=</span><span class='no'>X</span>,<span class='kw'>family</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"binomial"</span>,<span class='st'>"gaussian"</span>,<span class='st'>"gaussian"</span>))
<span class='fu'><a href='https://rdrr.io/r/stats/predict.html'>predict</a></span>(<span class='no'>object</span>,<span class='kw'>newx</span><span class='kw'>=</span><span class='no'>X</span>)</div><div class='output co'>#&gt; $base <span class='fu'><a href='https://rdrr.io/r/stats/predict.html'>predict</a></span>(<span class='no'>object</span>,<span class='kw'>newx</span><span class='kw'>=</span><span class='no'>X</span>)
}</div><div class='output co'>#&gt; $base
#&gt; [,1] [,2] [,3] #&gt; [,1] [,2] [,3]
#&gt; [1,] 0.41837245 -1.928585385 -2.49734037 #&gt; [1,] 0.41837245 -1.928585385 -2.49734037
#&gt; [2,] 0.73430703 -1.232615541 -1.92258279 #&gt; [2,] 0.73430703 -1.232615541 -1.92258279
......
...@@ -154,11 +154,13 @@ which are the effects of the outcomes ...@@ -154,11 +154,13 @@ which are the effects of the outcomes
in the row on the outcomes in the column.</p> in the row on the outcomes in the column.</p>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='no'>n</span> <span class='kw'>&lt;-</span> <span class='fl'>50</span>; <span class='no'>p</span> <span class='kw'>&lt;-</span> <span class='fl'>100</span>; <span class='no'>q</span> <span class='kw'>&lt;-</span> <span class='fl'>3</span> <pre class="examples"><div class='input'><span class='kw'>if</span>(!<span class='fu'><a href='https://rdrr.io/r/base/grep.html'>grepl</a></span>(<span class='st'>'SunOS'</span>,<span class='fu'><a href='https://rdrr.io/r/base/Sys.info.html'>Sys.info</a></span>()[<span class='st'>'sysname'</span>])){
<span class='no'>n</span> <span class='kw'>&lt;-</span> <span class='fl'>50</span>; <span class='no'>p</span> <span class='kw'>&lt;-</span> <span class='fl'>100</span>; <span class='no'>q</span> <span class='kw'>&lt;-</span> <span class='fl'>3</span>
<span class='no'>X</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/matrix.html'>matrix</a></span>(<span class='fu'><a href='https://rdrr.io/r/stats/Normal.html'>rnorm</a></span>(<span class='no'>n</span>*<span class='no'>p</span>),<span class='kw'>nrow</span><span class='kw'>=</span><span class='no'>n</span>,<span class='kw'>ncol</span><span class='kw'>=</span><span class='no'>p</span>) <span class='no'>X</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/matrix.html'>matrix</a></span>(<span class='fu'><a href='https://rdrr.io/r/stats/Normal.html'>rnorm</a></span>(<span class='no'>n</span>*<span class='no'>p</span>),<span class='kw'>nrow</span><span class='kw'>=</span><span class='no'>n</span>,<span class='kw'>ncol</span><span class='kw'>=</span><span class='no'>p</span>)
<span class='no'>Y</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/lapply.html'>replicate</a></span>(<span class='kw'>n</span><span class='kw'>=</span><span class='no'>q</span>,<span class='kw'>expr</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/stats/Normal.html'>rnorm</a></span>(<span class='kw'>n</span><span class='kw'>=</span><span class='no'>n</span>,<span class='kw'>mean</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/base/colSums.html'>rowSums</a></span>(<span class='no'>X</span>[,<span class='fl'>1</span>:<span class='fl'>5</span>]))) <span class='no'>Y</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/lapply.html'>replicate</a></span>(<span class='kw'>n</span><span class='kw'>=</span><span class='no'>q</span>,<span class='kw'>expr</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/stats/Normal.html'>rnorm</a></span>(<span class='kw'>n</span><span class='kw'>=</span><span class='no'>n</span>,<span class='kw'>mean</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/base/colSums.html'>rowSums</a></span>(<span class='no'>X</span>[,<span class='fl'>1</span>:<span class='fl'>5</span>])))
<span class='no'>object</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='joinet.html'>joinet</a></span>(<span class='kw'>Y</span><span class='kw'>=</span><span class='no'>Y</span>,<span class='kw'>X</span><span class='kw'>=</span><span class='no'>X</span>) <span class='no'>object</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='joinet.html'>joinet</a></span>(<span class='kw'>Y</span><span class='kw'>=</span><span class='no'>Y</span>,<span class='kw'>X</span><span class='kw'>=</span><span class='no'>X</span>)
<span class='fu'><a href='https://rdrr.io/r/stats/weights.html'>weights</a></span>(<span class='no'>object</span>)</div><div class='output co'>#&gt; y1 y2 y3 <span class='fu'><a href='https://rdrr.io/r/stats/weights.html'>weights</a></span>(<span class='no'>object</span>)
}</div><div class='output co'>#&gt; y1 y2 y3
#&gt; (Intercept) -0.04720442 -0.15165929 0.26901703 #&gt; (Intercept) -0.04720442 -0.15165929 0.26901703
#&gt; V1 0.00000000 0.01158793 0.65726908 #&gt; V1 0.00000000 0.01158793 0.65726908
#&gt; V2 0.55230103 0.71134918 0.45932382 #&gt; V2 0.55230103 0.71134918 0.45932382
......
...@@ -25,7 +25,6 @@ the coefficients from the base learners.) ...@@ -25,7 +25,6 @@ the coefficients from the base learners.)
} }
\examples{ \examples{
if(!grepl('SunOS',Sys.info()['sysname'])){ if(!grepl('SunOS',Sys.info()['sysname'])){
1+1
n <- 50; p <- 100; q <- 3 n <- 50; p <- 100; q <- 3
X <- matrix(rnorm(n*p),nrow=n,ncol=p) X <- matrix(rnorm(n*p),nrow=n,ncol=p)
Y <- replicate(n=q,expr=rnorm(n=n,mean=rowSums(X[,1:5]))) Y <- replicate(n=q,expr=rnorm(n=n,mean=rowSums(X[,1:5])))
......
...@@ -28,6 +28,7 @@ X <- matrix(rnorm(n*p),nrow=n,ncol=p) ...@@ -28,6 +28,7 @@ X <- matrix(rnorm(n*p),nrow=n,ncol=p)
Y <- replicate(n=q,expr=rnorm(n=n,mean=rowSums(X[,1:5]))) Y <- replicate(n=q,expr=rnorm(n=n,mean=rowSums(X[,1:5])))
# n samples, p inputs, q outputs # n samples, p inputs, q outputs
if(!grepl('SunOS',Sys.info()['sysname'])){
#--- model fitting --- #--- model fitting ---
object <- joinet(Y=Y,X=X) object <- joinet(Y=Y,X=X)
# slot "base": univariate # slot "base": univariate
...@@ -49,6 +50,7 @@ loss <- cv.joinet(Y=Y,X=X) ...@@ -49,6 +50,7 @@ loss <- cv.joinet(Y=Y,X=X)
# cross-validated loss # cross-validated loss
# row "base": univariate # row "base": univariate
# row "meta": multivariate # row "meta": multivariate
}
} }
\references{ \references{
......
...@@ -26,11 +26,13 @@ with \eqn{n} rows (samples) and \eqn{q} columns (variables). ...@@ -26,11 +26,13 @@ with \eqn{n} rows (samples) and \eqn{q} columns (variables).
Predicts outcome from features with stacked model. Predicts outcome from features with stacked model.
} }
\examples{ \examples{
if(!grepl('SunOS',Sys.info()['sysname'])){
n <- 50; p <- 100; q <- 3 n <- 50; p <- 100; q <- 3
X <- matrix(rnorm(n*p),nrow=n,ncol=p) X <- matrix(rnorm(n*p),nrow=n,ncol=p)
Y <- replicate(n=q,expr=rnorm(n=n,mean=rowSums(X[,1:5]))) Y <- replicate(n=q,expr=rnorm(n=n,mean=rowSums(X[,1:5])))
Y[,1] <- 1*(Y[,1]>median(Y[,1])) Y[,1] <- 1*(Y[,1]>median(Y[,1]))
object <- joinet(Y=Y,X=X,family=c("binomial","gaussian","gaussian")) object <- joinet(Y=Y,X=X,family=c("binomial","gaussian","gaussian"))
predict(object,newx=X) predict(object,newx=X)
}
} }
...@@ -24,10 +24,12 @@ Extracts coefficients from the meta learner, ...@@ -24,10 +24,12 @@ Extracts coefficients from the meta learner,
i.e. the weights for the base learners. i.e. the weights for the base learners.
} }
\examples{ \examples{
if(!grepl('SunOS',Sys.info()['sysname'])){
n <- 50; p <- 100; q <- 3 n <- 50; p <- 100; q <- 3
X <- matrix(rnorm(n*p),nrow=n,ncol=p) X <- matrix(rnorm(n*p),nrow=n,ncol=p)
Y <- replicate(n=q,expr=rnorm(n=n,mean=rowSums(X[,1:5]))) Y <- replicate(n=q,expr=rnorm(n=n,mean=rowSums(X[,1:5])))
object <- joinet(Y=Y,X=X) object <- joinet(Y=Y,X=X)
weights(object) weights(object)
}
} }
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