File: lm.ridge.Rd

package info (click to toggle)
r-cran-mass 7.3-51.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,148 kB
  • sloc: ansic: 664; makefile: 2
file content (110 lines) | stat: -rw-r--r-- 2,567 bytes parent folder | download | duplicates (5)
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
% file MASS/man/lm.ridge.Rd
% copyright (C) 1994-9 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)
}
\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 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}}.
}}
\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}