
hi!

i've tried to run this code in R using the VGAM package.   I know it's not a good fit.   But i encountered a problem in calling the estimated parameter values using fit$estimate.  But the codes worked if i put the estimated values just like in this case:

y.l <- dgpd(x, scale=0.979421685 , shape=-0.003183445 )

But not in this one:
y.g <- dgpd(x, scale=fit$estimate[1], shape=fit$estimate[2])


Can anyone help me how to call out the estimated parameters automatically
instead of writing each of the estimated values?  So i can use them in future graphing.  I know this will cause a big problem if i'll keep on changing my data. Further, it will be a time constraint problem if i'll fit distributions to data using many VGAM  distributions.  Please see the R code below for reference.

Thank you for the help!
 


Filame



----------------------------------------------------------------------------------------------------

library(VGAM)

z<-rgamma(10000,rate=1, shape=1)
fit <- vglm(z~1, gpd(threshold=0),trace=TRUE)
coef(fit, mat=TRUE)
Coef(fit)

x<-seq(from=0, to=40, by=1)
y.l <- dgpd(x, scale=0.979421685 , shape=-0.003183445 )
truehist(z)
lines(x, y.l, col=2)

y.g <- dgpd(x, scale=fit$estimate[1], shape=fit$estimate[2])
truehist(z)
lines(x, y.g, col=2)

ERROR:
Error in dgpd(x, scale = fit$estimate[1], shape = fit$estimate[2]) : 
        "scale" must be positive
In addition: Warning message:
$ operator not defined for this S4 class, returning NULL in: fit$estimate 


--------------------------------------------------------------------------------------------------------
       
---------------------------------

	[[alternative HTML version deleted]]

