Skip to content

Instantly share code, notes, and snippets.

@hiramekun
Created May 12, 2018 06:15
Show Gist options
  • Save hiramekun/c979e29598c093ab71d761081ebc657f to your computer and use it in GitHub Desktop.
Save hiramekun/c979e29598c093ab71d761081ebc657f to your computer and use it in GitHub Desktop.
一般化線形モデルの実行方法
library(glmmML)
d = read.csv("data.csv")
summary(d)
glmmML(cbind(y, N - y) ~ x,
data = d,
family = binomial,
cluster = id)
@hiramekun
Copy link
Author

hiramekun commented May 12, 2018

Output

       N           y              x           id        
 Min.   :8   Min.   :0.00   Min.   :2   Min.   :  1.00  
 1st Qu.:8   1st Qu.:1.00   1st Qu.:3   1st Qu.: 25.75  
 Median :8   Median :3.00   Median :4   Median : 50.50  
 Mean   :8   Mean   :3.81   Mean   :4   Mean   : 50.50  
 3rd Qu.:8   3rd Qu.:7.00   3rd Qu.:5   3rd Qu.: 75.25  
 Max.   :8   Max.   :8.00   Max.   :6   Max.   :100.00  

Call:  glmmML(formula = cbind(y, N - y) ~ x, family = binomial, data = d,      cluster = id) 


              coef se(coef)      z Pr(>|z|)
(Intercept) -4.190   0.8777 -4.774 1.81e-06
x            1.005   0.2075  4.843 1.28e-06

Scale parameter in mixing distribution:  2.408 gaussian 
Std. Error:                              0.2202 

        LR p-value for H_0: sigma = 0:  2.136e-55 

Residual deviance: 269.4 on 97 degrees of freedom 	AIC: 275.4 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment