-
Notifications
You must be signed in to change notification settings - Fork 22
/
lm.ridge.Rd
115 lines (114 loc) · 2.61 KB
/
lm.ridge.Rd
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
% file MASS/man/lm.ridge.Rd
% copyright (C) 1994-2023 W. N. Venables and B. D. Ripley
%
\name{lm.ridge}
\alias{lm.ridge}
\alias{plot.ridgelm}
\alias{print.ridgelm}
\alias{select}
\alias{select.ridgelm}
\title{
Ridge Regression
}
\description{
Fit a linear model by ridge regression.
}
\usage{
lm.ridge(formula, data, subset, na.action, lambda = 0, model = FALSE,
x = FALSE, y = FALSE, contrasts = NULL, \dots)
select(obj)
}
\arguments{
\item{formula}{
a formula expression as for regression models, of the form
\code{response ~ predictors}. See the documentation of \code{formula}
for other details. \code{\link{offset}} terms are allowed.
}
\item{data}{
an optional data frame, list or environment in which to interpret the
variables occurring in \code{formula}.
}
\item{subset}{
expression saying which subset of the rows of the data should be used
in the fit. All observations are included by default.
}
\item{na.action}{
a function to filter missing data.
}
\item{lambda}{
A scalar or vector of ridge constants.
}
\item{model}{
should the model frame be returned? Not implemented.
}
\item{x}{
should the design matrix be returned? Not implemented.
}
\item{y}{
should the response be returned? Not implemented.
}
\item{contrasts}{
a list of contrasts to be used for some or all of factor terms in the
formula. See the \code{contrasts.arg} of \code{\link{model.matrix.default}}.
}
\item{\dots}{
additional arguments to \code{\link{lm.fit}}.
}
\item{obj}{
an \R object, such as an \code{"lm.ridge"} fit.
}
}
\details{
If an intercept is present in the model, its coefficient is not
penalized. (If you want to penalize an intercept, put in your own
constant term and remove the intercept.)
}
\value{
A list with components
\item{coef}{
matrix of coefficients, one row for each value of \code{lambda}.
Note that these are not on the original scale and are for use by the
\code{\link{coef}} method.
}
\item{scales}{
scalings used on the X matrix.
}
\item{Inter}{
was intercept included?
}
\item{lambda}{
vector of lambda values
}
\item{ym}{
mean of \code{y}
}
\item{xm}{
column means of \code{x} matrix
}
\item{GCV}{
vector of GCV values
}
\item{kHKB}{
HKB estimate of the ridge constant.
}
\item{kLW}{
L-W estimate of the ridge constant.
}}
\references{
Brown, P. J. (1994)
\emph{Measurement, Regression and Calibration}
Oxford.
}
\seealso{
\code{\link{lm}}
}
\examples{
longley # not the same as the S-PLUS dataset
names(longley)[1] <- "y"
lm.ridge(y ~ ., longley)
plot(lm.ridge(y ~ ., longley,
lambda = seq(0,0.1,0.001)))
select(lm.ridge(y ~ ., longley,
lambda = seq(0,0.1,0.0001)))
}
\keyword{models}