# predict.SMMA: Make Prediction From a SMMA Object In SMMA: Soft Maximin Estimation for Large Scale Array-Tensor Models

## 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 two different formats: i) as a n' \times p matrix (p is the number of model coefficients and n' is the number of new data points) or ii) as a list of two or three 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).

## Usage

 1 2 ## S3 method for class 'SMMA' predict(object, x = NULL, X = NULL, ...) 

## Arguments

 object An object of class SMMA, produced with softmaximin x a matrix of size n' \times p with n' is the number of new data points. X a list containing the data matrices each of size n'_{i} \times p_i, where n'_{i} is the number of new data points in the ith dimension. ... ignored

## Value

A list of length nlambda containing the linear predictors for each model. If new covariate data is supplied in one n' \times p matrix x each item is a vector of length n'. If the data is supplied as a list of matrices each of size n'_{i} \times p_i, each item is an array of size n'_1 \times \cdots \times n'_d, with d\in \{1,2,3\}.

## Author(s)

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ##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, .1) + component, c(p1 , p2, p3)) Beta2 <- array(rnorm(p1 * p2 * p3, 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 = 10, penalty = "lasso", alg = "npg") ##new data in matrix form x <- matrix(rnorm(p1 * p2 * p3), nrow = 1) predict(fit, x = x)[] ##new data in tensor component form X1 <- matrix(rnorm(p1), nrow = 1) X2 <- matrix(rnorm(p2), nrow = 1) X3 <- matrix(rnorm(p3), nrow = 1) predict(fit, X = list(X1, X2, X3))[]