I have a dataset (N=300) from a study where participants were randomly allocated to 2 different teaching approaches. At the end of the study, they are meant to sit a test that they can either pass or fail; however, 10% did not attend the test. Of those who attend, the pass rate is 61% and I would like to, using this pass rate, estimate the N who would have passed amongst the ones who were a no show.
Having found some resources online - https://www.stata.com/support/faqs/s...andom-samples/ - I had a go at estimating pass rate for non-attenders in the dataset and would like to check the code appears correct to more advanced users:
g ok = noshow==1 //sets a 1 for those who did not attend
set seed 94523
g randu = runiform()
set ok randu
capture drop insample
bysort ok: g insample = (_N-_n)<30*.61 if ok==1 //creates a variable with 1 for those 30 who did not attend but would have passed based on pass rates in attenders
g pass_estimate = insample
I opted for using 61% across both intervention groups, although I guess a question is whether I should estimate the pas rate in each intervention arm and apply this separately to each arm?
Related Posts with Estimate for random subgroup
replacing values of newly generated string variable if old string variable contains certain charactersHello, I have a string variable called relationship that describes the relationship between 2 peopl…
Using postfile with xtregHi guys, I would like to perform a regression within a loop and store the results in excel. Ideally…
How I can egen a variable to capture the sum value of numbers in the different columnsDear Stata users, I am working on a dataset with many dummy variables. What I want to achieve is eg…
Web scarping errorHello all, I downloaded the command nba2stata to get data from this website to STATA. However when …
Error specifying multiple quantilesI am trying to run quantile regression with clustered standard errors. I would like to run .25, .5 .…
Subscribe to:
Post Comments (Atom)
0 Response to Estimate for random subgroup
Post a Comment