[R] fitting distributions

Kahra Hannu kahra at mpsgr.it
Thu Aug 5 15:20:49 CEST 2004


>I also try to fit a skewed distribution (like skewed student t) to data
>points. Do you have an idee howto do this???

library(skewt)

y <- rskt(500,2,2) # simulate 500 observations from the skew t distribution with df=2 and gamma=2

skewtmle <- function(df,gamma){
return(-sum(log(dskt(y, df, gamma))))
}

fit <- mle(skewtmle,start=list(df=1,gamma=3),method="L-BFGS-B",lower=c(1e-8,-Inf))
summary(fit)
logLik(fit)
vcov(fit)
plot(profile(fit), absVal=F)
confint(fit)

Hannu Kahra 
Progetti Speciali 
Monte Paschi Asset Management SGR S.p.A. 
Via San Vittore, 37 - 20123 Milano, Italia




More information about the R-help mailing list