r - Random variates from fMultivar doesn't match density function -
i trying use fmultivar package plot histogram of t distribution , show corresponding density function matches histogram.
the problem histogram doesn't seem match density function.
below minimal example.
library(fmultivar) n = 50000 qtile = seq(-5,5,by=0.05) xtt = rmvst(n,dim=1,df=3) hist(xtt,300,xlim=c(-5,5),probability=true) lines(qtile,dmvst(qtile,dim=1,df=3),col='red') xn = rmvsnorm(n,dim=1) hist(xn,300,xlim=c(-5,5),probability=true) lines(qtile,dmvsnorm(qtile,dim=1),col='red') xt = rt(n,df=3) hist(xt,300,xlim=c(-5,5),probability=true) lines(qtile,dt(qtile,df=3),col='red')
as clear, xtt doesn't match density function. xn , xt does.
am doing wrong here?
i unconvinced, @ least regarding whether random draws giving different distribution. histograms same , have looked @ qqplot
of 'xt' , 'xtt' on couple of runs , seem line satisfactorily. comparing density lines histograms suggest density estimates might off , when conduct examination agree there systematic discrepancy between density estimates:
plot( density(dt(qtile,df=3)- dmvst(qtile,dim=1,df=3) ) )
the distribution bimodal , dmvst densities systematically greater dt densities in tails. not see why t-distribution should match skew-t distribution, however. shouldn't comparing dst {in package: sn}? (this sort of question best posed package authors.)
Comments
Post a Comment