'What is the R equivalent to the e(sample) command in Stata?
I'm running conditional logistic regression models in R as part of a discordant sibling pair analysis and I need to isolate the total n for each model. Also, I need to isolate the number and % of cases of the disease in the exposed and unexposed groups.
In Stata the e(sample) == 1 command gives this info. Is there an equivalent function for accomplishing this in R?
Solution 1:[1]
In R, if you run a regression you create a regression object.
RegOb <- lm(y ~ x1 + x2, data)
Often people call "RegOb" which uses the internal "print" method of this type of object. Alternative "summary(RegOb)" is popular (and often people would assign this).
However, RegOb contains many information about the regression. So in Stata you could use -ereturn list- to see what is saved. In R I would recommend to use "str(RegOb)" or "View(RegOb)" you will see everything that is saved. I have forgotten the correct syntax atm, but it will be something like: RegOb$data
And since you have the original data, you can simply use a logical statement based on the original and the used data which will give you the estimation sample.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | RandomRUser |
