[R] Logistic regression R and Stata grouping variable
Therneau, Terry M., Ph.D.
therneau at mayo.edu
Wed May 27 15:02:26 CEST 2015
You were not completely clear, but it appears that you have data where each subject has
results from 8 "trials", as a pair of variables is changed. If that is correct, then you
want to have a variance that corrects for the repeated measures. In R the glm command
handles the simple case but not the repeated measures one. Statisticially you can use a
generalized estimating equations approach (package "gee") or a random effect per subject
approach (lme or lmer package).
Terry T.
On 05/27/2015 05:00 AM, r-help-request at r-project.org wrote:
> I mostly use Stata 13 for my regression analysis. I want to conduct a logistic regression on a proportion/number of success. Because I receive errors in Stata I did not expect nor understand (if there are Stata experts who want to know more about the problems I face and can potentially help me solve them, I would be glad to give more details), I want to repeat the analysis in R. In Stata I would use the command: xtlogit DEP_PROP INDEP_A INDEP_B INDEP_C, i(ID). ID is the identifier for each subject. There are eight lines with data for each subject because there are three within factors (INDEP_A, B, C) with two levels each (0 and 1). I can repeat this analysis in R by using the command: glm(DEP_SUC ~ INDEP_A + INDEP_B + INDEP_C, family = ?binomial?). DEP_SUC is here a table with the successes and misses per row. Again, there are eight rows for each subject. But while I know how to group these lines in Stata by using the option i(ID ), I do not know what to do in R. I have sear!
> ch for more information about the i() command, but did not find any usefull information.
>
> So, to summarize: I want to find out how three variables (binary) influence a proportion and use logistic regression. In Stata I can group multiple lines per subject using the i( ) command in logistic regression. What is the equivalent in R?
>
> Thank you in advance!
More information about the R-help
mailing list