joinet.html 19.3 KB
Newer Older
Armin Rauschenberger's avatar
Armin Rauschenberger committed
1
<!DOCTYPE html>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
2
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
Armin Rauschenberger's avatar
Armin Rauschenberger committed
3
4
5
6
7
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Armin Rauschenberger's avatar
Armin Rauschenberger committed
8
<title>Multivariate Elastic Net Regression • joinet</title>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
9
10
11
12
13
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.4.0/spacelab/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css">
<script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
Armin Rauschenberger's avatar
Armin Rauschenberger committed
14
<script src="../pkgdown.js"></script><meta property="og:title" content="Multivariate Elastic Net Regression">
Armin Rauschenberger's avatar
Armin Rauschenberger committed
15
<meta property="og:description" content="joinet">
Armin Rauschenberger's avatar
Armin Rauschenberger committed
16
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
17
18
19
20
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
21
<body data-spy="scroll" data-target="#toc">
Armin Rauschenberger's avatar
Armin Rauschenberger committed
22
23
24
25
    <div class="container template-article">
      <header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="container">
    <div class="navbar-header">
Armin Rauschenberger's avatar
Armin Rauschenberger committed
26
27
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
28
29
30
31
32
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <span class="navbar-brand">
Armin Rauschenberger's avatar
Armin Rauschenberger committed
33
        <a class="navbar-link" href="../index.html">joinet</a>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
34
        <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.0.4</span>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
35
36
37
38
39
40
      </span>
    </div>

    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
<li>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
41
  <a href="../reference/index.html">functions</a>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
42
43
</li>
<li>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
44
  <a href="../articles/joinet.html">vignette</a>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
45
46
</li>
<li>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
47
  <a href="../articles/article.html">article</a>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
48
49
</li>
<li>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
50
  <a href="../news/index.html">news</a>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
51
52
53
54
</li>
      </ul>
<ul class="nav navbar-nav navbar-right">
<li>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
55
  <a href="https://github.com/rauschenberger/joinet">
Armin Rauschenberger's avatar
Armin Rauschenberger committed
56
57
58
59
60
    <span class="fa fa-github"></span>
     
  </a>
</li>
<li>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
61
  <a href="https://cran.r-project.org/package=joinet">
Armin Rauschenberger's avatar
Armin Rauschenberger committed
62
    <span class="fa fa-download"></span>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
63
64
65
66
67
68
69
70
71
72
73
74
     
  </a>
</li>
      </ul>
</div>
<!--/.nav-collapse -->
  </div>
<!--/.container -->
</div>
<!--/.navbar -->

      
Armin Rauschenberger's avatar
Armin Rauschenberger committed
75

Armin Rauschenberger's avatar
Armin Rauschenberger committed
76
77
78
      </header><div class="row">
  <div class="col-md-9 contents">
    <div class="page-header toc-ignore">
Armin Rauschenberger's avatar
Armin Rauschenberger committed
79
      <h1 data-toc-skip>Multivariate Elastic Net Regression</h1>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
80
81
            
      
Armin Rauschenberger's avatar
Armin Rauschenberger committed
82
83
      <small class="dont-index">Source: <a href="https://github.com/rauschenberger/joinet/blob/master/vignettes/joinet.Rmd"><code>vignettes/joinet.Rmd</code></a></small>
      <div class="hidden name"><code>joinet.Rmd</code></div>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
84
85
86
87
88
89
90
91

    </div>

    
    
