Commit f50d3a09 by Armin Rauschenberger

### 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 @@ to do — coef.cornet • cornet Extract estimated coefficients — coef.cornet • cornet ... ... @@ -30,9 +30,10 @@ ... ... @@ -100,14 +101,15 @@

to do

Extracts estimated coefficients from linear and logistic regression, under the penalty parameter that minimises the cross-validated loss.

... ... @@ -119,14 +121,21 @@
object

cornet object

cornet object

...

to do

further arguments (not applicable)

Value

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, "beta") and logistic (second column, "gamma") regression.

Examples

NA
#> [1] NA
... ... @@ -136,7 +145,9 @@

Contents

... ...
 ... ... @@ -120,7 +120,7 @@

coef(<cornet>)

to do

Extract estimated coefficients

... ... @@ -156,13 +156,13 @@

plot(<cornet>)

to do

Plot loss matrix

predict(<cornet>)

to do

Predict binary outcome

... ...
 ... ... @@ -6,7 +6,7 @@ to do — plot.cornet • cornet Plot loss matrix — plot.cornet • cornet ... ... @@ -30,9 +30,10 @@ ... ... @@ -100,14 +101,15 @@

to do

Plots the loss for difference combinations of the weight (pi) and scale (sigma) paramters.

... ... @@ -119,11 +121,11 @@
x

to do

cornet object

...

further arguments

further arguments (not applicable)

... ...
 ... ... @@ -6,7 +6,7 @@ to do — predict.cornet • cornet Predict binary outcome — predict.cornet • cornet ... ... @@ -30,9 +30,9 @@ ... ... @@ -100,14 +100,14 @@

to do

Predicts the binary outcome with linear, logistic, and combined regression.

... ... @@ -119,7 +119,7 @@
object

cornet object

cornet object

newx
...

to do

further arguments (not applicable)

... ... @@ -133,10 +133,17 @@ and $$p$$ columns (variables)

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
#> [1] NA
... ... @@ -146,7 +153,9 @@ and $$p$$ columns (variables)

Contents

... ...
 ... ... @@ -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!