I have to create 2 variables
the first one is a random variable (e1) between 1-17
the second is a variable (e2) between 1-17 and with probability of 0.8.
But the condition of the second variable have to be < of e1
gen e1 = 0+int((17-0+1) * runiform())
gen e2 = rbinomial(16, 0.8)<e1
but e2 give me only 0 and 1
Thanks
Related Posts with Create a new variable with random probability and with probability
trade structural gravity equation; instruments; ppmlhdfeI work with trade data: 75 importers, 75 exporters; 2004-2018 period, six-digit HS Industries (5219)…
Choosing a control condition in Interrupted time seriesDear colleagues how can I choose the best control condition in Interrupted time-series among the pos…
Clustering standard errorsI have a cross-sectional dataset at the firm level, and my interest variable (RHS) is a country-leve…
date conversionA bit new to Stata. Wondered if someone could tell me how to convert a date variable from an externa…
Error of sample contain multiple panels: Panel data with multiple identifiersI am attempting to obtain the autocorrelations and partial autocorrelations and to perform the Dicke…
Subscribe to:
Post Comments (Atom)
0 Response to Create a new variable with random probability and with probability
Post a Comment