-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathgrace_bollen_2005.r
41 lines (32 loc) · 1.21 KB
/
grace_bollen_2005.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
####
#
# Example of the direct and indirect effects of elevation on plant cover via fires.
# Model taken from Figure 2. In the original paper, this example was used
# to illustrate the meaning of standardized coefficients in SEM versus multiple
# regression. Try using the covariance matrix to createa correlation matrix
# and calculate partial and semipartial correlation coefficients yourself.
# How do they compare?
#
# Grace, J.B. and Bollen, K.A. 2005. Interpreting the results from multiple regression and structural
# equation models. Bulletin of the Ecological Society of America. 86:283-295
#
# last tested: 5/5/11
# last lavaan version tested: 0.4-8
#
###########
library(lavaan)
GB05Mat<-matrix(c(1006.2, -26.2, -139.4, 3636.3,
-26.2, 2.722, 13.47, -170.4,
-139.4, 13.47, 157.8, -1459.6,
3636.3, -170.4, -1459.6, 66693), ncol=4)
rownames(GB05Mat)<-colnames(GB05Mat)<-c("Plant.Cover",
"Fire.Severity", "Stand.Age", "Elevation")
model<-'
Stand.Age ~ Elevation
Fire.Severity ~ Stand.Age
Plant.Cover ~ Elevation + Fire.Severity
'
fit<-sem(model, sample.cov=GB05Mat, sample.nobs=90)
summary(fit)
standardizedSolution(fit)