Hello! I am testing a method in a simulation study and I would like to test this method when the outcome variable is negatively skewed. This outcome must be predicted by baseline covariates (x1,...,x4).
In the situation where the outcome is normally distributed, my model for the outcome looks like this:
My question is how can I code y so that it is a negatively skewed variable, but is still conditional on covariates and in such a way that I can change the coefficients?
I would like the resulting y variable to resemble a variable that would be created if I was to use the -rbeta- command, only that I use existing variables to create that distribution instead.
In the situation where the outcome is normally distributed, my model for the outcome looks like this:
Code:
set obs 300
gen x1 = 10*rnormal(0, 1)
gen x2 = rnormal(0, 1)
gen x3 = rnormal(0, 1)
gen x4 = rnormal(0, 1)
gen u1 = rnormal(0, 1)
scalar a1 = .4 //Coefficent for x1
scalar a2 = -.4 //Coefficient for x2
scalar a3 = -.4 //Coefficent for x3
scalar a4 = .4 //Coefficent for x4
scalar a5 = 0.1 //Coefficient for u1
scalar a_sd = sqrt(1-(a1^2)-(a2^2)-(a3^2)-(a4^2)-(a5^2)) //Standard Deviation of error term
gen e_y = rnormal(0,a_sd) //Generate error
gen y = a1*x1 + a2*x2 + a3*x3 + a4*x4 + a5*u1 + e_y
I would like the resulting y variable to resemble a variable that would be created if I was to use the -rbeta- command, only that I use existing variables to create that distribution instead.
Code:
gen y = rbeta(6,1)

Comment