The problem is that the output always shows a little or above it. For example, there are 10000 observations. I don't get exact 6000 observations as 0 and 4000 observations as 1.
My code:
set obs 10000
gen a = uniform()
gen b = 0
replace b = 1 if a <= 0.40
What is wrong with this? Or is there any alternative?
Related Posts with How do you generate a categorical variable which takes on values 0 and 1 in 60% and 40% observations respectively?
r2 equals 0.00011 …
Data generation to simulate Wooldridge's (2005) approach for a dynamic non-linear modelI want to simulate Wooldridge's (2005) approach to estimate a dynamic non-linear model. I have quest…
BMI in BHPS, OLS and Probit modelI am using the British Household Panel Survey Data in order to find the effect of BMI on wages. I wi…
reghdfeHi Im using reghdfe regression bc i have a lot of fixed effects I will like to test my model for h…
IV EstimationHi. I instrument two endogenous variables ,x1 and x2 with z1 and z2 respectively and used the foll…
Subscribe to:
Post Comments (Atom)
0 Response to How do you generate a categorical variable which takes on values 0 and 1 in 60% and 40% observations respectively?
Post a Comment