So my professor is asking us to produce some data from a experimental paper to do power analysis. So we want to generate a variable that has mean of 60 and std of 26.141, but have range from 0 to 100. So every time we use rnormal(60,26.141) will always contain outliers. So one method I think could work is redraw the outliers until they are in the range. But I don't know how to write the argument in loop so that if the condition not satisfied (have outliers) redo the process. This is what I got so far:
Code:
clear all set obs 97 g coop_mixed =. foreach i in coop_mixed { replace coop_mixed = rnormal(60,26.141) replace coop_mixed=rnormal(60,26.141) if coop_mixed <0 replace coop_mixed=rnormal(60,26.141) if coop_mixed >100 }
Comment