I am drawing a random sample (1/3) form a data set to predict an outcome variable using a probit regression.
Second, I am trying to use the estimated coefficients to predict the same outcome variable for the remaining observations(2/3).
Here, I've been having issues to only use the remaining observations instead of generating another random sample that would then also include observations from the first sample.
After having predicted the outcome variables of the second sample, it has to be divided at the median whereby the above median observations and below median observations will be allocated a dummy variable.
sample 33.333
dprobit call....
estimates store dprobit
predict callpredicted
summarize callpredicted, detail
egen p50=pctile(callpredicted)
restore
sum callpredicted if callpredicted<p50
sum callpredicted if callpredicted>p50
Thank you.
Related Posts with How do I draw two samples from dataset?
Sample ExtractionDear All, I have a panel monthly dataset (id and month), from 2001 - 2018, and I need 10 year (120 …
Is there an 'or' function when coding variables?I am coding a binary variable (done) to denote if a diagnostic test was done, 1=yes, 0=no. I want i…
Duplicating previous year data Code: +----------------------------------------+ | country year dbagdp pcrdbgd…
Comparing 3 correlation coefficientsI have a group of about 1300 patients who had had disease 1 (subgroup 1), disease 2 (subgroup 2), or…
Word cloud and sentiment analysis using StataDear Stata Forum members, I wish to find a user-written program to perform high quality "word clou…
Subscribe to:
Post Comments (Atom)
0 Response to How do I draw two samples from dataset?
Post a Comment