Hi everyone, I ran a binomial GAM consisting of a tensor product of two continuous variables, a continuous parametric term and crossed random intercepts on a data set with 13,042 rows. When trying to plot the tensor product with vis.gam(), I get the following error message: Error in persp.default(m1, m2, z, col = col, zlim = c(min.z, max.z), xlab view[1], : invalid 'z' limits In addition: Warning messages: 1: In max(z, na.rm = TRUE) : no non-missing arguments to max; returning -Inf 2: In min(fv$fit, na.rm = TRUE) : no non-missing arguments to min; returning Inf 3: In max(fv$fit, na.rm = TRUE) : no non-missing arguments to max; returning -Inf When I specify zlim in vis.gam, the 3D frame of the graph is plotted, but not the tensor product surface itself, and vis.gam() returns the following warning: Warning message: In max(z, na.rm = TRUE) : no non-missing arguments to max; returning -Inf Unfortunately, I cannot replicate these errors with made-up data nor with a random subset of the full data set. When I run the model WITHOUT the third variable, everything works fine. Can anyone give me some pointers? Thank you! Jan R version: 2.15.1 (32 bit Linux) mgcv, version 1.7-19 -- View this message in context: http://r.789695.n4.nabble.com/mgcv-1-7-19-vis-gam-invalid-z-limits-tp4638423.html Sent from the R help mailing list archive at Nabble.com.
Jan, Could you send the exact gam call and exact vis.gam call that did this please? Also, if 'm' denotes your fitted model, what result does 'fitted(m)' give? and what is the output from print(m)? best, Simon On 07/30/2012 09:19 PM, janvanhove wrote:> Hi everyone, > > I ran a binomial GAM consisting of a tensor product of two continuous > variables, a continuous parametric term and crossed random intercepts on a > data set with 13,042 rows. When trying to plot the tensor product with > vis.gam(), I get the following error message: > > Error in persp.default(m1, m2, z, col = col, zlim = c(min.z, max.z), xlab > view[1], : > invalid 'z' limits > In addition: Warning messages: > 1: In max(z, na.rm = TRUE) : > no non-missing arguments to max; returning -Inf > 2: In min(fv$fit, na.rm = TRUE) : > no non-missing arguments to min; returning Inf > 3: In max(fv$fit, na.rm = TRUE) : > no non-missing arguments to max; returning -Inf > > When I specify zlim in vis.gam, the 3D frame of the graph is plotted, but > not the tensor product surface itself, and vis.gam() returns the following > warning: > > Warning message: > In max(z, na.rm = TRUE) : no non-missing arguments to max; returning -Inf > > Unfortunately, I cannot replicate these errors with made-up data nor with a > random subset of the full data set. When I run the model WITHOUT the third > variable, everything works fine. Can anyone give me some pointers? > > Thank you! > Jan > > R version: 2.15.1 (32 bit Linux) > mgcv, version 1.7-19 > > > > -- > View this message in context: http://r.789695.n4.nabble.com/mgcv-1-7-19-vis-gam-invalid-z-limits-tp4638423.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
I somehow solved the problem - kind of. The data set on which I ran the GAM model contains many more variables than are needed in the model, so I created a new data set in R and reran the GAM model on the slimmed down data set. Same problem: The GAM can be computed, but the tensor product cannot be plotted. I then saved the slimmed down data set as a CSV file, reread it into R, computed the model once again, and lo and behold: I can now plot the tensor product. Any ideas why? -- View this message in context: http://r.789695.n4.nabble.com/mgcv-1-7-19-vis-gam-invalid-z-limits-tp4638423p4638711.html Sent from the R help mailing list archive at Nabble.com.