piecewiseSEM icon indicating copy to clipboard operation
piecewiseSEM copied to clipboard

basisSet/dSep treats predictors differently when modeled as both linear and non-linear in SEM w/ GAMs

Open seanhardison1 opened this issue 1 year ago • 0 comments

m1 <- gam(age ~ s(cover, k = 3) + s(firesev, k = 3), data = keeley)

m2 <- lm(rich ~ cover + firesev + distance, data = keeley)

m3 <- gam(distance ~ s(firesev, k = 3), data = keeley)

dSep(psem(m1, m2, m3))

Which gives

  |====================================================================================| 100%
                    Independ.Claim Test.Type        DF Crit.Value    P.Value 
1 distance ~ s(cover, k = 3) + ...     anova  1.713613  1.9794257 0.24078373 
2           distance ~ cover + ...      coef 90.000000  1.3558566 0.17868465 
3             distance ~ age + ...      coef 90.000000 -1.8757426 0.06411653 
4                 rich ~ age + ...      coef 85.000000 -0.5282477 0.59870392 

seanhardison1 avatar Apr 06 '23 13:04 seanhardison1