Learn R Programming

liso (version 0.2)

liso.covweights: Covariate Weights for Adaptive Liso

Description

Calculates covariate weights for the Adaptive Liso

Usage

liso.covweights(obj, signfind = FALSE)

Arguments

obj
Initial fit to use, a multistep object.
signfind
If TRUE, conduct monotonicity detection procedure.

Value

  • Produces a vector of covariate weights to be supplied as the covweight argument in liso.backfit.

Details

This function calculates automatically weights for a second run of the Liso algorithm, in an adaptive liso scheme. See example for practical usage.

References

Zhou Fang and Nicolai Meinshausen (2009), Liso for High Dimensional Additive Isotonic Regression, available at http://blah.com

Examples

Run this code
## Use the method on a simulated data set

set.seed(79)
n <- 100; p <- 50

## Simulate design matrix and response
x <- matrix(runif(n * p, min = -2.5, max = 2.5), nrow = n, ncol = p)
y <- scale(3 * (x[,1]> 0), scale=FALSE)  + x[,2]^3 + rnorm(n)

## Adaptive liso
initialfit = liso.backfit(x,y, 4)
secondfit = liso.backfit(x,y, 4, covweights = liso.covweights(initialfit))

## Compare sparsity
which(dim(initialfit) != 0)
which(dim(secondfit) != 0)

set.seed(79)
y2 <- scale(3 * (x[,1]> 0), scale=FALSE)  + x[,2]^3-6*(abs(x[,2] - 1)< 0.1)  + rnorm(n)

## Sign finding
initialfit = liso.backfit(x,y2, 2, monotone=FALSE)
secondfit = liso.backfit(x,y2, 2, monotone=FALSE, covweights = liso.covweights(initialfit, signfind=TRUE))

## Compare monotonicity. Note near x=1
plot(secondfit, dim=2)
plot(initialfit, dim=2, add=TRUE, col=2)

Run the code above in your browser using DataLab