Learn R Programming

sesem (version 1.0.1)

plotmodelfit: Function to plot model fit indices for spatial SEM analyses

Description

A function to plot model fit indices across lag distances. The default is to plot all of the chi square, cfi, rmsea (including confidence intervals), and srmr indices. Horizontal lines indicating significant cutoffs for each index are plotted (chi square p=0.05, cfi=0.9, rmsea=0.05, and srmr=0.08). Options to add trend lines are available.

Usage

plotmodelfit(spatial_model_results, plots = "all", add.line = "none", rmsea_err = T, 
     pch = 16, lwd = 2, lty = 1, cex = 1, cex.lab = 1, cex.axis = 1, cex.main = 1.5)

Arguments

spatial_model_results
a list object produced by function runModels
plots
Indicates which indices should be plotted. The default "all" produces plots of all of the chi square, cfi, rmsea (including confidence intervals), and srmr indices. plot="chi", "cfi", "rmsea", or "srmr" will produce only a single plot.
add.line
Indicates whether a trendline should be added connecting the points. The default "none" indicates no line, "step" plots straight line segments between points, and "smooth" plots a smoothed curve fit using function lowess. Smoothed lines do not include the
rmsea_err
Should the rmsea index be plotted with confidence intervals? rmsea_err=T is the default, rmsea_err=F will suppress confidence intervals. Note that warnings will likely arise if rmsea_err=T is used and there are confidence intervals of zero. All these warn
pch
plotting symbol
lwd
line width
lty
line format
cex
symbol size
cex.lab
label font size
cex.axis
axis label font size
cex.main
plot title font size

References

Lamb, E. G., K. Mengersen, K. J. Stewart, U. Attanayake, and S. D. Siciliano. Submitted. Spatially explicit structural equation modeling. Ecology.

See Also

sem, make.covar, runModels, modelsummary, avg.modindices, plotpath, gam.path

Examples

Run this code
#data=truelove
#distancematrix<-calc.dist(truelove)
#Truelove_bins<-make.bin(distancematrix,type="ALL",p.dist=20)
#binsize<-Truelove_bins[1][[1]] #truelove lowland bin sizes
#binname<-Truelove_bins[2][[1]] #truelove lowland bin names

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

# path model for the truelove dataset
#spatial_model<-'
#	Gram ~ Moisture
#	N_Fix ~ Bryoph + Lich + SoilCrust
#	SoilCrust ~ Bryoph + Lich + Gram + Shrubs + Forbs	
#	Bryoph ~ Gram + Shrubs + Forbs + Moisture
#	Lich ~ Moisture + Forbs + Gram + Shrubs + Bryoph
#	Forbs ~ Moisture
#	Gram ~~ Forbs
#	Shrubs ~ Moisture	
#	Gram ~~ Shrubs
#	Shrubs ~~ Forbs
#	'
#
#results<-runModels(spatial_model,covariances)

#The above script produces the sesem object stored as truelove_results

data=truelove_results

plotmodelfit(truelove_results) #note that the warnings that arise here can be ignored
plotmodelfit(truelove_results,rmsea_err=FALSE)
plotmodelfit(truelove_results,plots="chi")

Run the code above in your browser using DataLab