2

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?

colin
  • 2,606
  • 4
  • 27
  • 57
  • perhaps the functions have been replaced / renamed : did you check the [reference manual at its cran page](https://cran.r-project.org/web/packages/sn/index.html) – user20650 Jan 04 '17 at 19:50
  • @user20650 no luck checking the reference manual. Doesn't seem to be documented anywhere. – colin Jan 04 '17 at 19:55
  • 1
    from a quick eyeball of manual, perhaps `rsn` (pg 20) and `selm` (pg45) – user20650 Jan 04 '17 at 19:57
  • @user20650 right on with the `rsn` function, though its not clear what output in `selm` corresponds to the location (`xi`), scale (`omega`) and slant (`alpha`) parameters required to run the `rsn` function. – colin Jan 04 '17 at 20:38
  • 1
    yes, not sure, i only saw selm as i noticed linear model & mle, which seems at a glance to be in the right ball park as [sn.em](https://artax.karlin.mff.cuni.cz/r-help/library/sn/html/sn.em.html). all i'd do is go through the manual to make sure sn.em has not been deprecated / replaced / improved and if not clear then email the maintainer to ask why the function was removed. (as you can generally load an older package version using old sources if you want to use the function) – user20650 Jan 04 '17 at 21:00
  • Colin, did you follow this up with the package maintainer ? – user20650 Jan 18 '17 at 23:34
  • @user20650 I didn't, still have not solved this problem either. Got tied up with other work. – colin Jan 20 '17 at 17:57

1 Answers1

4

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)
zizaozi
  • 56
  • 4