<div id="installation" class="section level2">
<h2 class="hasAnchor">
<a href="#installation" class="anchor"></a>Installation</h2>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
92
<p>Install the current release from <a href="https://CRAN.R-project.org/package=joinet">CRAN</a>:</p>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
93
<div class="sourceCode" id="cb1"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/utils/install.packages.html">install.packages</a></span>(<span class="st">"joinet"</span>)</pre></body></html></div>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
94
<p>Or install the latest development version from <a href="https://github.com/rauschenberger/joinet">GitHub</a>:</p>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
95
96
<div class="sourceCode" id="cb2"><html><body><pre class="r"><span class="co">#install.packages("devtools")</span>
<span class="kw pkg">devtools</span><span class="kw ns">::</span><span class="fu"><a href="https://devtools.r-lib.org//reference/remote-reexports.html">install_github</a></span>(<span class="st">"rauschenberger/joinet"</span>)</pre></body></html></div>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
97
98
99
100
101
</div>
<div id="initialisation" class="section level2">
<h2 class="hasAnchor">
<a href="#initialisation" class="anchor"></a>Initialisation</h2>
<p>Load and attach the package:</p>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
102
<div class="sourceCode" id="cb3"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">joinet</span>)</pre></body></html></div>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
103
<p>And access the <a href="https://rauschenberger.github.io/joinet/">documentation</a>:</p>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
104
105
106
<div class="sourceCode" id="cb4"><html><body><pre class="r">?<span class="no">joinet</span>
<span class="fu"><a href="https://rdrr.io/r/utils/help.html">help</a></span>(<span class="no">joinet</span>)
<span class="fu"><a href="https://rdrr.io/r/utils/browseVignettes.html">browseVignettes</a></span>(<span class="st">"joinet"</span>)</pre></body></html></div>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
107
108
109
110
111
</div>
<div id="simulation" class="section level2">
<h2 class="hasAnchor">
<a href="#simulation" class="anchor"></a>Simulation</h2>
<p>For <code>n</code> samples, we simulate <code>p</code> inputs (features, covariates) and <code>q</code> outputs (outcomes, responses). We assume high-dimensional inputs (<code>p</code> <span class="math inline">\(\gg\)</span> <code>n</code>) and low-dimensional outputs (<code>q</code> <span class="math inline">\(\ll\)</span> <code>n</code>).</p>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
112
113
114
<div class="sourceCode" id="cb5"><html><body><pre class="r"><span class="no">n</span> <span class="kw">&lt;-</span> <span class="fl">100</span>
<span class="no">q</span> <span class="kw">&lt;-</span> <span class="fl">2</span>
<span class="no">p</span> <span class="kw">&lt;-</span> <span class="fl">500</span></pre></body></html></div>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
115
<p>We simulate the <code>p</code> inputs from a multivariate normal distribution. For the mean, we use the <code>p</code>-dimensional vector <code>mu</code>, where all elements equal zero. For the covariance, we use the <code>p</code> <span class="math inline">\(\times\)</span> <code>p</code> matrix <code>Sigma</code>, where the entry in row <span class="math inline">\(i\)</span> and column <span class="math inline">\(j\)</span> equals <code>rho</code><span class="math inline">\(^{|i-j|}\)</span>. The parameter <code>rho</code> determines the strength of the correlation among the inputs, with small <code>rho</code> leading weak correlations, and large <code>rho</code> leading to strong correlations (0 &lt; <code>rho</code> &lt; 1). The input matrix <code>X</code> has <code>n</code> rows and <code>p</code> columns.</p>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
116
117
118
119
<div class="sourceCode" id="cb6"><html><body><pre class="r"><span class="no">mu</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/rep.html">rep</a></span>(<span class="fl">0</span>,<span class="kw">times</span><span class="kw">=</span><span class="no">p</span>)
<span class="no">rho</span> <span class="kw">&lt;-</span> <span class="fl">0.90</span>
<span class="no">Sigma</span> <span class="kw">&lt;-</span> <span class="no">rho</span>^<span class="fu"><a href="https://rdrr.io/r/base/MathFun.html">abs</a></span>(<span class="fu"><a href="https://rdrr.io/r/base/col.html">col</a></span>(<span class="fu"><a href="https://rdrr.io/r/base/diag.html">diag</a></span>(<span class="no">p</span>))-<span class="fu"><a href="https://rdrr.io/r/base/row.html">row</a></span>(<span class="fu"><a href="https://rdrr.io/r/base/diag.html">diag</a></span>(<span class="no">p</span>)))
<span class="no">X</span> <span class="kw">&lt;-</span> <span class="kw pkg">MASS</span><span class="kw ns">::</span><span class="fu"><a href="https://rdrr.io/pkg/MASS/man/mvrnorm.html">mvrnorm</a></span>(<span class="kw">n</span><span class="kw">=</span><span class="no">n</span>,<span class="kw">mu</span><span class="kw">=</span><span class="no">mu</span>,<span class="kw">Sigma</span><span class="kw">=</span><span class="no">Sigma</span>)</pre></body></html></div>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
120
<p>We simulate the input-output effects from independent Bernoulli distributions. The parameter <code>pi</code> determines the number of effects, with small <code>pi</code> leading to few effects, and large <code>pi</code> leading to many effects (0 &lt; <code>pi</code> &lt; 1). The scalar <code>alpha</code> represents the intercept, and the <code>p</code>-dimensional vector <code>beta</code> represents the slopes.</p>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
121
122
123
<div class="sourceCode" id="cb7"><html><body><pre class="r"><span class="no">pi</span> <span class="kw">&lt;-</span> <span class="fl">0.01</span>
<span class="no">alpha</span> <span class="kw">&lt;-</span> <span class="fl">0</span>
<span class="no">beta</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/Binomial.html">rbinom</a></span>(<span class="kw">n</span><span class="kw">=</span><span class="no">p</span>,<span class="kw">size</span><span class="kw">=</span><span class="fl">1</span>,<span class="kw">prob</span><span class="kw">=</span><span class="no">pi</span>)</pre></body></html></div>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
124
<p>From the intercept <code>alpha</code>, the slopes <code>beta</code> and the inputs <code>X</code>, we calculate the linear predictor, the <code>n</code>-dimensional vector <code>eta</code>. Rescale the linear predictor to make the effects weaker or stronger. Set the argument <code>family</code> to <code>"gaussian"</code>, <code>"binomial"</code>, or <code>"poisson"</code> to define the distribution. The <code>n</code> times <code>p</code> matrix <code>Y</code> represents the outputs. We assume the outcomes are <em>positively</em> correlated.</p>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<div class="sourceCode" id="cb8"><html><body><pre class="r"><span class="no">eta</span> <span class="kw">&lt;-</span> <span class="no">alpha</span> + <span class="no">X</span> <span class="kw">%*%</span> <span class="no">beta</span>
<span class="no">eta</span> <span class="kw">&lt;-</span> <span class="fl">1.5</span>*<span class="fu"><a href="https://rdrr.io/r/base/scale.html">scale</a></span>(<span class="no">eta</span>)
<span class="no">family</span> <span class="kw">&lt;-</span> <span class="st">"gaussian"</span>

