Learn R Programming

mimi (version 0.1.0)

mimi.cov: mimi.cov Compute solution of mimi with covariates effects along regularization path

Description

mimi.cov Compute solution of mimi with covariates effects along regularization path

Usage

mimi.cov(y, x, var.type = c("gaussian", "binary", "poisson"), lambda1,
  lambda2, maxit = 100, alpha0 = NULL, theta0 = NULL,
  thresh = 1e-05, trace.it = F, max.rank = NULL)

Arguments

y

nxp matrix of observations

x

(np)xN matrix of covariates

var.type

vector of length p indicating the data types of the columns of y (gaussian, binary or poisson)

lambda1

positive number regularization parameter for nuclear norm penalty

lambda2

positive number regularization parameter for l1 norm penalty

maxit

integer maximum number of iterations

alpha0

vector of length N: initial value of regression parameter (optional)

theta0

matrix of size nxp: initial value of interactions (optional)

thresh

positive number, convergence criterion

trace.it

boolean indicating whether convergence information should be printed

max.rank

integer, maximum rank of interaction matrix theta

Value

A list with the following elements

yimputed

imputed data set

param

estimated parameter matrix

alpha

estimated vector of main effects

theta

estimated interaction matrix

Examples

Run this code
# NOT RUN {
n = 6; p = 2
x <- matrix(rnorm(6*6*2), nrow = 6*6)
param <- matrix(x%*%c(2,0), nrow=6)+matrix(rnorm(6*6), nrow=6)
y1 <- matrix(rnorm(mean = c(param[, 1:2]), n * p), nrow = n)
y2 <- matrix(rbinom(n * p, prob = c(exp(param[,3:4])/(1+exp(param[,3:4]))), size = 1), nrow = n)
y3 <- matrix(rpois(n * p, lambda = c(exp(param[,5:6]))), nrow = n)
y <- cbind(y1, y2, y3)
var.type <- c(rep("gaussian", p), rep("binary", p), rep("poisson", p))
idx_NA <- sample(1:(3 * n * p), size = round(0.1 * 3 * n * p))
y[idx_NA] <- NA
res <- mimi.cov(y, x, var.type = var.type, lambda1 = 1, lambda2 = 2, thresh=0.1)
# }

Run the code above in your browser using DataLab