runModels: Run a spatial SEM analysis

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/sesem1.0.2.r

Description

Given a path model (spatial_model) specified using lavaan syntax, and a list object containing covariance matrices generated by make.covar, runs an sem model using function sem from the lavaan package for each lag distance bin.

Usage

1
runModels(spatial_model,covdata)

Arguments

spatial_model

a path model specified using lavaan syntax. See the lavaan help pages for details.

covdata

a list object containing covariance matrices and other descriptors as produced by make.covar

Details

Given a path model (spatial_model) specified using lavaan syntax, and a list object containing covariance matrices generated by make.covar, runs an sem model using function sem from the lavaan package for each lag distance bin. Produces a list object containing the model results.

Value

1

a table of model fit estimates for each model. See the lavaan documentation for an explanation of each value.

2

table containing a vector of parameter numbers and a character vector containing the names of the paths included in each model.

3

a table of unstandardized path coefficient estimates for each path in each model

4

standard error of unstandardized path coefficient estimates for each path in each model

5

p-values for each unstandardized path coefficient estimate for each path in each model

6

standardized parameter estimates for each path in each model

7

character vector containing list of names of dependent variables within the models

8

r-square values for each dependent variable in each model

9

names of each path for which there is a modification index value

10

modification index values for each potential path addition for each model

11

a copy of the bin.summary table in the input covdata object

Note

Should model convergence fail for certain lag bins, those bins will be skipped and no results written.

Author(s)

Eric Lamb

References

Lamb, E. G., K. Mengersen, K. J. Stewart, U. Attanayake, and S. D. Siciliano. 2014. Spatially explicit structural equation modeling. Ecology 95:2434-2442.

Rosseel, Y. 2012 lavaan: an R package for structural equation modeling. Journal of Statistical Software 48:1-36.

See Also

sem, make.covar, modelsummary, plotmodelfit, plotpath

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
data=truelove
truelove_red<-truelove[c(1:60),c(1:7)]
distancematrix<-calc.dist(truelove_red)
Truelove_bins<-make.bin(distancematrix,type="ALL",p.dist=10)
binsize<-Truelove_bins[1][[1]] #truelove lowland bin sizes
binname<-Truelove_bins[2][[1]] #truelove lowland bin names

plotbin(distancematrix,binsize)

covariances<-make.covar(truelove_red,distancematrix,binsize,binname)
covariances

# reduced path model for the truelove dataset

spatial_model<-'
	N_Fix ~ Bryoph + Lich + SoilCrust
	SoilCrust ~ Bryoph + Lich	
	Lich ~ Bryoph + Moisture
	Bryoph ~ Moisture
	'

results<-runModels(spatial_model,covariances)
plotmodelfit(results,rmsea_err=FALSE)

sesem documentation built on May 1, 2019, 9:17 p.m.