<span class="kw">if</span>(<span class="no">family</span><span class="kw">==</span><span class="st">"gaussian"</span>){
  <span class="no">mean</span> <span class="kw">&lt;-</span> <span class="no">eta</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="no">mean</span>))
}

<span class="kw">if</span>(<span class="no">family</span><span class="kw">==</span><span class="st">"binomial"</span>){
  <span class="no">prob</span> <span class="kw">&lt;-</span> <span class="fl">1</span>/(<span class="fl">1</span>+<span class="fu"><a href="https://rdrr.io/r/base/Log.html">exp</a></span>(-<span class="no">eta</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/Binomial.html">rbinom</a></span>(<span class="kw">n</span><span class="kw">=</span><span class="no">n</span>,<span class="kw">size</span><span class="kw">=</span><span class="fl">1</span>,<span class="kw">prob</span><span class="kw">=</span><span class="no">prob</span>))
}

<span class="kw">if</span>(<span class="no">family</span><span class="kw">==</span><span class="st">"poisson"</span>){
  <span class="no">lambda</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/Log.html">exp</a></span>(<span class="no">eta</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/Poisson.html">rpois</a></span>(<span class="kw">n</span><span class="kw">=</span><span class="no">n</span>,<span class="kw">lambda</span><span class="kw">=</span><span class="no">lambda</span>))
}

<span class="fu"><a href="https://rdrr.io/r/stats/cor.html">cor</a></span>(<span class="no">Y</span>)</pre></body></html></div>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
145
146
147
148
149
</div>
<div id="application" class="section level2">
<h2 class="hasAnchor">
<a href="#application" class="anchor"></a>Application</h2>
<p>The function <code>joinet</code> fits univariate and multivariate regression. Set the argument <code>alpha.base</code> to 0 (ridge) or 1 (lasso).</p>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
150
<div class="sourceCode" id="cb9"><html><body><pre class="r"><span class="no">object</span> <span class="kw">&lt;-</span> <span class="fu"><a href="../reference/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="no">family</span>)</pre></body></html></div>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
151
<p>Standard methods are available. The function <code>predict</code> returns the predicted values from the univariate (<code>base</code>) and multivariate (<code>meta</code>) models. The function <code>coef</code> returns the estimated intercepts (<code>alpha</code>) and slopes (<code>beta</code>) from the multivariate model (input-output effects). And the function <code>weights</code> returns the weights from stacking (output-output effects).</p>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
152
153
154
155
156
<div class="sourceCode" id="cb10"><html><body><pre class="r"><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>)

