View source: R/generic_index_plot.R
index_plot | R Documentation |
A generic index plot function for plotting values of a column # in a matrix.
index_plot(
object,
column = NULL,
plot_title = "Index Plot",
x_label = NULL,
cutoff_x_low = NULL,
cutoff_x_high = NULL,
largest_x = 1,
absolute = FALSE,
point_aes = list(),
vline_aes = list(),
hline_aes = list(),
cutoff_line_aes = list(),
case_label_aes = list()
)
object |
A matrix-like object,
such as the output from
|
column |
String. The column name of the values to be plotted. |
plot_title |
The title of the
plot. Default is |
x_label |
The Label for the
vertical axis, for the value of
|
cutoff_x_low |
Cases with values
smaller than this value will be labeled.
A cutoff line will be drawn at this
value.
Default is |
cutoff_x_high |
Cases with values
larger than this value will be labeled.
A cutoff line will be drawn at this
value.
Default is |
largest_x |
The number of cases with the largest absolute value on 'column“ to be labelled. Default is 1. If not an integer, it will be rounded to the nearest integer. |
absolute |
Whether absolute values
will be plotted. Useful when cases
are to be compared on magnitude,
ignoring sign. Default is |
point_aes |
A named list of
arguments to be passed to
|
vline_aes |
A named list of
arguments to be passed to
|
hline_aes |
A named list of
arguments to be passed to
|
cutoff_line_aes |
A named list
of arguments to be passed to
|
case_label_aes |
A named list of
arguments to be passed to
|
This index plot function is for plotting any measure of influence or extremeness in a matrix. It can be used for measures not supported with other functions.
Like functions such as gcd_plot()
and est_change_plot()
, it supports
labelling cases based on the values
on the selected measure
(originaL values or absolute values).
Users can also plot cases based on the absolute values. This is useful when cases are to be compared on magnitude, ignoring the sign.
A ggplot2
plot. Plotted by
default. If assigned to a variable
or called inside a function, it will
not be plotted. Use plot()
to
plot it.
Shu Fai Cheung https://orcid.org/0000-0002-9871-9448.
influence_stat()
, est_change()
,
est_change_raw()
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)
# Plot case influence on chi-square. Label the 3 cases with the influence.
index_plot(out, "chisq", largest_x = 3)
# Plot absolute case influence on chi-square.
index_plot(out, "chisq", absolute = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.