Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

r - Error - No tidy method for objects of class lmerMod

I am using a dataset from an online practice tutorial and the code can be found at the bottom of Page 4 (https://tomhouslay.files.wordpress.com/2017/02/indivvar_mv_tutorial_asreml.pdf)

In the tutorial, they get the function to work using the code listed below, but in my R session, I get an error that says:

No tidy method for objects of class lmerMod.

I have tried using the package "parsnip" as well as restarting my R session and I have tried requiring broom as suggested in other answers to similar questions.

The haggis practice csv file can be downloaded from here: https://figshare.com/articles/Haggis_data_behavioural_syndromes/4702540

library(asreml)
library(nadiv)
library(tidytext)
library(tidyverse)
library(broom)
require(broom)
library(lme4)
library(data.table)
library(parsnip)

HData<- read_csv("haggis practice.csv")

lmer_b <- lmer(boldness ~ scale(assay_rep, scale=FALSE) + 
                 scale(body_size) + 
                 (1|ID), 
               data = HData) 
plot(lmer_b) 
qqnorm(residuals(lmer_b)) 
hist(residuals(lmer_b)) 
summary(lmer_b)


rep_bold <- tidy(lmer_b, effects = "ran_pars", scales = "vcov") %>% 
  select(group, estimate) %>% 
  spread(group, estimate) %>% 
  mutate(repeatability = ID/(ID + Residual)) 
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Providing an answer (from the comments).

The tidy methods for multilevel/mixed-type models (e.g. from lme4, brms, MCMCglmm, ...) were moved to broom.mixed. You can either install/load the broom.mixed package, or use the broomExtra package, which is a "meta-package" that looks for methods in both broom and broom.mixed ...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...