| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/glmnet-glmnet.R |
| 3 |
\name{glance.glmnet} |
| 4 |
\alias{glance.glmnet} |
| 5 |
\title{Glance at a(n) glmnet object} |
| 6 |
\usage{ |
| 7 |
\method{glance}{glmnet}(x, ...) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{x}{A \code{glmnet} object returned from \code{\link[glmnet:glmnet]{glmnet::glmnet()}}.} |
| 11 |
|
| 12 |
\item{...}{Additional arguments. Not used. Needed to match generic |
| 13 |
signature only. \strong{Cautionary note:} Misspelled arguments will be |
| 14 |
absorbed in \code{...}, where they will be ignored. If the misspelled |
| 15 |
argument has a default value, the default value will be used. |
| 16 |
For example, if you pass \code{conf.lvel = 0.9}, all computation will |
| 17 |
proceed using \code{conf.level = 0.95}. Two exceptions here are: |
| 18 |
\itemize{ |
| 19 |
\item \code{tidy()} methods will warn when supplied an \code{exponentiate} argument if |
| 20 |
it will be ignored. |
| 21 |
\item \code{augment()} methods will warn when supplied a \code{newdata} argument if it |
| 22 |
will be ignored. |
| 23 |
}} |
| 24 |
} |
| 25 |
\description{ |
| 26 |
Glance accepts a model object and returns a \code{\link[tibble:tibble]{tibble::tibble()}} |
| 27 |
with exactly one row of model summaries. The summaries are typically |
| 28 |
goodness of fit measures, p-values for hypothesis tests on residuals, |
| 29 |
or model convergence information. |
| 30 |
|
| 31 |
Glance never returns information from the original call to the modeling |
| 32 |
function. This includes the name of the modeling function or any |
| 33 |
arguments passed to the modeling function. |
| 34 |
|
| 35 |
Glance does not calculate summary measures. Rather, it farms out these |
| 36 |
computations to appropriate methods and gathers the results together. |
| 37 |
Sometimes a goodness of fit measure will be undefined. In these cases |
| 38 |
the measure will be reported as \code{NA}. |
| 39 |
|
| 40 |
Glance returns the same number of columns regardless of whether the |
| 41 |
model matrix is rank-deficient or not. If so, entries in columns |
| 42 |
that no longer have a well-defined value are filled in with an \code{NA} |
| 43 |
of the appropriate type. |
| 44 |
} |
| 45 |
\examples{ |
| 46 |
\dontshow{if (FALSE) withAutoprint(\{ # examplesIf} |
| 47 |
|
| 48 |
# load libraries for models and data |
| 49 |
library(glmnet) |
| 50 |
|
| 51 |
set.seed(2014) |
| 52 |
x <- matrix(rnorm(100 * 20), 100, 20) |
| 53 |
y <- rnorm(100) |
| 54 |
fit1 <- glmnet(x, y) |
| 55 |
|
| 56 |
# summarize model fit with tidiers + visualization |
| 57 |
tidy(fit1) |
| 58 |
glance(fit1) |
| 59 |
|
| 60 |
library(dplyr) |
| 61 |
library(ggplot2) |
| 62 |
|
| 63 |
tidied <- tidy(fit1) |> filter(term != "(Intercept)") |
| 64 |
|
| 65 |
ggplot(tidied, aes(step, estimate, group = term)) + |
| 66 |
geom_line() |
| 67 |
|
| 68 |
ggplot(tidied, aes(lambda, estimate, group = term)) + |
| 69 |
geom_line() + |
| 70 |
scale_x_log10() |
| 71 |
|
| 72 |
ggplot(tidied, aes(lambda, dev.ratio)) + |
| 73 |
geom_line() |
| 74 |
|
| 75 |
# works for other types of regressions as well, such as logistic |
| 76 |
g2 <- sample(1:2, 100, replace = TRUE) |
| 77 |
fit2 <- glmnet(x, g2, family = "binomial") |
| 78 |
tidy(fit2) |
| 79 |
\dontshow{\}) # examplesIf} |
| 80 |
} |
| 81 |
\seealso{ |
| 82 |
\code{\link[=glance]{glance()}}, \code{\link[glmnet:glmnet]{glmnet::glmnet()}} |
| 83 |
|
| 84 |
Other glmnet tidiers: |
| 85 |
\code{\link{glance.cv.glmnet}()}, |
| 86 |
\code{\link{tidy.cv.glmnet}()}, |
| 87 |
\code{\link{tidy.glmnet}()} |
| 88 |
} |
| 89 |
\concept{glmnet tidiers} |
| 90 |
\value{ |
| 91 |
A \code{\link[tibble:tibble]{tibble::tibble()}} with exactly one row and columns: |
| 92 |
\item{nobs}{Number of observations used.} |
| 93 |
\item{npasses}{Total passes over the data across all lambda values.} |
| 94 |
\item{nulldev}{Null deviance.} |
| 95 |
|
| 96 |
} |