Comments (4)
Thanks for reporting this!
Regarding issue 1
I can't reproduce this behavior. In the example below, the results are exactly the same. Generally, smaller differences can occur between nlme
and lme4
, but these are usually very small. Can you send me a specific example that I can use to reproduce this (e.g., via email)?
library(mitml)
library(lme4)
library(nlme)
data(studentratings)
# impute
imp <- panImpute(formula = ReadDis + ReadAchiev ~ 1 + (1|ID), data = studentratings, seed = 1234)
implist <- mitmlComplete(imp)
# fit models
fit1 <- with(implist, lmer(ReadDis ~ ReadAchiev + (1|ID)))
fit2 <- with(implist, lme(fixed = ReadDis ~ ReadAchiev, random = ~ 1 | ID,
data = data.frame(ReadDis, ReadAchiev, ID)))
# results as in output
testEstimates(fit1)
# Estimate Std.Error t.value df P(>|t|) RIV FMI
# (Intercept) 3.549 0.144 24.563 626.039 0.000 0.136 0.123
# ReadAchiev -0.002 0.000 -7.105 998.386 0.000 0.105 0.097
testEstimates(fit2)
# Estimate Std.Error t.value df P(>|t|) RIV FMI
# (Intercept) 3.549 0.144 24.563 626.039 0.000 0.136 0.123
# ReadAchiev -0.002 0.000 -7.105 998.385 0.000 0.105 0.097
# results with higher precision
testEstimates(fit1)$estimates
# Estimate Std.Error t.value df P(>|t|) RIV FMI
# (Intercept) 3.548747357 0.1444768667 24.562738 626.0392 0.000000e+00 0.1362350 0.12269860
# ReadAchiev -0.001957248 0.0002754753 -7.104983 998.3855 2.286393e-12 0.1049052 0.09675261
testEstimates(fit2)$estimates
# Estimate Std.Error t.value df P(>|t|) RIV FMI
# (Intercept) 3.548747357 0.1444768668 24.562738 626.0392 0.000000e+00 0.1362350 0.12269860
# ReadAchiev -0.001957248 0.0002754753 -7.104983 998.3855 2.286393e-12 0.1049052 0.09675261
# R²
multilevelR2(fit1)
# RB1 RB2 SB MVP
# 0.06090104 0.19417320 0.08411631 0.06834806
multilevelR2(fit2)
# RB1 RB2 SB MVP
# 0.06090105 0.19417318 0.08411631 0.06834806
Regarding issue 2
The error message indicates that the class attribute of the fitted models is changed from nlme
to something else. This can happen, for example, when using the lmerTest
package, which overrides many functions in lme4
. Do you use any additional packages that may cause this?
At the present time, lmerTest
is not supported by mitml
. Therefore, the only workaround is to fit the models without loading lmerTest
.
from mitml.
from mitml.
Thanks for the additional information. Unfortunately, I still can't reproduce this behavior. For example, with the studentratings
data set provided with mitml
(see below), the results are all fine (tested on Linux and Windows with the most recent versions of R and all relevant packages).
I would like to investigate this further, but I need a reproducible example that shows this behavior. Could you provide me with (1) a reproducible example with both data and code, and (2) the output of your sessionInfo()
after running that example? You can send them to my email address listed here.
library(mitml)
library(lme4)
library(nlme)
data(studentratings)
studentratings <- na.omit(studentratings[,c("ID","ReadDis","ReadAchiev")])
# fit models
fit1 <- lmer(ReadDis ~ ReadAchiev + (1|ID), data = studentratings)
fit1.1 <- lmer(ReadDis ~ ReadAchiev + (1|studentratings$ID), data = studentratings)
fit2 <- lme(fixed = ReadDis ~ ReadAchiev, random = ~ 1|ID, data = studentratings)
# R²
multilevelR2(fit1)
# RB1 RB2 SB MVP
# 0.06224511 0.21019639 0.08648722 0.07231612
multilevelR2(fit1.1)
# RB1 RB2 SB MVP
# 0.06224511 0.21019639 0.08648722 0.07231612
mitml:::.getRsquared(fit2, print=c("RB1", "RB2", "SB", "MVP"), method="nlme")
# RB1 RB2 SB MVP
# 0.06224532 0.21019331 0.08648691 0.07231607
from mitml.
Closing this for now, because the problem is still not reproducible with no more response.
from mitml.
Related Issues (20)
- Error in mitmlComplete() with single missing value in categorical variables
- Obtaining confidence intervals after multilevel model HOT 1
- Print testEstimates to more than 3 decimal places HOT 3
- feature request: mitml.list2mids and mids2mitml HOT 2
- feature request: estimated marginal means HOT 1
- D4 test for geneal linear models fitted with `nlme::gls()` HOT 2
- Error when viewing output from testEstimates function HOT 2
- Cannot change to mids object. HOT 2
- `tidy` and `glance` methods HOT 2
- fixed-effect estimate p-values in testEstimates() are from one-sided tests HOT 2
- glmmTMB: Error when pooling models HOT 3
- Parallel computation of multiple imputations by using mitml HOT 2
- Potential scale reduction (Rhat, imputation phase) - What does psi implies? HOT 2
- mitml package HOT 1
- Error message with spatial regression (spml) HOT 2
- Error in testModels (Error in solve.default(Ubar) : 'a' is 0-diml) HOT 2
- anova doesn't works with coxph function HOT 7
- Obtain original row order in the imputed data HOT 2
- `jomoImpute` removes `.Random.seed` HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mitml.