print.influence_stat {semfindr} | R Documentation |
Print an 'influence_stat' Class Object
Description
Print the content of an 'influence_stat'-class object.
Usage
## S3 method for class 'influence_stat'
print(
x,
digits = 3,
what = c("parameters", "fit_measures", "mahalanobis"),
first = 10,
sort_parameters_by = c("gcd", "est"),
sort_fit_measures_by = NULL,
sort_mahalanobis = TRUE,
sort_fit_measures_decreasing = TRUE,
sort_fit_measures_on_absolute = TRUE,
sort_mahalanobis_decreasing = TRUE,
...
)
Arguments
x |
An 'influence_stat'-class object. |
digits |
The number of digits after the decimal. Default is 3. |
what |
A character vector of the
results #' to be printed, can be
one or more of the following:
|
first |
Numeric. If not |
sort_parameters_by |
String.
If it is |
sort_fit_measures_by |
String. Default is |
sort_mahalanobis |
Logical. If |
sort_fit_measures_decreasing |
Logical. Whether cases, if sorted
on fit measures,
are on decreasing order in the output of
case influence on fit measures. Default is |
sort_fit_measures_on_absolute |
Logical. Whether
cases, if sorted on fit measures,
are sorted on absolute values of fit measures. Default is |
sort_mahalanobis_decreasing |
Logical. Whether cases, if sorted
on Mahalanobis distance,
is on decreasing order. Default is |
... |
Optional arguments. Passed to
other print methods, such as |
Details
This method will print
the output of influence_stat()
in a user-friendly
way. Users can select the set(s) of output,
case influence on parameter estimates,
case influence on fit measures, and
Mahalanobis distance, to be printed.
The corresponding print methods of
est_change
-class objects,
fit_measures_change
-class objects,
and md_semfindr
-class objects will be called.
Value
x
is returned invisibly. Called for its side effect.
See Also
influence_stat()
, print.est_change()
,
print.fit_measures_change()
, print.md_semfindr()
Examples
library(lavaan)
dat <- pa_dat
# The model
mod <-
"
m1 ~ a1 * iv1 + a2 * iv2
dv ~ b * m1
a1b := a1 * b
a2b := a2 * b
"
# Fit the model
fit <- lavaan::sem(mod, dat)
summary(fit)
# --- Leave-One-Out Approach
# Fit the model n times. Each time with one case removed.
# For illustration, do this only for selected cases.
fit_rerun <- lavaan_rerun(fit, parallel = FALSE,
to_rerun = 1:10)
# Get all default influence stats
out <- influence_stat(fit_rerun)
out
print(out, first = 4)
print(out, what = c("parameters", "fit_measures"))
# --- Approximate Approach
out_approx <- influence_stat(fit)
out_approx
print(out, first = 8)
print(out, what = c("parameters", "fit_measures"),
sort_parameters_by = "est")