drawing data from a skew normal distribution using the sn package in R

2.7k views Asked by At

I need to characterize the location, shape, and scale of a skew normal distribution of data, and then use these parameters to draw values randomly from a skew-normal distribution with the same parameters. In the past I did this using the sn package in R. So, for example, if I had a vector of data, v, that follows a skew-normal distribution, I would estimate the location, shape and scale using the sn.em function:

require(sn)
data(ais)
v <- ais$Fe
sn.em(,v)

I would then draw randomly from a skew-normal dsitrubtion with the same parameters using the rsnorm function:

rsnorm(100, shape = x, location = y, scale = z)

Both of these functions no longer exist in the sn package. How can I do this with either different functions in the sn package or a different pacakge all together?

1

There are 1 answers

0
zizaozi On BEST ANSWER

Use sn.mple() function in "sn" package. For your example, you may use

cp.est <- sn.mple(y=v,opt.method = "nlminb")$cp 
dp.est <- cp2dp(cp.est,family="SN")
dp.est
       xi     omega     alpha 
20.244158 73.840301  9.142412 

To draw a sample from SN distribution, use rsn() function in the same package. For instance,

rsn(n=100, xi=20.24, omega=73.84, alpha=9.14)