Learn R Programming

semTools (version 0.4-12)

spatialCorrect: Calculate reliability values of factors

Description

Correcting sample sizes and standard errors in the presence of spatial autocorrelation in Structural Equation Models with with spatial structure in the autocorrelation of endogenous variables.

Usage

spatialCorrect(obj, xvar, yvar, alpha=0.05)

Arguments

obj
The lavaan model object provided after running the cfa, sem, growth, or lavaan functions.
xvar
X-coordinate.
yvar
Y-coordinate.
alpha
The alpha level used to decide whether the effective sample size is used. If Moran's I is not significant, the original sample size is used for test statistic. Otherwise, the calculated effective sample size is used.

Value

  • Morans_I Moran's I statistics and effective sample sizes for all endogeneous variables.
  • parameters Adjusted standard errors and test statistics for each parameter estimate for each endogeneous variables.

Details

This function implements the standard error correction for all endogenous variables, using Moran's I and an approximation of an effective sample size for large sample sizes. This function does not support the data with missing observations.

Examples

Run this code
library(lavaan)
borModel <- '
  NDVI ~ nTot + T61 + Wet 
  nTot ~ T61
'
#note meanstructure = TRUE to obtain intercepts
borFit <- sem(borModel, data = boreal, meanstructure = TRUE)
spatialCorrect(borFit, boreal$x, boreal$y)

Run the code above in your browser using DataLab