Learn R Programming

influence.SEM (version 2.3)

parinfluence: Case influence on model parameters.

Description

Computes direction of change in parameter estimates with $$\Delta \hat{\theta}_{ji}=\frac{\hat{\theta}_j-\hat{\theta}_{j(i)}}{[VAR(\hat{\theta}_{j(i)})]^{1/2}}$$ where \(\hat{\theta}_j\) and \(\hat{\theta}_{j(i)}\) are the parameter estimates obtained from original and deleted \(i\) samples.

Usage

parinfluence(parm, model, data, cook = FALSE, ...)

Arguments

parm

Single parameter or vector of parameters.

model

A description of the user-specified model using the lavaan model syntax. See lavaan for more information.

data

A data frame containing the observed variables used in the model. If any variables are declared as ordered factors, this function will treat them as ordinal variables.

cook

Logical, if TRUE returns generalized Cook's Distance computed as \([\Delta \hat{\theta}_{ji}]^2\).

Additional parameters for sem function.

Value

Returns a list:

gCD

Generalized Cook's Distance, if cook=TRUE.

Dparm

Direction of change in parameter estimates.

%\item{THi }{Parameter estimates.}

References

Pek, J., MacCallum, R.C. (2011). Sensitivity Analysis in Structural Equation Models: Cases and Their Influence. Multivariate Behavioral Research, 46, 202-228.

Examples

Run this code
# NOT RUN {
## not run: this example take several minutes
data("PDII")
model <- "
  F1 =~ y1+y2+y3+y4
"
# fit0 <- sem(model, data=PDII)
# PAR <- c("F1=~y2","F1=~y3","F1=~y4")
# LY <- parinfluence(PAR,model,PDII)
# str(LY)
# explore.influence(LY$Dparm[,1])

## not run: this example take several minutes
## an example in which the deletion of a case yelds a solution 
## with negative estimated variances
model <- "
  F1 =~ x1+x2+x3
  F2 =~ y1+y2+y3+y4
  F3 =~ y5+y6+y7+y8
"

# fit0 <- sem(model, data=PDII)
# PAR <- c("F2=~y2","F2=~y3","F2=~y4")
# LY <- parinfluence(PAR,model,PDII)

## not run: this example take several minutes
## dealing with ordinal data
data(Q)
model <- "
 F1 =~ it1+it2+it3+it4+it5+it6+it7+it8+it9+it10
"

# fit0 <- sem(model, data=Q, ordered=colnames(Q))
# LY <- parinfluence("F1=~it4",model,Q,ordered=colnames(Q))
# explore.influence(LY$Dparm[,1])
# }

Run the code above in your browser using DataLab