psem is used to unite a list of structural equations into a single structural equation model.

psem(...)

Arguments

...

A list of structural equations

Value

Returns an object of class psem

Details

psem takes a list of structural equations, which can be model objects of classes: lm, glm, gls, pgls, Sarlm, lme, glmmPQL, lmerMod, lmerModLmerTest, glmerMod, glmmTMB, gam.

It also takes objects of class formula, formula.cerror, corresponding to additional variables to be included in the tests of directed separation (X ~ 1) or correlated errors (X1 %~~% X2).

The function optionally accepts data objects of classes: matrix, data.frame, SpatialPointsDataFrame, comparative.data, or these are derived internally from the structural equations.

See also

Author

Jon Lefcheck <LefcheckJ@si.edu>

Examples

mod <- psem(
lm(rich ~ cover, data = keeley),
lm(cover ~ firesev, data = keeley),
lm(firesev ~ age, data = keeley),
data = keeley
)

summary(mod)
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |======================================================================| 100%
#> 
#> Structural Equation Model of mod 
#> 
#> Call:
#>   rich ~ cover
#>   cover ~ firesev
#>   firesev ~ age
#> 
#>     AIC
#>  1103.492
#> 
#> ---
#> Tests of directed separation:
#> 
#>         Independ.Claim Test.Type DF Crit.Value P.Value  
#>      cover ~ age + ...      coef 87    -1.8018  0.0750  
#>       rich ~ age + ...      coef 87    -2.0146  0.0470 *
#>   rich ~ firesev + ...      coef 86    -1.9546  0.0539  
#> 
#> --
#> Global goodness-of-fit:
#> 
#> Chi-Squared = 11.313 with P-value = 0.01 and on 3 degrees of freedom
#> Fisher's C = 17.136 with P-value = 0.009 and on 6 degrees of freedom
#> 
#> ---
#> Coefficients:
#> 
#>   Response Predictor Estimate Std.Error DF Crit.Value P.Value Std.Estimate    
#>       rich     cover  15.6727    4.7931 88     3.2698  0.0015       0.3291  **
#>      cover   firesev  -0.0839    0.0184 88    -4.5594  0.0000      -0.4371 ***
#>    firesev       age   0.0597    0.0125 88     4.7781  0.0000       0.4539 ***
#> 
#>   Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05
#> 
#> ---
#> Individual R-squared:
#> 
#>   Response method R.squared
#>       rich   none      0.11
#>      cover   none      0.19
#>    firesev   none      0.21