0
$\begingroup$

I am trying to understand if my model treat ndvi like the coordinates (i.e. does it fit a spline to the relationship between ndvi and the outcome) or fit a spline to longitude and latitude, and a simple linear term for ndvi? I don’t know if the p-value indicates that adding the ndvi term to the model significantly improves the fit, or whether this is a p-value for a simple linear association.


> library(mgcv)
>
> summary.gam(m2)
> 
> Family: binomial  Link function: logit 
> 
> Formula: Outcome ~ lo(Xcoord, Ycoord, ndvi, span = 0.95)
> 
> Parametric coefficients:
>                                                Estimate Std. Error z value Pr(>|z|)  
> (Intercept)                                   -2.870e+02  2.213e+02  -1.297   0.1947  
> lo(Xcoord, Ycoord, ndvi, span = 0.95)Xcoord  1.496e-05  3.649e-05   0.410   0.6818  
> lo(Xcoord, Ycoord, ndvi, span = 0.95)Ycoord  3.559e-05  2.863e-05   1.243   0.2138  
> lo(Xcoord, Ycoord, ndvi, span = 0.95)ndvi  1.906e+00  7.801e-01   2.444   0.0145 *
> 
> Signif. codes:  0 *** 0.001 ** 0.01 * 0.05 ‘.’ 0.1 ‘ ’ 1
>
>
> R-sq.(adj) =  0.00111   Deviance explained = 0.26%
> UBRE = -0.3706  Scale est. = 1         n = 5254                                              
>
> anova.gam(m2)
> Family: binomial 
> Link function: logit 

> Formula:
> Outcome ~ lo(Xcoord, Ycoord, ndvi75, span = 0.95)

> Parametric Terms:
>                                        df Chi.sq p-value
>
> lo(Xcoord, Ycoord, ndvi, span = 0.95)  1  5.971  0.0145

```
$\endgroup$
1
  • $\begingroup$ You seem to be using mgcv but with the LOESS smooth type (lo()) which isn't advisable as lo() comes from the gam package. $\endgroup$ Commented Jun 16, 2020 at 17:25

1 Answer 1

0
$\begingroup$

What I mean by my comment

You seem to be using mgcv but with the LOESS smooth type (lo()) which isn't advisable as lo() comes from the gam package.

is that your model isn't actually fitting any splines (loess smooths) at all; you're getting 4 parametric coefficients estimated and that's it.

If you want a 3d smooth of Xcoord, Ycoord, and ndvi you could do:

Outcome ~ te(Xcoord, Ycoord, ndvi)

or

Outcome ~ te(Xcoord, Ycoord, ndvi, bs = c("tp", "cr"), d = c(2,1))

The first model would assume anisotropy in the smooths, so the wiggliness in Xcoord could be different to the wiggliness in Ycoord. The second model fits a 2d spatial smooth with a single smoothness parameter where there is an assumption of isotropy (same degree of wiggliness in the X and Y directions).

$\endgroup$
2
  • $\begingroup$ Thanks for the precious information, Gavin Simpson. I want to smooth the relationship between X and the outcome, and Y and the outcome - to run a 2D smooth, with the linear effect of NDVI added in. Does the second model do it? $\endgroup$ Commented Jun 23, 2020 at 11:22
  • $\begingroup$ If you want a model with a smooth interaction between x and y plus a linear effect of ndvi thenstart with something like: ~ te(x, y) + ndvi If you are happy to not assume the effect of ndvi is linear then ~ te(x, y) + s(ndvi) would get you the non-linear/smooth effect of ndvi plus the smooth interaction of x and y. $\endgroup$ Commented Jun 23, 2020 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.