predict.StaPLR {mvs}R Documentation

Make predictions from a "StaPLR" object.

Description

Make predictions from a "StaPLR" object.

Usage

## S3 method for class 'StaPLR'
predict(
  object,
  newx,
  newcf = NULL,
  predtype = "response",
  cvlambda = "lambda.min",
  ...
)

Arguments

object

Fitted "StaPLR" model object.

newx

Matrix of new values for x at which predictions are to be made. Must be a matrix.

newcf

Matrix of new values of correction features, if correct.for was specified during model fitting.

predtype

The type of prediction returned by the meta-learner.

cvlambda

Values of the penalty parameters at which predictions are to be made. Defaults to the values giving minimum cross-validation error.

...

Further arguments to be passed to predict.cv.glmnet.

Value

A matrix of predictions.

Author(s)

Wouter van Loon <w.s.van.loon@fsw.leidenuniv.nl>

Examples

 
set.seed(012)
n <- 1000
cors <- seq(0.1,0.7,0.1)
X <- matrix(NA, nrow=n, ncol=length(cors)+1)
X[,1] <- rnorm(n)

for(i in 1:length(cors)){
  X[,i+1] <- X[,1]*cors[i] + rnorm(n, 0, sqrt(1-cors[i]^2))
}

beta <- c(1,0,0,0,0,0,0,0)
eta <- X %*% beta
p <- exp(eta)/(1+exp(eta))
y <- rbinom(n, 1, p)
view_index <- rep(1:(ncol(X)/2), each=2)

fit <- StaPLR(X, y, view_index)
coef(fit)$meta

new_X <- matrix(rnorm(16), nrow=2)
predict(fit, new_X)

[Package mvs version 1.0.2 Index]