Dataset_info/cbpp

cbpp 데이터셋 예제

modernity4Rcmdr 2022. 7. 1. 10:22

lme4::cbpp()

## response as a matrix
(m1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
             family = binomial, data = cbpp))
## response as a vector of probabilities and usage of argument "weights"
m1p <- glmer(incidence / size ~ period + (1 | herd), weights = size,
             family = binomial, data = cbpp)
## Confirm that these are equivalent:
stopifnot(all.equal(fixef(m1), fixef(m1p), tolerance = 1e-5),
          all.equal(ranef(m1), ranef(m1p), tolerance = 1e-5))


## GLMM with individual-level variability (accounting for overdispersion)
cbpp$obs <- 1:nrow(cbpp)
(m2 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd) +  (1|obs),
              family = binomial, data = cbpp))

Linux 사례 (MX 21)

m1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
             family = binomial, data = cbpp)
summary(m1)
Anova(m1)

Linux 사례 (MX 21) - R Markdown
Linux 사례 (MX 21)

m1p <- glmer(incidence / size ~ period + (1 | herd), weights = size,
             family = binomial, data = cbpp)
summary(m1p)
Anova(m1p)

Linux 사례 (MX 21) - R Markdown
Linux 사례 (MX 21)

## GLMM with individual-level variability (accounting for overdispersion)
cbpp$obs <- 1:nrow(cbpp)
m2 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd) +  (1|obs),
              family = binomial, data = cbpp)
summary(m2)
Anova(m2)

anova(m1, m2)

Linux 사례 (MX 21) - R Markdown
Linux 사례 (MX 21)


?cbpp  # lme4 패키지의 cbpp 도움말 보기

https://rcmdr.tistory.com/240

 

cbpp 데이터셋

lme4::cbpp() data(cbpp, package="lme4") '도구 > 패키지 적재하기...' 메뉴 기능을 선택하고 lme4 패키지를 찾아서 선택한다. 그리고 '데이터 > 패키지에 있는 데이터 > 첨부된 패키지에서 데이터셋 읽기...'

rcmdr.kr