<span class="fu"><a href="https://rdrr.io/r/stats/coef.html">coef</a></span>(<span class="no">object</span>)

<span class="fu"><a href="https://rdrr.io/r/stats/weights.html">weights</a></span>(<span class="no">object</span>)</pre></body></html></div>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
157
<p>The function <code>cv.joinet</code> compares the predictive performance of univariate (<code>base</code>) and multivariate (<code>meta</code>) regression by nested cross-validation. The argument <code>type.measure</code> determines the loss function.</p>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
158
<div class="sourceCode" id="cb11"><html><body><pre class="r"><span class="fu"><a href="../reference/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="kw">family</span><span class="kw">=</span><span class="no">family</span>)</pre></body></html></div>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
159
160
161
162
163
164
165
166
<pre><code>##          [,1]     [,2]
## base 1.204741 1.523550
## meta 1.161487 1.283678
## none 3.206394 3.495571</code></pre>
</div>
<div id="reference" class="section level2">
<h2 class="hasAnchor">
<a href="#reference" class="anchor"></a>Reference</h2>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
167
168
<p>Armin Rauschenberger and Enrico Glaab (2020). “joinet: predicting correlated outcomes jointly to improve clinical prognosis”. <em>Manuscript in preparation.</em></p>
<!--
Armin Rauschenberger's avatar
Armin Rauschenberger committed
169
170

```r
Armin Rauschenberger's avatar
Armin Rauschenberger committed
171
#install.packages("MTPS")
Armin Rauschenberger's avatar
Armin Rauschenberger committed
172
173
data("HIV",package="MTPS")
loss1 <- cv.joinet(Y=YY,X=XX,mnorm=TRUE,spls=TRUE,mtps=TRUE)
Armin Rauschenberger's avatar
Armin Rauschenberger committed
174

Armin Rauschenberger's avatar
Armin Rauschenberger committed
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
#install.packages("spls")
data(yeast,package="spls")
loss2 <- cv.joinet(Y=yeast$y,X=yeast$x,mnorm=TRUE,spls=TRUE,mtps=TRUE)

data(mice,package="spls")
loss3 <- cv.joinet(Y=mice$y,X=mice$x,mnorm=TRUE,spls=TRUE,mtps=TRUE)

# install.packages("MRCE")
data(stock04,package="MRCE",verbose=TRUE)
# otherwise simulated

#install.packages("SiER")
# simulated!
library(MASS)
total.noise <- 0.1
rho <- 0.3
rho.e <- 0.2
nvar=500
nvarq <- 3
sigma2 <- total.noise/nvarq
sigmaX=0.1
nvar.eff=150
Sigma=matrix(0,nvar.eff,nvar.eff)
for(i in 1:nvar.eff){
    for(j in 1:nvar.eff){
        Sigma[i,j]=rho^(abs(i-j))
    }
}
Sigma2.y <- matrix(sigma2*rho.e,nvarq, nvarq)
diag(Sigma2.y) <- sigma2
betas.true <- matrix(0, nvar, 3)
betas.true[1:15,1]=rep(1,15)/sqrt(15)
betas.true[16:45,2]=rep(0.5,30)/sqrt(30)
betas.true[46:105,3]=rep(0.25,60)/sqrt(60)
ntest <- 500
ntrain <- 90
ntot <- ntest+ntrain
X <- matrix(0,ntot,nvar)
X[,1:nvar.eff] <- mvrnorm(n=ntot, rep(0, nvar.eff), Sigma)
X[,-(1:nvar.eff)] <- matrix(sigmaX*rnorm((nvar-nvar.eff)*dim(X)[1]),
                           dim(X)[1],(nvar-nvar.eff))
Y <- X%*%betas.true
Y <- Y+mvrnorm(n=ntot, rep(0,nvarq), Sigma2.y)
fold <- rep(c(0,1),times=c(ntrain,ntest))
loss4 <- cv.joinet(Y=Y,X=X,foldid.ext=fold,mnorm=TRUE,spls=TRUE,mtps=TRUE)

#install.pacakges("GPM")
# simulated!

#install.packages("RMTL")
# simulated!
data <- RMTL::Create_simulated_data(Regularization="L21", #type="Regression")
#Y <- (do.call(what="cbind",args=data$Y)+1)/2
#X <- data$X[[1]] # example
#loss2 <- cv.joinet(Y=Y,X=X,mnorm=TRUE,spls=TRUE,mtps=TRUE)
```
-->
<!--

