title: Calculating R squared for Poisson GLMM using MuMIn r.squaredGLMM
body: <p>I am modeling abundance for a species of bird using a Poisson generalized mixed model using glmer in the R package "lme4". An example of my data:</p>
  
  <pre><code>abund      point_id  patch_area vis_per_year year
  6      EL_03Plot035   244.69412          C_5 2003
  0         RC_BBSM08   101.68909          C_2 2004
  0  RP_211021_HSH088  1348.89935          C_3 2011
  0         RC_LRSM04   111.74057          C_4 2008
  0      RP_225155_p5     1.34007          C_3 2012
  0       HO_YORUP105   141.66933          C_3 1998
  1         RC_SPSM07   179.16088          C_2 2006
  0     BH_MB12_bmh42 16937.30694         &lt;NA&gt; 2002
  1         RC_MOSM11   104.43196          C_4 2012
  1         RC_YOSM06   141.66933          C_4 2010
  0  RP_244006_HMD366 27778.83482          C_3 2012
  0      RP_247155_p5  7688.64751          C_3 2012
  0      EL_08Plot127          NA          C_5 2008
  2        HO_LITRR10   160.81729          C_4 1997
  0         RC_BPSM07    38.23207          C_4 2009
  0        HO_HARRIV5    10.46441          C_3 1999
  1         RC_SPSM16   179.16088          C_4 2009
  0         RC_YOSM01   141.66933          C_3 2002
  0  RP_222799_HSH360    14.94866          C_3 2012
  1         RC_WESM33   381.19813          C_2 2006
  0  RP_209841_HSH017  2269.11227          C_3 2011
  0         RC_LRSM03   111.74057          C_3 2001
  0   RP_26718_HHO097    26.95666          C_3 2012
  0     RP_236935_p14  7979.05373          C_3 2012
  0 BD_miles_medium_2          NA          C_2 2003
  </code></pre>
  
  <p>"abund" is count data of max # of birds detected at that point each year, "point_id" is the name of the survey point, "patch_area" is the area of the habitat patch in which the point is located, vis_per_year is an ordered factor observation-level covariate indicating how many times a point was visited in a year, and "year" indicates year of the observation. With a few exceptions, there is only one abundance count (row) for each point per year.</p>
  
  <p>My model specification is:  </p>
  
  <pre><code>model=glmer(abund ~ scale(year) + (1|vis_per_year) + (1|patchid/point_id), family = poisson, data)
  </code></pre>
  
  <p>So far, for diagnostics I have checked my models for overdispersion using gof from the package "aods3", examined QQ plots of the random effects, and compared the models containing my fixed effect (I only have one) to a null model with only the random effect structure using the anova command from "lmerTest". The model is slightly underdispersed, and ranks higher than the null models using either AIC or anova criteria.</p>
  
  <p>I am now trying to calculate R^2 for my final models. I read the blog entry at <a href="https://ecologyforacrowdedplanet.wordpress.com/2013/02/26/r-squared-for-mixed-models/" rel="nofollow noreferrer">https://ecologyforacrowdedplanet.wordpress.com/2013/02/26/r-squared-for-mixed-models/</a> and the subsequent post update as well as the associated manuscript, and installed the MuMIn package to use for calculating marginal and conditional R^2. However, when I try to use r.squared.GLMM(Model), The following error is thrown:</p>
  
  <pre><code>Error in glmer(formula = SALS ~ scale(year) + (1 | vis_per_year) + (1 |  : 
    fitting model with the observation-level random effect term failed. Add the term manually
  </code></pre>
  
  <p>In addition: Warning message:</p>
  
  <pre><code>In t(mm[!is.na(ff), ]) :
    error in evaluating the argument 'x' in selecting a method for function 't': Error in mm[!is.na(ff), ] : (subscript) logical subscript too long
  </code></pre>
  
  <p>To isolate the source of the error I have tried running the model without point_id and visit_per year, however the same error is thrown without these covariates included. What exactly does this error mean - how do I add the observation term manually to the model? I have read the documentation for MuMIn, but I'm at a loss as to 1) exactly what the error means and 2) how to fix it. Any help is much appreciated. I don't think I can produce a reproducible example without providing the entire dataset, however knowing the exact meaning of this error will help me on my way.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>At the recommendation of the error message and some explanation (thank you stack overflow!) I included my individual-level effect manually to the model. Now i get a different error:</p>
  
  <pre><code>Warning message:
  In r.squaredGLMM.merMod(model) :
    exp(beta0) of 0.2 is too close to zero, estimate may be unreliable 
  </code></pre>
  
  <p>Does this mean the expected Beta for my fixed effect is too close to zero?</p>