Debian Codegraph @

man/tidy.ridgelm.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/mass-ridgelm.R
3 \name{tidy.ridgelm}
4 \alias{tidy.ridgelm}
5 \alias{ridgelm_tidiers}
6 \title{Tidy a(n) ridgelm object}
7 \usage{
8 \method{tidy}{ridgelm}(x, ...)
9 }
10 \arguments{
11 \item{x}{A \code{ridgelm} object returned from \code{\link[MASS:lm.ridge]{MASS::lm.ridge()}}.}
12
13 \item{...}{Additional arguments. Not used. Needed to match generic
14 signature only. \strong{Cautionary note:} Misspelled arguments will be
15 absorbed in \code{...}, where they will be ignored. If the misspelled
16 argument has a default value, the default value will be used.
17 For example, if you pass \code{conf.lvel = 0.9}, all computation will
18 proceed using \code{conf.level = 0.95}. Two exceptions here are:
19 \itemize{
20 \item \code{tidy()} methods will warn when supplied an \code{exponentiate} argument if
21 it will be ignored.
22 \item \code{augment()} methods will warn when supplied a \code{newdata} argument if it
23 will be ignored.
24 }}
25 }
26 \description{
27 Tidy summarizes information about the components of a model.
28 A model component might be a single term in a regression, a single
29 hypothesis, a cluster, or a class. Exactly what tidy considers to be a
30 model component varies across models but is usually self-evident.
31 If a model has several distinct types of components, you will need to
32 specify which components to return.
33 }
34 \examples{
35 \dontshow{if (rlang::is_installed(c("MASS", "ggplot2"))) withAutoprint(\{ # examplesIf}
36
37 # load libraries for models and data
38 library(MASS)
39
40 names(longley)[1] <- "y"
41
42 # fit model and summarizd results
43 fit1 <- lm.ridge(y ~ ., longley)
44 tidy(fit1)
45
46 fit2 <- lm.ridge(y ~ ., longley, lambda = seq(0.001, .05, .001))
47 td2 <- tidy(fit2)
48 g2 <- glance(fit2)
49
50 # coefficient plot
51 library(ggplot2)
52 ggplot(td2, aes(lambda, estimate, color = term)) +
53 geom_line()
54
55 # GCV plot
56 ggplot(td2, aes(lambda, GCV)) +
57 geom_line()
58
59 # add line for the GCV minimizing estimate
60 ggplot(td2, aes(lambda, GCV)) +
61 geom_line() +
62 geom_vline(xintercept = g2$lambdaGCV, col = "red", lty = 2)
63 \dontshow{\}) # examplesIf}
64 }
65 \seealso{
66 \code{\link[=tidy]{tidy()}}, \code{\link[MASS:lm.ridge]{MASS::lm.ridge()}}
67
68 Other ridgelm tidiers:
69 \code{\link{glance.ridgelm}()}
70 }
71 \concept{ridgelm tidiers}
72 \value{
73 A \code{\link[tibble:tibble]{tibble::tibble()}} with columns:
74 \item{GCV}{Generalized cross validation error estimate.}
75 \item{lambda}{Value of penalty parameter lambda.}
76 \item{term}{The name of the regression term.}
77 \item{estimate}{estimate of scaled coefficient using this lambda}
78 \item{scale}{Scaling factor of estimated coefficient}
79
80 }