Reputation: 2666
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?
Upvotes: 2
Views: 2958
Reputation: 56
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)
Upvotes: 4