predict.merMod
I've tried installing from github on my personal computer as well (in case
there was something with my work network causing a problem). I ran into the
same error. I am able to install other github packages--for example, my
(admittedly very small) package on nongaussian mixture
modeling: devtools::install_github("emclustr","crossfitAL").
I'll re-attempt the binary today--currently having some problems
downloading it.
Regarding question #2 (my hacked function), I completely agree that a
proliferation of predict.merMod functions is undesirable. the random
component of my model is as follows
lmer(... (0 + <logical> + <factor> |subject/school), data= ...)
The issue is selecting the appropriate columns of the random effects
data-frame { ranef(object)[[1]] } when the intercept term is
suppressed--but allowing flexibility in the function when the intercept is
not suppressed. It's made more difficult by the factor variable having 3-4
levels.
Alex
Alex Whitworth
whitworth.alex at gmail.com
(c) 828.429.7478
On Wed, Sep 17, 2014 at 1:37 PM, Ben Bolker <bbolker at gmail.com> wrote:
On Wed, Sep 17, 2014 at 3:22 PM, Alex Whitworth <whitworth.alex at gmail.com> wrote:
Dr Bolker, I tried installing the development / github version of lme4 today and ran into an error. R system messages copied below. Any help would be appreciated.
I'm cc'ing this to r-sig-mixed-models in case anyone has an idea. In the meantime, * I'm also posting a Windows binary of the latest development version (today's github version), as built by CRAN's win-builder, to http://lme4.r-forge.r-project.org/repos/ ; it will take up to 24 hours to show up there * I've also put a version at http://ms.mcmaster.ca/~bolker/R/bin/windows/contrib/3.1/ , available immediately You can install this under R 3.1.* with an appropriate install.packages(...,repos=...) incantation, or download the .zip file and install it locally.
On a second note, I'm still working on my "hacked" version of the predict function predict.merMod2() . I've solved one of the issues I was running into but am still working on an issue related to the random effects for grouping variables that are of type factor.
(What other kinds of grouping variables are there ... ?)
I hope to be able to solve this / put the solution on stackoverflow in the near-ish future.
I'm hoping that the predict.merMod in the development version will solve all your problems, or that if it doesn't you can create a small reproducible example and I can fix it centrally. Provide that you're not trying to do something really weird/baroque, it makes more sense to have the package Just Work than to have a proliferation of individual fixes/workarounds.
------------------------------------------------------------------------------------------------------------------- Restarting R session...
devtools::install_github("lme4","lme4")
Installing github repo lme4/master from lme4 Downloading master.zip from https://github.com/lme4/lme4/archive/master.zip Installing package from C:\Users\alewit\AppData\Local\Temp\RtmpYHOfgM/master.zip Installing lme4 "C:/PROGRA~1/R/R-31~1.1/bin/x64/R" --vanilla CMD build \ "C:\Users\alewit\AppData\Local\Temp\RtmpYHOfgM\devtools138845a711f6\lme4-master" --no-manual \ --no-resave-data * checking for file 'C:\Users\alewit\AppData\Local\Temp\RtmpYHOfgM\devtools138845a711f6\lme4-master/DESCRIPTION' ... OK * preparing 'lme4': * checking DESCRIPTION meta-information ... OK * cleaning src Warning in cleanup_pkg(pkgdir, Log) : unable to run 'make clean' in 'src' * installing the package to build vignettes Warning: running command '"C:/PROGRA~1/R/R-31~1.1/bin/x64/Rcmd.exe" INSTALL -l "C:\Users\alewit\AppData\Local\Temp\Rtmp2ppmfo\Rinst13c46423bb3" --no-multiarch "C:/Users/alewit/AppData/Local/Temp/Rtmp2ppmfo/Rbuild13c45c0e2b4e/lme4"' had status 1 ----------------------------------- * installing *source* package 'lme4' ... ** libs Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-31~1.1/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-31~1.1/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="lme4.dll" WIN=64 TCLBIN=64 OBJECTS="external.o glmFamily.o mcmcsamp.o optimizer.o predModule.o respModule.o"' had status 127 ERROR: compilation failed for package 'lme4' * removing 'C:/Users/alewit/AppData/Local/Temp/Rtmp2ppmfo/Rinst13c46423bb3/lme4' ----------------------------------- ERROR: package installation failed Error: Command failed (1)
I'm not sure what's going on here. Googling for "status 127" suggests that it's a pretty generic error code, so it doesn't give a lot of clues. Is it possible you're having permissions errors (hinted at by "unable to run 'make clean' in 'src'"? What happens if you try disabling vignette building using build_vignettes=FALSE in your install_github() ? Are you able to install other packages from github?
Alex Whitworth whitworth.alex at gmail.com (c) 828.429.7478 On Thu, Aug 28, 2014 at 4:13 PM, Ben Bolker <bbolker at gmail.com> wrote:
On 14-08-28 06:46 PM, Alex Whitworth wrote:
Dr. Bolker, Could you please take a look at the function I have posted on StackOverflow <
? I believe that it is working correctly and would appreciate your
review.
Thanks, Alex Whitworth whitworth.alex at gmail.com <mailto:whitworth.alex at gmail.com>
I saw that. I will look at it if I have a chance. I am simultaneously impressed by your incentive and ability to solve your own problems and a little bit frustrated at our inability to communicate very effectively: I think your problems could probably be fixed by a fairly minor adjustment to predict.merMod , which is likely better tested and handles a wider range of cases. On the other hand, if you needed the solution right away ... ( a workaround that occurred to me would be to make predictions on an augmented set of new data that included all of the factor levels, then throw away the ones you don't want). If you want to test your function thoroughly, you can try the tests outlined in https://github.com/lme4/lme4/blob/master/tests/predsim.R https://github.com/lme4/lme4/blob/master/inst/tests/test-methods.R (search in this one for context("predict")) By the way, getting standard errors of predictions that account properly for uncertainty in the random-effects parameters is (alas) a considerably harder problem ... cheers Ben Bolker