Description Usage Arguments Details Value Author(s) See Also Examples
This function computes the ridge regression coefficients for a mdoel with a single predictor variable.
1 | lm.ridge.univariate(x,y,lambda=0,scale=TRUE)
|
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. |
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.
A matrix with two columns and length(lambda)
rows. In each row, the intercept (first colum) and the regression coefficient (second column) is stored.
Nicole Kraemer
1 2 3 4 | n<-100 # number of observations
x<-rnorm(100)
y<-rnorm(n)
ridge.object<-lm.ridge.univariate(x,y,lambda=1:10)
|
Loading required package: MASS
Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-10
Loading required package: ppls
Loading required package: splines
Loading required package: Epi
Attaching package: 'Epi'
The following object is masked from 'package:base':
merge.data.frame
Loading required package: GeneNet
Loading required package: corpcor
Loading required package: longitudinal
Loading required package: fdrtool
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.