0

I've fitted a COZIGAM model, that is like a GAM model but for Zero-Inflated data.

My model is:

library(COZIGAM)
t5.co<-cozigam(z1~s(y1, bs="cr")+s(lon1,lat1,sst1)+s(sst1,bs="cr"),
               conv.crit.out=1e-3, family=poisson, data=data1)

How could I represent the second spline (s(lon1,lat1,sst1)) with a 3d plot? I've tried this:

plot(t5.co, select=2, plot.2d="persp")

But it does not work.

Thanks!!

Zheyuan Li
  • 71,365
  • 17
  • 180
  • 248
  • To generate a 3D plot use persp directly. ?persp – Jeffrey Evans Feb 05 '14 at 17:17
  • 1
    @JeffreyEvans If the spline itself contains 3 variables and you want the effect on the response `y` to be represented by the height of the surface, then you are in trouble. `?persp` is only part of the answer. The other part of the answer is to produce the partial response holding one of the variables at some representative value (or values, and hence produce several surfaces) and varying the other two to produce the surface. – Gavin Simpson Feb 05 '14 at 17:22
  • @JeffreyEvans I've tried but it doesn't work. – Gloria Cariolato Feb 05 '14 at 17:32
  • @GavinSimpson Have you some ideas? How could I do this? Thanks for your time. – Gloria Cariolato Feb 06 '14 at 09:01
  • @GloriaCariolato It is a somewhat complex ask; in principle this is easy, simply make predictions from the model for data points over the range of two of the three variables. For the other variables you need to hold them fixed in all predictions at some value (say the median, or the median and the lower and upper quartiles). I have been doing this recently and it is that simple. In practice getting it right is tedious and somewhat long-winded in code. As I am not familiar with `cozigam()` and you have not provided a reproducible example, I don't have time to work it all out for you. – Gavin Simpson Feb 06 '14 at 20:44
  • @GloriaCariolato In sum, you need a partial response plot. – Gavin Simpson Feb 06 '14 at 20:45

0 Answers0