Learn R Programming

(Version 0.1.9, updated on 2025-03-04, release history)

semfindr: Finding influential cases in SEM

A find(e)r of influential cases in structural equation modeling based mainly on the sensitivity analysis procedures presented by Pek and MacCallum (2011).

This package supports two approaches: leave-one-out analysis and approximate case influence.

Leave-One-Out Analysis

This approach examines the influence of each case by refitting a model with this case removed.

Unlike other similar packages, the workflow adopted in semfindr separates the leave-one-out analysis (refitting a model with one case removed) from the case influence measures.

  • Users first do the leave-one-out model fitting for all cases, or

cases selected based on some criteria (vignette("selecting_cases", package = "semfindr")), using lavaan_rerun().

  • Users then compute case influence measures

using the output of lavaan_rerun().

This approaches avoids unnecessarily refitting the models for each set of influence measures, and also allows analyzing only probable influential cases when the model takes a long time to fit.

The functions were designed to be flexible such that users can compute case influence measures such as

  • standardized parameter estimates and generalized Cook's distance for selected parameters;
  • changes in raw or standardized estimates of parameters;
  • changes in fit measures supported by lavaan::fitMeasures().

This package can also be generate plots to visualize case influence, including a bubble plot similar to that by car::influencePlot() All plots generated are ggplot plots that can be further modified by users. More can be found in Quick Start (vignette("semfindr", package = "semfindr")).

Approximate Case Influence

This approach computes the approximate influence of each case using casewise scores and casewise likelihood. This method is efficient because it does not requires refitting the model for each case. However, it can only approximate the influence, unlike the leave-one-out approach, which produce exact influence. This approach can be used when the number of cases is very large and/or the model takes a long time to fit. Technical details can be found in the vignette Approximate Case Influence Using Scores and Casewise Likelihood (vignette("casewise_scores", package = "semfindr")).

Installation

The stable version at CRAN can be installed by install.packages():

install.packages("semfindr")

The latest developmental version can be installed by remotes::install_github:

remotes::install_github("sfcheung/semfindr")

You can learn more about this package at the Github page of this package and Quick Start (vignette("semfindr", package = "semfindr")).

Reference

Pek, J., & MacCallum, R. (2011). Sensitivity analysis in structural equation models: Cases and their influence. Multivariate Behavioral Research, 46(2), 202-228. https://doi.org/10.1080/00273171.2011.561068

Comments, Suggestions, and Bug Reports

Please post your comments, suggestions, and bug reports as issues at GitHub, or contact the maintainer by email. Thanks in advance for trying out semfindr.

Copy Link

Version

Install

install.packages('semfindr')

Monthly Downloads

184

Version

0.1.9

License

GPL-3

Maintainer

Shu Fai Cheung

Last Published

March 3rd, 2025

Functions in semfindr (0.1.9)

influence_plot

Plots of Influence Measures
fit_measures_change

Case Influence on Fit Measures
mahalanobis_predictors

Mahalanobis Distance On Observed Predictors
implied_scores

Implied Scores of Observed Outcome Variables
lavaan_rerun_check

Compatibility Check for 'lavaan_rerun'
influence_stat

Case Influence Measures
mahalanobis_rerun

Mahalanobis Distance on All Observed Variables
lavaan_rerun

Rerun a 'lavaan' Analysis Using the Leaving-One-Out Approach
index_plot

Index Plot of an Arbitrary Statistic
print.influence_stat

Print an 'influence_stat' Class Object
pa_dat2

Sample Data: A Path Model with an Influential Case
print.fit_measures_change

Print a 'fit_measures_change' Class Object
fit_measures_change_approx

Case Influence on Fit Measures (Approximate)
pars_id

Convert Parameter Syntax to Position or Row Numbers in the Parameter Vector or Table
print.md_semfindr

Print a 'md_semfindr' Class Object
print.lavaan_rerun

Print Method for 'lavaan_rerun'
print.est_change

Print an 'est_change' Class Object
sem_dat

Sample Data: A Latent Variable Structural Model
pa_dat

Sample Data: A Path Model
sem_dat2

Sample Data: A Latent Variable Structural Model With an Influential Case
semfindr-package

semfindr: Influential Cases in Structural Equation Modeling
pars_id_to_lorg

Ids to "lhs-op-rhs-(group)"
user_change_raw

Case Influence on User-Defined Statistics
cfa_dat2

Sample Data: A CFA Model with an Influential Case
est_change_raw

Case Influence on Parameter Estimates
est_change_raw_approx

Case Influence on Parameter Estimates (Approximate)
approx_check

Compatibility Check for the '_approx' Functions
est_change_plot

Plots of Case Influence on Parameter Estimates
est_change_approx

Standardized Case Influence on Parameter Estimates (Approximate)
est_change

Standardized Case Influence on Parameter Estimates
cfa_dat

Sample Data: A CFA Model
cfa_dat_mg

Sample Data: A Multiple-Group CFA Model with an Influential Case
cfa_dat_heywood

Sample Data: A CFA Model with a Heywood Case