[R] Problem with reproducing log likelihood estimated with ghyp package

Steinar steinar.veka at gmail.com
Sat Dec 17 10:57:55 CET 2011


I was playing around with the ghyp package and simulated series of
t-distributed variables when suddenly i was not able to reproduce the log
likelihood values reported by the package. When trying to reproduce the
likelihood values, I summed the log(dt(x,v)) values and it worked with some
simulated series but not all. 

Is there any obvious flaws with this script?

library("ghyp")
series_1=rt(10000,4) 

#simulating 10000 relation of student t variables with df=4
#Which implies a standrad deviation equal to sqrt(2)

series_2=series_1/sqrt(2)*5 

#To get student t distributed variabler with standard
#deviation equal to 5 I rescale the first series

#When i check the first series with the ghyp package, the result coincides
with
#the sum of log likelihood calculated with dt(x, df, ncp, log = FALSE)

fit_1=fit.tuv(series_1, silent=T, symmetric=T)
fit_1
sum(log(dt(series_1,coef(fit_1)$nu,0)))

#The two log likelihood estimates is approximatly equal, and the parameters
are 
#sensible. 

#When I check series 2, i get a very different result. The estimate for mu
and nu 
#is still sensible, but the log likelihood is very different from what i get
with 
#dt(x, df, ncp, log = FALSE)

fit_2=fit.tuv(series_2, silent=T, symmetric=T)
fit_2
sum(log(dt(series_2,coef(fit_2)$nu,0)))

#This is very different



--
View this message in context: http://r.789695.n4.nabble.com/Problem-with-reproducing-log-likelihood-estimated-with-ghyp-package-tp4207833p4207833.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list