Learn R Programming

parcor (version 0.2-6)

lm.ridge.univariate: Ridge Regression for a single predictor variable

Description

This function computes the ridge regression coefficients for a mdoel with a single predictor variable.

Usage

lm.ridge.univariate(x,y,lambda=0,scale=TRUE)

Arguments

x
vector of predictor observations.
y
vector of responses. The length of y must equal the length of x
lambda
vector of penalty terms. Default is lambda=0
scale
Scale x and y? Default is scale=TRUE.

Value

length(lambda) rows. In each row, the intercept (first colum) and the regression coefficient (second column) is stored.

Details

This function replaces the R function lm.ridge if only one predictor variable is used, as the latter function produces an error message in this case.

See Also

ridge.net,ridge.cv

Examples

Run this code
n<-100 # number of observations
x<-rnorm(100)
y<-rnorm(n)
ridge.object<-lm.ridge.univariate(x,y,lambda=1:10)

Run the code above in your browser using DataLab