predict.SMME {SMME}R Documentation

Make Prediction From a SMME Object

Description

Given new covariate data this function computes the linear predictors based on the estimated model coefficients in an object produced by the function softmaximin. Note that the data can be supplied in three different formats: i) for general models as a n' \times p matrix (p is the number of model coefficients and n' is the number of new data points), ii) for array models with custom design as a list of one, two or three Kronecker component matrices each of size n_i' \times p_i, i = 1, 2, 3 (n_i' is the number of new marginal data points in the ith dimension), iii) for wavelet based models a string indicating the wavelet used to produce the model object.

Usage

## S3 method for class 'SMME'
predict(object, x, ...)

Arguments

object

An object of class SMME, produced with softmaximin with m_\zeta fitted models for each value of zeta.

x

An object that should be like the input to the softmaximin call that produced object. For general models a matrix with column dimension equal to that of the original input.For array models with custom design a list like the one supplied to softmaximin to produce object and for a wavelet design the name of the wavelet used to produce object.

...

ignored.

Value

A list of length length(zeta). If x is a n' \times p matrix each list item is a n'\times m_\zeta matrix containing the linear predictors computed for each lambda. If x is a string or a list of tensor component matrices and fit$dim = d, each list item is a d + 1 array containing predictions computed for each lambda.

Author(s)

Adam Lund

Examples

##size of example
n1 <- 65; n2 <- 26; n3 <- 13; p1 <- 13; p2 <- 5; p3 <- 4

##marginal design matrices (Kronecker components)
X1 <- matrix(rnorm(n1 * p1, 0, 0.5), n1, p1)
X2 <- matrix(rnorm(n2 * p2, 0, 0.5), n2, p2)
X3 <- matrix(rnorm(n3 * p3, 0, 0.5), n3, p3)
X <- list(X1, X2, X3)

component <- rbinom(p1 * p2 * p3, 1, 0.1)
Beta1 <- array(rnorm(p1 * p2 * p3, 0, 0.1) + component, c(p1 , p2, p3))
Beta2 <- array(rnorm(p1 * p2 * p3, 0, 0.1) + component, c(p1 , p2, p3))
mu1 <- RH(X3, RH(X2, RH(X1, Beta1)))
mu2 <- RH(X3, RH(X2, RH(X1, Beta2)))
Y1 <- array(rnorm(n1 * n2 * n3, mu1), dim = c(n1, n2, n3))
Y2 <- array(rnorm(n1 * n2 * n3, mu2), dim = c(n1, n2, n3))

Y <- array(NA, c(dim(Y1), 2))
Y[,,, 1] <- Y1; Y[,,, 2] <- Y2;

fit <- softmaximin(X, Y, zeta = c(1, 10), penalty = "lasso", alg = "npg")

##new data in tensor component form
X1 <- matrix(rnorm(2 * p1), nrow = 2)
X2 <- matrix(rnorm(3 * p2), nrow = 3)
X3 <- matrix(rnorm(4 * p3), nrow = 4)
Yhat <- predict(fit, x = list(X1, X2, X3))


[Package SMME version 1.1.1 Index]