How to use lme4.0 with lmerTest? - r

I am wondering if anyone has faced this issue before. I use the package lmerTest to run mixed-effects models in R because it has a handy way of providing p-values. This package by default loads the most current version of the lme4 package. However, the lme4 current version has some issues and it sometimes doesn't converge, so the lme4 developers have made available a new package (named lme4.0), which is a bugfix-only version of the old pre-1.0 lme4. This works great, and the models usually converge, so that is what I use to analyze my data.
I would like to have lmerTest but have it load lme4.0 instead of the current version of lme4.Does anyone know how to achieve this?
Thanks for your help!

This isn't really feasible without serious hacking: essentially, take an older version of lmerTest, download the source, hack it to look for lme4.0 rather than lme4, and install locally. Or download (from the CRAN archives) and install older versions of lme4 and lmerTest (and pbkrtest: maintaining an archaic setup will get progressively more difficult, and you will have to backport or forego bug fixes as they appear in newer versions).
Since many of the problems with new lme4 have been cleaned up with the switch in default optimizers from Nelder-Mead to BOBYQA, my advice would be to run a range of comparisons between lme4.0 and lme4, convince yourself that there are no problems (and send information about persistent problems to the lme4 maintainers, who would greatly appreciate it!), and move on to the new version.

Related

Trouble setting up R, OpenMP and glmmTMB

I am looking at a couple of complex models that seem to need a lot of computational power. I am currently using the R package "glmmTMB" to account for spatio-temporal autocorrelation and random effects. In theory, glmmTMB should be able to run much faster using parallelization: https://cran.r-project.org/web/packages/glmmTMB/vignettes/parallel.html
If your OS supports OpenMP parallelization and R was installed using
OpenMP, glmmTMB will automatically pick up the OpenMP flags from R’s
Makevars and compile the C++ model with OpenMP support. If the flag is
not available, then the model will be compiled with serial
optimization only.
Instead of running these models on my personal maschine, I decided to set up a virtual maschine in a HPC environment. How can I install R using OpenMP on Ubuntu 20.04? I couldn't find anything on this topic.

Whether the relevant robust optimization model can be established without using JuMPeR

Since the existing JuMPeR can no longer adapt to the latest JuMP and Julia versions, and the version of the documentation is so backward that the experience of writing code is so bad that even many examples don't run smoothly, I wonder if there is an alternative package for robust optimization.
The same package has DDUS, which provides a data-driven set of uncertainties for the JuMPeR framework, but this package cannot be installed at this time.
Finally, well, if there are really no packages available, I want to know which older version of Julia can solve my problem if it can adapt to the Julia version of the JuMPeR and DDUS packages.

Installing, Loading Packages & Verifying these actions. Path, Lib, Dependencies, etc

This is one of the more comprehensive threads and discussions on these topics I have located to date.
How to find out which package version is loaded in R?
Nonetheless, I am finding this has not provided me with sufficient information to ensure I have installed and loaded the two packages I must have before I can begin to expect R to function properly. These packages are: Rserve (1.8-0) and MASS (7.3-45).
It seems answers to these topics can be application dependent or, perhaps purpose driven is a better phrase to use. Unfortunately, the R documentation will confuse you so, I thought it best to solicit the input of more experienced users.
I am working on a personal laptop with R 3.5.1 and Win7 Pro. It is clear from the r documentation that Windows is not the best or preferred environment for R.
despite a lot of work something remains missing and I have been unable to identify what it is.

Alternatives to the packrat package - package reproducibility

Packrat is a neat tool in theory, but for years it has been plagued by huge hang times upon starting RStudio, and the devs don't seem to be able to fix the issue. It's become unsustainable in my project. Does anybody have any good alternatives to packrat? Google searches did not turn up anything useful, so any help would be greatly appreciated.
I'll assume you're using Packrat for reproducibility, rather than version control.
Start with the CRAN task view for reproducible research , specifically the section on Package Reproducibility. You'll find it suggests checkpoint, rbundler and packrat.
Another approach is to move from Base R to Microsoft R open. It has reproducibility built in.
Side Note: As an example use case of reproducibility, let's assume you've written some R code with packages. Then you share your research. But the package owner makes a change between the time you did the research and the time someone else is trying to reproduce your research. The change made by the package owner breaks your research. In order for someone to reproduce your research, they need to use your code WITH THE ORIGINAL PACKAGE - not the new package.
{renv} is developed by the RStudio folks and aims to solve at least some of the problems that packrat had: https://blog.rstudio.com/2019/11/06/renv-project-environments-for-r/
"The goal then is for renv to be a robust, stable replacement for the Packrat package, with fewer surprises and better default behaviors."

Using feature hashing/hashing tricks for machine learning in R

I just learned about feature hashing (also known as the hashing trick) and that some see it as an important feature for efficiently doing machine learning on large data sets.
However, I haven't seen anything like this being used for machine learning with R.
A Google search revealed that there is indeed a package hash on CRAN.
Could someone provide an example where this is used in R to speed up a machine learning task (or just to reduce RAM usage)?
I submit a package named FeatureHashing recently. Please check the github page for demo: https://github.com/wush978/FeatureHashing and let me know if you have any issue of using it.

Resources