RAMP: Regularization Algorithm under Marginality Principle (RAMP)...

Description Usage Arguments Value See Also Examples

View source: R/RAMP.R

Description

Regularization Algorithm under Marginality Principle (RAMP) for high dimensional generalized quadratic regression.

Usage

1
2
3
4
5
RAMP(X, y, family = "gaussian", penalty = "LASSO", gamma = NULL,
  inter = TRUE, hier = "Strong", eps = 1e-15, tune = "EBIC",
  penalty.factor = rep(1, ncol(X)), inter.penalty.factor = 1, lam.list,
  lambda.min.ratio, max.iter = 100, max.num, n.lambda = 100,
  ebic.gamma = 1, refit = TRUE, trace = FALSE)

Arguments

X

input matrix, of dimension nobs x nvars; each row is an observation vector.

y

response variable, of dimension nobs x 1. continous for family='gaussian', binary for family='binomial'.

family

response type. Default is 'gaussian'. The other choice is 'binomial' for logistic regression.

penalty

Choose from LASSO, SCAD and MCP. Default is 'LASSO'.

gamma

concavity parameter. If NULL, the code will use 3.7 for 'SCAD' and 2.7 for 'MCP'.

inter

whether to select interaction effects. Default is TRUE.

hier

whether to enforce strong or weak heredity. Default is 'Strong'.

eps

the precision used to test the convergence. Default is 1e-15.

tune

tuning parameter selection method. 'AIC', 'BIC', 'EBIC' and 'GIC' are available options. Default is EBIC.

penalty.factor

A multiplicative factor for the penalty applied to each coefficient. If supplied, penalty.factor must be a numeric vector of length equal to the number of columns of X. The purpose of penalty.factor is to apply differential penalization if some coefficients are thought to be more likely than others to be in the model. In particular, penalty.factor can be 0, in which case the coefficient is always in the model without shrinkage.

inter.penalty.factor

the penalty factor for interactions effects. Default is 1. larger value discourage interaction effects.

lam.list

a user supplied λ sequence. typical usage is to have the program compute its own lambda sequence based on lambda.min.ratio and n.lambda. supplying a value of λ overrides this.

lambda.min.ratio

optional input. smallest value for lambda, as a fraction of max.lam, the (data derived) entry value. the default depends on the sample size n relative to the number of variables p. if n > p, the default is 0.0001. otherwise, the default is 0.01.

max.iter

maximum number of iteration in the computation. Default is 100.

max.num

optional input. maximum number of nonzero coefficients.

n.lambda

the number of lambda values. Default is 100.

ebic.gamma

the gamma parameter value in the EBIC criteria. Default is 1.

refit

whether to perform a MLE refit on the selected model. Default is TRUE.

trace

whether to trace the fitting process. Default is FALSE.

Value

An object with S3 class RAMP.

a0

intercept vector of length(lambda).

mainInd

index for the selected main effects.

interInd

index for the selected interaction effects

beta.m

coefficients for the selected main effects.

beta.i

coefficients for the selected interaction effects.

See Also

predict.RAMP,print.RAMP

Examples

 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
32
33
34
35
36
37
38
39
40
set.seed(0)
n = 500
p = 10 #Can be changed to a much larger number say 50000
x = matrix(rnorm(n*p),n,p)
eta = 1 * x[,1] + 2 * x[,3]  + 3*x[,6]  + 4*x[,1]*x[,3] + 5*x[,1]*x[,6]
y =  eta + rnorm(n)
xtest = matrix(rnorm(n*p),n,p)
eta.test = 1 * xtest[,1] + 2 * xtest[,3]  + 3*xtest[,6] +
4*xtest[,1]*xtest[,3] + 5*xtest[,1]*xtest[,6]
ytest =  eta.test + rnorm(n)
fit1 = RAMP(x, y)
fit1    ###examine the results
ypred = predict(fit1, xtest)
mean((ypred-ytest)^2)

#fit1.scad = RAMP(x, y, penalty = 'SCAD')
#fit1.scad    ###examine the results

#fit1.mcp = RAMP(x, y, penalty = 'MCP')
#fit1.mcp    ###examine the results

##Now, try a binary response
#y = rbinom(n, 1, 1/(1+exp(-eta)))
#fit2 = RAMP(x, y, family='binomial')  ###for binary response

## Weak heredity
eta = 1 * x[,1] + 3*x[,6]  + 4*x[,1]*x[,3] + 5*x[,1]*x[,6]
y =  eta + rnorm(n)
eta.test = 1 * xtest[,1] +  3*xtest[,6] + 4*xtest[,1]*xtest[,3] +
5*xtest[,1]*xtest[,6]
ytest =  eta.test + rnorm(n)

fit3 = RAMP(x, y, hier = 'Strong')
fit3    ###examine the results
ypred3 = predict(fit3, xtest)
mean((ypred3-ytest)^2)
fit4 = RAMP(x, y, hier = 'Weak')
fit4
ypred4 = predict(fit4, xtest)
mean((ypred4-ytest)^2)

Example output

Important main effects: 1 3 6 
Coefficient estimates for main effects: 0.8904 2.047 2.922 
Important interaction effects: X1X3 X1X6 
Coefficient estimates for interaction effects: 3.989 4.996 
Intercept estimate: 0.04464 
[1] 1.136251
Important main effects: 1 6 3 
Coefficient estimates for main effects: 1.037 3.023 -0.04196 
Important interaction effects: X1X6 X1X3 
Coefficient estimates for interaction effects: 4.969 4.13 
Intercept estimate: -0.04845 
[1] 1.138436
Important main effects: 1 6 
Coefficient estimates for main effects: 1.038 3.024 
Important interaction effects: X1X6 X1X3 
Coefficient estimates for interaction effects: 4.971 4.126 
Intercept estimate: -0.0466 
[1] 1.137835

RAMP documentation built on Jan. 16, 2020, 5:02 p.m.

Related to RAMP in RAMP...