```r
Armin Rauschenberger's avatar
Armin Rauschenberger committed
235
236
237
238
#install.packages("plsgenomics")
data(Ecoli,package="plsgenomics")
X <- Ecoli$CONNECdata
Y <- Ecoli$GEdata
Armin Rauschenberger's avatar
Armin Rauschenberger committed
239
loss2 <- cv.joinet(Y=Y,X=X,mnorm=TRUE,mtps=TRUE)
Armin Rauschenberger's avatar
Armin Rauschenberger committed
240
241
242
243

#install.packages("BiocManager")
#BiocManager::install("mixOmics")
data(liver.toxicity,package="mixOmics")
Armin Rauschenberger's avatar
Armin Rauschenberger committed
244
245
246
247
X <- as.matrix(liver.toxicity$gene)
Y <- as.matrix(liver.toxicity$clinic)
Y[,"Cholesterol.mg.dL."] <- -Y[,"Cholesterol.mg.dL."]
loss3 <- cv.joinet(Y=Y,X=X,mnorm=TRUE,mtps=TRUE)
Armin Rauschenberger's avatar
Armin Rauschenberger committed
248
```
Armin Rauschenberger's avatar
Armin Rauschenberger committed
249
-->
Armin Rauschenberger's avatar
Armin Rauschenberger committed
250
251
252
</div>
  </div>

Armin Rauschenberger's avatar
Armin Rauschenberger committed
253
254
255
256
  <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">

        <nav id="toc" data-toggle="toc"><h2 data-toc-skip>Contents</h2>
    </nav>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
257
258
259
260
261
</div>

</div>


Armin Rauschenberger's avatar
Armin Rauschenberger committed
262

Armin Rauschenberger's avatar
Armin Rauschenberger committed
263
      <footer><div class="copyright">
Armin Rauschenberger's avatar
Armin Rauschenberger committed
264
  <p>Developed by <a href="https://rauschenberger.github.io">Armin Rauschenberger</a>.</p>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
265
266
267
</div>

<div class="pkgdown">
Armin Rauschenberger's avatar
Armin Rauschenberger committed
268
  <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
269
</div>
Armin Rauschenberger's avatar
Armin Rauschenberger committed
270

Armin Rauschenberger's avatar
Armin Rauschenberger committed
271
272
273
274
275
      </footer>
</div>

  

Armin Rauschenberger's avatar
Armin Rauschenberger committed
276

Armin Rauschenberger's avatar
Armin Rauschenberger committed
277
278
  </body>
</html>