I have an experiment where subjects reported multiple results (binary) in two treatments. I have compared each subject separately to see if the treatment had an effect on a given subject, but would also like to compare the data as a whole. I have gone with a Generalized Linear Mixed Effects Model (I have never done this type of analysis before).
I'm using the lme4 package in R and the glmer function, and I want to see the effect the treatment has on the results, so I have done the following:
model <- glmer(Response ~ Treatment + (Treatment|Subject), data=data, family=binomial(link=logit))
So the model puts the treatment as the fixed effect and takes into account the difference in the treatment for each subject as the random effect. I am then looking at the significance of the treatment in the model. Does that make sense or am I off my rocker?
Fixed Effects: Estimate Std. Error z value PR(>|z|) (Intercept) -1.5066 0.2466 -6.109 1e-09 *** Treatment -0.6620 0.2803 -2.362 0.0182* Random Effects: Groups Name Variance Std.Dev. Corr Subject (Intercept) 0.4085 0.6391 Treatment 0.002103 0.04585 -1.00