[R] "no 'nobs' method available" error when using BIC selection in glmulti with genetic algorithm and lmer

Achim Zeileis Achim.Zeileis at uibk.ac.at
Wed Mar 26 07:51:12 CET 2014


On Tue, 25 Mar 2014, Alicia Ellis wrote:

> I am running glmulti with the lme function and selection using BIC.  When I
> do this, I get the following error:

In general, in such situations, it's easiest to use AIC() rather than 
BIC() and supply the correct log-number of observations:
AIC(my_object, k = log(my_n))

> no 'nobs' method is available
>
> I am running this on R version 3.0.3 and on a server with multiple cores
> and a ton of memory.  The model seems to work fine if I do selection with
> AIC which makes sense because nobs() is principally used when computing BIC.
>
> Code is below. My data file has over 300,000 rows so it might be best to
> test this with some generic data.  However, if you want my data, email me
> and I'll file transfer it to you.
>
> Is there a bug in the function code for glmulti or some other problem?
>
> Thanks!
>
> ##############################################################################
> ########## Create lmer wrapper to paste random variable to all models
> ##########
>
> lmer.glmulti <- function (formula, data, random = "", ...) {
> lmer(paste(deparse(formula), random), data = data, REML=F, ...)
> }
>
> ##############################################################################
> ########## Run models with NO Interactions using genetic algorithm
> ##########
> ########## Add intermediate immigration (0.5) to avoid selecting local
> optima
> ########## Select based on AIC
> ########## NOTE:  selection on BIC does NOT work.  Problem with function??
>
> glmulti.model <- glmulti(stunt.dhs ~
> dis_ed_des_scaled_sqrt*
> biome_clu*
>  avg_clu_tc_scaled_sqrt*
> dist_road_scaled_sqrt*
> avg_elev_scaled*
> ann_precip_scaled*
> tc_des_scaled*
> biome_des*
> area_des_scaled_sqrt*
> pden_lscan_scaled_sqrt*
> wealth.factor_scaled*
> time.water_scaled_sqrt*
> drink.water*
> urban.rural,
> data=mydata,
> level = 1,
> fitfunc = lmer.glmulti,
>  random = "+(1|country.code/year/cluster)",
>  method = "g",
>  imm = 0.5,
>  crit = bic,
>  confsetsize = 16384)
>
> -- 
> Alicia Ellis
> Postdoc
> Gund Institute for Ecological Economics
> University of Vermont
> 617 Main Street
> Burlington, VT  05405
> (802) 656-1046
> http://www.wcs-heal.org
> http://www.uvm.edu/~aellis5/
> <http://entomology.ucdavis.edu/faculty/scott/aellis/>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>




More information about the R-help mailing list