0

I'm having this error message when I try to see the diagnostic plots of the following model, with the function "gam.check":

mod <- zigam(PDS ~ as.factor(Site) + as.factor(Gear) + s(month, k=9, bs="tp"),
             offset(site.agressive$Effort), data=site.agressive,
             family=poisson, link="log")

    summary(mod$fit.gam)  
    plot(mod$fit.gam, all.terms=T, shade=T)
    gam.check(mod$fit.gam)

Any ideas on how to solve this problem?

hello_there_andy
  • 2,039
  • 2
  • 21
  • 51
  • Are you using RStudio? If so, see http://stackoverflow.com/questions/23050928/error-in-plot-new-figure-margins-too-large-scatter-plot for an example. In the plain old R GUI, see http://stackoverflow.com/questions/6500697/error-in-frame-figure-margins-too-large. – alexforrence Feb 13 '15 at 23:20
  • Or http://stackoverflow.com/search?q=%22error+in+plot.new%28%29%22, take your pick. – alexforrence Feb 14 '15 at 00:10

2 Answers2

0

If you have not installed-loaded the mgcv package

install.packages('mgcv')

library('mgcv')

mod <- zigam(PDS ~ as.factor(Site) + as.factor(Gear) + s(month, k=9, bs="tp"),
             offset(site.agressive$Effort), data=site.agressive,
             family=poisson, link="log")

summary(mod$fit.gam)  
plot(mod$fit.gam, all.terms=T, shade=T)
gam.check(mod$fit.gam)

If you are using RStudio and you have installed-loaded the mgcv package

In RStudio, try resizing the right side to increase the width of the windows. Now try to load the library ("mgcv"). Then run the code above.

hello_there_andy
  • 2,039
  • 2
  • 21
  • 51
0

This is a standard problem when the Rstudio plot window is too small. Make it bigger and plot again.

Francisco
  • 179
  • 11