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

automation

parent 88dd8b18
......@@ -243,16 +243,23 @@ cornet <- function(y,cutoff,X,alpha=1,npi=101,pi=NULL,nsigma=99,sigma=NULL,nfold
#' @export
#' @title
#' to do
#' Extract estimated coefficients
#'
#' @description
#' to do
#' Extracts estimated coefficients from linear and logistic regression,
#' under the penalty parameter that minimises the cross-validated loss.
#'
#' @param object
#' cornet object
#' \link[cornet]{cornet} object
#'
#' @param ...
#' to do
#' further arguments (not applicable)
#'
#' @return
#' This function returns a matrix with \eqn{n} rows and two columns,
#' where \eqn{n} is the sample size. It includes the estimated coefficients
#' from linear (first column, \code{"beta"})
#' and logistic (second column, \code{"gamma"}) regression.
#'
#' @examples
#' NA
......@@ -275,16 +282,17 @@ coef.cornet <- function(object,...){
#' @export
#' @title
#' to do
#' Plot loss matrix
#'
#' @description
#' to do
#' Plots the loss for difference combinations of
#' the weight (pi) and scale (sigma) paramters.
#'
#' @param x
#' to do
#' \link[cornet]{cornet} object
#'
#' @param ...
#' further arguments
#' further arguments (not applicable)
#'
#' @examples
#' NA
......@@ -303,43 +311,49 @@ plot.cornet <- function(x,...){
graphics::par(xaxs="i",yaxs="i")
graphics::plot.window(xlim=c(1-0.5,nsigma+0.5),ylim=c(1-0.5,npi+0.5))
graphics::title(xlab=expression(sigma),ylab=expression(pi),cex.lab=2)
graphics::title(xlab=expression(sigma),ylab=expression(pi),cex.lab=1)
#graphics::.filled.contour(x=seq_along(x$sigma),y=seq_along(x$pi),z=x$cvm,levels=levels,col=col)
graphics::image(x=seq_along(x$sigma),y=seq_along(x$pi),z=x$cvm,breaks=levels,col=col,add=TRUE)
graphics::box()
#graphics::abline(v=ssigma,lty=2,col="grey")
#graphics::abline(h=spi,lty=2,col="grey")
ssigma <- which(x$sigma %in% x$sigma.min)
spi <- which(x$pi %in% x$pi.min)
if(length(ssigma)==1 & length(spi)==1){
# axes with labels for tuned parameters
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))
# point for tuned parameters
graphics::points(x=ssigma,y=spi,pch=4,col="black",cex=1)
} else {
# axes with standard labels
at <- seq(from=1,to=nsigma,length.out=5)
graphics::axis(side=1,at=at,labels=signif(x$sigma,digits=2)[at])
at <- seq(from=1,to=nsigma,length.out=5)
graphics::axis(side=2,at=at,labels=signif(x$pi,digits=2)[at])
# points for selected parameters
isigma <- sapply(x$sigma.min,function(y) which(x$sigma==y))
ipi <- sapply(x$pi.min,function(y) which(x$pi==y))
graphics::points(x=isigma,y=ipi,pch=4,col="black",cex=1)
}
#a <- sapply(x$sigma.min,function(y) which(x$sigma==y))
#b <- sapply(x$pi.min,function(y) which(x$pi==y))
#graphics::points(x=a,y=b,pch=4,col="black",cex=1)
}
#' @export
#' @title
#' to do
#' Predict binary outcome
#'
#' @description
#' to do
#'
#' Predicts the binary outcome with linear, logistic, and combined regression.
#'
#' @details
#' For linear regression, this function tentatively transforms
#' the predicted values to predicted probabilities,
#' using a Gaussian distribution with a fixed mean (threshold)
#' and a fixed variance (estimated variance of the numeric outcome).
#'
#' @param object
#' cornet object
#' \link[cornet]{cornet} object
#'
#' @param newx
#' covariates\strong{:}
......@@ -350,7 +364,7 @@ plot.cornet <- function(x,...){
#' \code{"probability"}, \code{"odds"}, \code{"log-odds"}
#'
#' @param ...
#' to do
#' further arguments (not applicable)
#'
#' @examples
#' NA
......
......@@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>to do — coef.cornet • cornet</title>
<title>Extract estimated coefficients — coef.cornet • cornet</title>
<!-- jquery -->
<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script>
......@@ -30,9 +30,10 @@
<meta property="og:title" content="to do — coef.cornet" />
<meta property="og:title" content="Extract estimated coefficients — coef.cornet" />
<meta property="og:description" content="to do" />
<meta property="og:description" content="Extracts estimated coefficients from linear and logistic regression,
under the penalty parameter that minimises the cross-validated loss." />
<meta name="twitter:card" content="summary" />
......@@ -100,14 +101,15 @@
<div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1>to do</h1>
<h1>Extract estimated coefficients</h1>
<small class="dont-index">Source: <a href='https://github.com/rauschenberger/colasso/blob/master/R/functions.R'><code>R/functions.R</code></a></small>
<div class="hidden name"><code>coef.cornet.Rd</code></div>
</div>
<div class="ref-description">
<p>to do</p>
<p>Extracts estimated coefficients from linear and logistic regression,
under the penalty parameter that minimises the cross-validated loss.</p>
</div>
......@@ -119,14 +121,21 @@
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>object</th>
<td><p>cornet object</p></td>
<td><p><a href='cornet.html'>cornet</a> object</p></td>
</tr>
<tr>
<th>...</th>
<td><p>to do</p></td>
<td><p>further arguments (not applicable)</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>This function returns a matrix with \(n\) rows and two columns,
where \(n\) is the sample size. It includes the estimated coefficients
from linear (first column, <code>"beta"</code>)
and logistic (second column, <code>"gamma"</code>) regression.</p>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='fl'>NA</span></div><div class='output co'>#&gt; [1] NA</div><div class='input'>
......@@ -136,7 +145,9 @@
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#examples">Examples</a></li>
</ul>
......
......@@ -120,7 +120,7 @@
<td>
<p><code><a href="coef.cornet.html">coef(<i>&lt;cornet&gt;</i>)</a></code> </p>
</td>
<td><p>to do</p></td>
<td><p>Extract estimated coefficients</p></td>
</tr><tr>
<td>
......@@ -156,13 +156,13 @@
<td>
<p><code><a href="plot.cornet.html">plot(<i>&lt;cornet&gt;</i>)</a></code> </p>
</td>
<td><p>to do</p></td>
<td><p>Plot loss matrix</p></td>
</tr><tr>
<td>
<p><code><a href="predict.cornet.html">predict(<i>&lt;cornet&gt;</i>)</a></code> </p>
</td>
<td><p>to do</p></td>
<td><p>Predict binary outcome</p></td>
</tr>
</tbody>
</table>
......
......@@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>to do — plot.cornet • cornet</title>
<title>Plot loss matrix — plot.cornet • cornet</title>
<!-- jquery -->
<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script>
......@@ -30,9 +30,10 @@
<meta property="og:title" content="to do — plot.cornet" />
<meta property="og:title" content="Plot loss matrix — plot.cornet" />
<meta property="og:description" content="to do" />
<meta property="og:description" content="Plots the loss for difference combinations of
the weight (pi) and scale (sigma) paramters." />
<meta name="twitter:card" content="summary" />
......@@ -100,14 +101,15 @@
<div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1>to do</h1>
<h1>Plot loss matrix</h1>
<small class="dont-index">Source: <a href='https://github.com/rauschenberger/colasso/blob/master/R/functions.R'><code>R/functions.R</code></a></small>
<div class="hidden name"><code>plot.cornet.Rd</code></div>
</div>
<div class="ref-description">
<p>to do</p>
<p>Plots the loss for difference combinations of
the weight (pi) and scale (sigma) paramters.</p>
</div>
......@@ -119,11 +121,11 @@
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>x</th>
<td><p>to do</p></td>
<td><p><a href='cornet.html'>cornet</a> object</p></td>
</tr>
<tr>
<th>...</th>
<td><p>further arguments</p></td>
<td><p>further arguments (not applicable)</p></td>
</tr>
</table>
......
......@@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>to do — predict.cornet • cornet</title>
<title>Predict binary outcome — predict.cornet • cornet</title>
<!-- jquery -->
<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script>
......@@ -30,9 +30,9 @@
<meta property="og:title" content="to do — predict.cornet" />
<meta property="og:title" content="Predict binary outcome — predict.cornet" />
<meta property="og:description" content="to do" />
<meta property="og:description" content="Predicts the binary outcome with linear, logistic, and combined regression." />
<meta name="twitter:card" content="summary" />
......@@ -100,14 +100,14 @@
<div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1>to do</h1>
<h1>Predict binary outcome</h1>
<small class="dont-index">Source: <a href='https://github.com/rauschenberger/colasso/blob/master/R/functions.R'><code>R/functions.R</code></a></small>
<div class="hidden name"><code>predict.cornet.Rd</code></div>
</div>
<div class="ref-description">
<p>to do</p>
<p>Predicts the binary outcome with linear, logistic, and combined regression.</p>
</div>
......@@ -119,7 +119,7 @@
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>object</th>
<td><p>cornet object</p></td>
<td><p><a href='cornet.html'>cornet</a> object</p></td>
</tr>
<tr>
<th>newx</th>
......@@ -133,10 +133,17 @@ and \(p\) columns (variables)</p></td>
</tr>
<tr>
<th>...</th>
<td><p>to do</p></td>
<td><p>further arguments (not applicable)</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p>For linear regression, this function tentatively transforms
the predicted values to predicted probabilities,
using a Gaussian distribution with a fixed mean (threshold)
and a fixed variance (estimated variance of the numeric outcome).</p>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='fl'>NA</span></div><div class='output co'>#&gt; [1] NA</div><div class='input'>
......@@ -146,7 +153,9 @@ and \(p\) columns (variables)</p></td>
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#details">Details</a></li>
<li><a href="#examples">Examples</a></li>
</ul>
......
......@@ -2,17 +2,24 @@
% Please edit documentation in R/functions.R
\name{coef.cornet}
\alias{coef.cornet}
\title{to do}
\title{Extract estimated coefficients}
\usage{
\method{coef}{cornet}(object, ...)
}
\arguments{
\item{object}{cornet object}
\item{object}{\link[cornet]{cornet} object}
\item{...}{to do}
\item{...}{further arguments (not applicable)}
}
\value{
This function returns a matrix with \eqn{n} rows and two columns,
where \eqn{n} is the sample size. It includes the estimated coefficients
from linear (first column, \code{"beta"})
and logistic (second column, \code{"gamma"}) regression.
}
\description{
to do
Extracts estimated coefficients from linear and logistic regression,
under the penalty parameter that minimises the cross-validated loss.
}
\examples{
NA
......
......@@ -2,17 +2,18 @@
% Please edit documentation in R/functions.R
\name{plot.cornet}
\alias{plot.cornet}
\title{to do}
\title{Plot loss matrix}
\usage{
\method{plot}{cornet}(x, ...)
}
\arguments{
\item{x}{to do}
\item{x}{\link[cornet]{cornet} object}
\item{...}{further arguments}
\item{...}{further arguments (not applicable)}
}
\description{
to do
Plots the loss for difference combinations of
the weight (pi) and scale (sigma) paramters.
}
\examples{
NA
......
......@@ -2,12 +2,12 @@
% Please edit documentation in R/functions.R
\name{predict.cornet}
\alias{predict.cornet}
\title{to do}
\title{Predict binary outcome}
\usage{
\method{predict}{cornet}(object, newx, type = "probability", ...)
}
\arguments{
\item{object}{cornet object}
\item{object}{\link[cornet]{cornet} object}
\item{newx}{covariates\strong{:}
numeric matrix with \eqn{n} rows (samples)
......@@ -15,10 +15,16 @@ and \eqn{p} columns (variables)}
\item{type}{\code{"probability"}, \code{"odds"}, \code{"log-odds"}}
\item{...}{to do}
\item{...}{further arguments (not applicable)}
}
\description{
to do
Predicts the binary outcome with linear, logistic, and combined regression.
}
\details{
For linear regression, this function tentatively transforms
the predicted values to predicted probabilities,
using a Gaussian distribution with a fixed mean (threshold)
and a fixed variance (estimated variance of the numeric outcome).
}
\examples{
NA
......
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