lsmeans for mixed model in R [🇷 for BE/BA]
Dear Helmut and Elmaestro,
I also tried some other methods. I used two R packages lsmeans and lmerTest to do analysis of mixed model first.
if I used lmerTest (also required package pbkrtest),
If I used lsmeans package, I got
Original results from bear are
Both lsmeans and lmerTest only work with lmer(), not lme(). What do you think about these results? I'm
.
Ref. link: detlew's The SAS way in Rrrr land
I also tried some other methods. I used two R packages lsmeans and lmerTest to do analysis of mixed model first.
if I used lmerTest (also required package pbkrtest),
modlnCmax<-lmer(log(Cmax) ~ seq + prd + drug + (1|subj), data=TotalData, REML=TRUE)
lsm_lnCmax<-lsmeans(modlnCmax,test.effs="drug") ### for lmerTest, or
lsm_lnCmax<-lsmeans(modlnCmax,"drug") ### for lsmeans
I got the results asLeast Squares Means table:
seq prd drug Estimate Standard Error DF t-value Lower CI Upper CI p-value
drug 1 NA NA 1.0 7.3633 0.0273 19.4 270 7.31 7.42 <2e-16 ***
drug 2 NA NA 2.0 7.4098 0.0273 19.4 272 7.35 7.47 <2e-16 ***
If I used lsmeans package, I got
drug lsmean SE df lower.CL upper.CL
1 7.363255 0.02726719 19.38 7.306260 7.420250
2 7.409809 0.02726719 19.38 7.352813 7.466804
Results are averaged over the levels of: seq, prd
Confidence level used: 0.95
Original results from bear are
summary Test Ref Ratio
1 LSMEAN 7.411 7.365 1.006
2 S.D. 0.106 0.120 0.020
3 C.V(%) 1.424 1.633 1.992
Both lsmeans and lmerTest only work with lmer(), not lme(). What do you think about these results? I'm

Ref. link: detlew's The SAS way in Rrrr land
❝ ...
❝ R T
❝ Method A (EMA, subjects fixed) 7.328141 7.391880
❝ Method B (EMA, subjects random) 7.328141 7.391880
❝ Method C (FDA = mixed efects) 7.328141 7.391880
❝ Marginal means (Gnumeric) 7.328141 7.391880
❝ So why do we get…
❝ bear 7.356274 7.420013
❝ … which are ~3.8% higher for both treatments? No, I’m not satisfied if only the PE agrees – I expect to get a nasty surprise once we start to deal with unbalanced data.
—
All the best,
-- Yung-jin Lee
bear v2.9.2:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
All the best,
-- Yung-jin Lee
bear v2.9.2:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here

Complete thread:
- Reproducing Bear results in Phoenix mittyri 2015-04-14 08:35
- Bug in bear? Helmut 2015-04-14 14:07
- Bug in bear? mittyri 2015-04-14 20:43
- Bug in bear? Helmut 2015-04-15 02:17
- use the same dataset? yjlee168 2015-04-20 10:13
- Bug in bear? mittyri 2015-04-14 20:43
- Bugs in bear with replicated demo data set? yjlee168 2015-04-15 09:38
- Bugs fixed in bear? yjlee168 2015-04-17 01:21
- Bugs fixed in bear? Helmut 2015-04-17 14:25
- Bugs fixed in bear? yjlee168 2015-04-17 18:50
- Bugs fixed in bear? ElMaestro 2015-04-17 23:14
- lme() in bear yjlee168 2015-04-18 11:12
- lme() in bear ElMaestro 2015-04-18 11:28
- lme() in bear yjlee168 2015-04-18 12:02
- lme() in bear ElMaestro 2015-04-18 13:42
- Mean means Helmut 2015-04-18 14:08
- Mean means ElMaestro 2015-04-18 16:01
- Mean means Helmut 2015-04-19 00:59
- Mean means ElMaestro 2015-04-19 09:14
- LL and AIC Helmut 2015-04-19 11:08
- Confused ElMaestro 2015-04-19 11:42
- LL and AIC Helmut 2015-04-19 11:08
- lsmeans for mixed model in Ryjlee168 2015-04-19 23:36
- lsmeans() & lme() Helmut 2015-04-20 01:28
- lsmeans() & lme() yjlee168 2015-04-20 10:23
- lsmeans() & lme() ElMaestro 2015-04-20 10:35
- keep it simple! Helmut 2015-04-20 14:34
- keep it simple! ElMaestro 2015-04-20 15:39
- ML vs. REML Helmut 2015-04-20 16:35
- keep it simple! ElMaestro 2015-04-20 15:39
- keep it simple! Helmut 2015-04-20 14:34
- lsmeans() & lme() Helmut 2015-04-20 01:28
- Mean means ElMaestro 2015-04-19 09:14
- Mean means Helmut 2015-04-19 00:59
- Mean means ElMaestro 2015-04-18 16:01
- Mean means Helmut 2015-04-18 14:08
- lme() in bear ElMaestro 2015-04-18 13:42
- lme() in bear yjlee168 2015-04-18 12:02
- lme() with NA in R yjlee168 2015-04-19 23:44
- lme() in bear ElMaestro 2015-04-18 11:28
- lme() in bear yjlee168 2015-04-18 11:12
- Dataset Helmut 2015-04-18 13:30
- Dataset and lme() in bear yjlee168 2015-04-18 23:14
- Bugs fixed in bear? ElMaestro 2015-04-17 23:14
- Bugs fixed in bear? yjlee168 2015-04-17 18:50
- Bugs fixed in bear? Helmut 2015-04-17 14:25
- Bug in bear? Helmut 2015-04-14 14:07