2つのグループの学生の平均スコアを推定しようとしています。私は二項回帰モデルを使用しています。これtotal_ansは、回答した質問の合計であり、生徒によって異なる場合があります。
モデル1は直接推定
model <- glm(cbind(total_correct, total_ans-total_correct) ~ student_type,family= binomial, data = df)
Call:  glm(formula = cbind(total_correct, total_ans - total_correct) ~ student_type, family = binomial, data = df)
Coefficients:
                  (Intercept)  student_group_2  
                      -1.9684           0.2139  
Degrees of Freedom: 1552 Total (i.e. Null);  1551 Residual Null
Deviance:       1480  Residual Deviance: 1477   AIC: 1764
lsmeans(model,~ student_type, type="response")
 student_type           prob         SE df asymp.LCL asymp.UCL
 student_group_1   0.1225627 0.00654160 NA 0.1103074 0.1359715
 student_group_2   0.1474774 0.01275231 NA 0.1241918 0.1742602
モデル2では、ランダム効果を使用して、個々の分散をより適切に説明します。
model <- glmer(cbind(total_correct, total_ans-total_correct) ~ (1|student)  + student_type, family= binomial, data = sub_df, control=glmerControl(optimizer = "nloptwrap", calc.derivs = FALSE))
Generalized linear mixed model fit by maximum likelihood (Laplace
  Approximation) [glmerMod]
 Family: binomial  ( logit )
Formula: cbind(total_correct, total_ans - total_correct) ~ (1 | student) +  
    student_type
   Data: sub_df
      AIC       BIC    logLik  deviance  df.resid 
1653.9049 1669.9488 -823.9525 1647.9049      1550 
Random effects:
 Groups Name        Std.Dev.
 student (Intercept) 1.881   
Number of obs: 1553, groups:  author, 1553
Fixed Effects:
                  (Intercept)  student_group_2  
                      -3.0571   0.3915  
lsmeans(model,~ student_type, type="response")
 student_type            prob          SE df  asymp.LCL asymp.UCL
 student_group_1   0.04491007 0.004626728 NA 0.03666574 0.0549025
 student_group_2   0.06503249 0.015117905 NA 0.04097546 0.1017156
2つのグループの結果に大きな違いがあることに驚いています。これの理由は何でしょうか?
詳細:グループ1の生徒数は1434人、グループ2の生徒数は119人です。これらは自然発生的なグループです
emmeansます。構文はほとんど同じです。