linearRidge: Linear ridge regression.

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/linearRidge.R

Description

Fits a linear ridge regression model. Optionally, the ridge regression parameter is chosen automatically using the method proposed by Cule et al (2012).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
linearRidge(formula, data, lambda = "automatic", nPCs = NULL,
scaling = c("corrForm", "scale", "none"), ...)

## S3 method for class 'ridgeLinear'
coef(object, all.coef = FALSE, ...)

## S3 method for class 'ridgeLinear'
plot(x, y = NULL, ...)

## S3 method for class 'ridgeLinear'
predict(object, newdata, na.action = na.pass, all.coef = FALSE, ...)

## S3 method for class 'ridgeLinear'
print(x, all.coef = FALSE, ...)

## S3 method for class 'ridgeLinear'
summary(object, all.coef = FALSE, ...)

## S3 method for class 'summary.ridgeLinear'
print(x, digits = max(3,
getOption("digits") - 3),
signif.stars = getOption("show.signif.stars"), ...) 

Arguments

formula

a formula expression as for regression models, of the form response ~ predictors. See the documentation of formula for other details.

data

an optional data frame in which to interpret the variables occuring in formula.

lambda

A ridge regression parameter. May be a vector. If lambda is "automatic" (the default), then the ridge parameter is chosen automatically using the method of Cule et al (2012).

nPCs

The number of principal components to use to choose the ridge regression parameter, following the method of Cule et al (2012). It is not possible to specify both lambda and nPCs.

scaling

The method to be used to scale the predictors. One of "corrform"(the default) scales the predictors to correlation form, such that the correlation matrix has unit diagonal. "scale"Standardizes the predictors to have mean zero and unit variance. "none"No scaling.

object

A ridgeLinear object, typically generated by a call to linearRidge.

newdata

An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used.

na.action

function determining what should be done with missing values in newdata. The default is to predict NA.

all.coef

Logical. Should results be returned for all ridge regression penalty parameters (all.coef = TRUE), or only for the ridge parameter chosen automatically using the method of Cule et al?

x

An object of class ridgeLinear (for the print.ridgeLinear and plot.ridgeLinear functions) or an object of class summary.ridgeLinear (for the print.summary.ridgeLinear function)

y

Dummy argument for compatibility with the default plot method. Ignored.

digits

minimum number of significant digits to be used for most numbers

signif.stars

logical; if TRUE, P-values are additionally encoded visually as significance stars in order to help scanning of long coefficient tables. It defaults to the show.signif.stars slot of options.

...

Additional arguments to be passed to or from other methods.

Details

If an intercept is present in the model, its coefficient is not penalised. If you want to penalise an intercept, put in your own constant term and remove the intercept.

Value

An object of class "ridgeLinear", with components:

automatic

Logical. Was lambda chosen automatically?

call

The matched call.

coef

A named vector of fitted coefficients.

df

A vector of degrees of freedom of the model fit, degrees of freedom for variance, and residual degrees of freedom of the fitted model.

Inter

Was an intercept included?

isScaled

Were the predictors scaled before the model was fitted?

lambda

The ridge regression parameter(s).

scales

The scales used to standardize the predictors.

terms

The terms object used.

x

The scaled predictor matrix.

xm

A vector of means of the predictors.

y

The response.

ym

The mean of the response.

And optionally the components

max.nPCs

The maximum number of principal components for which a ridge regression parameter was computed.

chosen.nPCs

The number of principal components used to compute the ridge parameter.

Author(s)

Erika Cule

References

A semi-automatic method to guide the choice of ridge parameter in ridge regression. Cule, E. and De Iorio, M. (2012) arXiv:1205.0686v1 [stat.AP]

See Also

logisticRidge

Examples

1
2
3
data(GenCont)
mod <- linearRidge(Phenotypes ~ ., data = as.data.frame(GenCont))
summary(mod)

Example output

Call:
linearRidge(formula = Phenotypes ~ ., data = as.data.frame(GenCont))


Coefficients:
             Estimate Scaled estimate Std. Error (scaled) t value (scaled)
(Intercept)  1.533386              NA                  NA               NA
SNP1         0.277296        4.045409            0.266120           15.201
SNP2        -0.110458       -1.256154            0.216332            5.807
SNP3        -0.110458       -1.256154            0.216332            5.807
SNP4         0.005230        0.011635            0.371693            0.031
SNP5         0.531173        6.323006            0.315368           20.050
SNP6        -0.119164       -1.373227            0.223047            6.157
SNP7         0.113844        0.113730            0.372181            0.306
SNP8        -0.099149       -1.028581            0.355807            2.891
SNP9        -0.008321       -0.008312            0.372386            0.022
SNP10        0.058562        0.101128            0.371567            0.272
SNP11       -0.096526       -1.495699            0.329250            4.543
SNP12       -0.334279       -0.333945            0.372248            0.897
            Pr(>|t|)    
(Intercept)       NA    
SNP1         < 2e-16 ***
SNP2        6.38e-09 ***
SNP3        6.38e-09 ***
SNP4         0.97503    
SNP5         < 2e-16 ***
SNP6        7.43e-10 ***
SNP7         0.75993    
SNP8         0.00384 ** 
SNP9         0.98219    
SNP10        0.78549    
SNP11       5.55e-06 ***
SNP12        0.36966    
---
Signif. codes:  0***0.001**0.01*0.05.’ 0.1 ‘ ’ 1

Ridge parameter: 2.206848, chosen automatically, computed using 1 PCs

Degrees of freedom: model 3.121 , variance 1.205 , residual 5.036 

ridge documentation built on Feb. 4, 2021, 5:07 p.m.