* the program below (begins with the “program” command) * takes the desired sample size "n" as the sole argument clear all program define regprg args n drop _all set obs `n' * use a skewed version of the gamma distribution to * generate an error variable – the 2 arguments to the rgamma() * function are the shape & scale parameters, respectively gen r = rgamma(1,0.1) * center the errors to have approximately zero mean * (Note: the mean for the gamma = shape * scale) replace r = r-0.1 * generate a binary predictor with approx. equal groups gen x = rbinomial(1,0.5) * generate the outcome using slope (intercept) of 2 (1) gen y = 1 + x*2 + r * fit model reg y x end