/
model_identify_variables.Rd
64 lines (60 loc) · 1.79 KB
/
model_identify_variables.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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/model_identify_variables.R
\name{model_identify_variables}
\alias{model_identify_variables}
\alias{model_identify_variables.default}
\alias{model_identify_variables.lavaan}
\title{Identify for each coefficient of a model the corresponding variable}
\usage{
model_identify_variables(model)
\method{model_identify_variables}{default}(model)
\method{model_identify_variables}{lavaan}(model)
}
\arguments{
\item{model}{a model object}
}
\value{
A tibble with four columns:
\itemize{
\item \code{term}: coefficients of the model
\item \code{variable}: the corresponding variable
\item \code{var_class}: class of the variable (cf. \code{\link[stats:checkMFClasses]{stats::.MFclass()}})
\item \code{var_type}: \code{"continuous"}, \code{"categorical"}, \code{"intercept"}
or \code{"interaction"}
}
}
\description{
It will also identify interaction terms and intercept(s).
}
\examples{
Titanic \%>\%
dplyr::as_tibble() \%>\%
dplyr::mutate(Survived = factor(Survived, c("No", "Yes"))) \%>\%
glm(
Survived ~ Class + Age * Sex,
data = ., weights = .$n,
family = binomial
) \%>\%
model_identify_variables()
iris \%>\%
lm(
Sepal.Length ~ poly(Sepal.Width, 2) + Species,
data = .,
contrasts = list(Species = contr.sum)
) \%>\%
model_identify_variables()
}
\seealso{
\code{\link[=tidy_identify_variables]{tidy_identify_variables()}}
Other model_helpers:
\code{\link{model_get_coefficients_type}()},
\code{\link{model_get_contrasts}()},
\code{\link{model_get_model_frame}()},
\code{\link{model_get_model_matrix}()},
\code{\link{model_get_model}()},
\code{\link{model_get_xlevels}()},
\code{\link{model_list_contrasts}()},
\code{\link{model_list_terms_levels}()},
\code{\link{model_list_variables}()}
}
\concept{model_helpers}