Skip to content

density estimation for d>2 for the DPpackage

1 message · rodrigo herrera

#
Dear List,

I am trying to estimate a 3 dimensional density through the DPpackage. 
For example

# model
sigma <- matrix(c(0.1,0.05,0.05,0.05,0.1,0.05,0.05,0.05,0.1), ncol=3)
rnormm<- rmvnorm(n=100, mean=c(5,100,150), sigma=sigma)
sigma2 <- matrix(c(10,0.05,0.05,0.05,10,0.05,0.05,0.05,10), ncol=3)
rnormm2<- rmvnorm(n=100, mean=c(20,1,110), sigma=sigma)
rnormm<-rbind(rnormm,rnormm2)

#with the following priors
  # Prior information
s2<-matrix(c(2,0,0,0,2,0,0,0,2),ncol=3)
m2<-c(5,10,15)
psiinv2<-solve(matrix(c(10000,0,0,0,1,0,0,0,2),ncol=3))
prior<-list(a0=1,b0=1/5,nu1=4,nu2=4,s2=s2,
m2=m2,psiinv2=psiinv2,tau1=0.01,tau2=0.01)



state <- NULL
# MCMC parameters
nburn<-1000
nsave<-5000
nskip<-10
ndisplay<-1000
mcmc <- list(nburn=nburn,nsave=nsave,nskip=nskip,ndisplay=ndisplay)
# Fit the model
fit3<-DPdensity(y=rnormm,mcmc=mcmc, prior=prior,
state=state,status=TRUE,na.action=na.omit)


All is fine untill I bacame...

MCMC scan 1000 of 5000 (CPU time: 32.125 s)
MCMC scan 2000 of 5000 (CPU time: 61.797 s)
MCMC scan 3000 of 5000 (CPU time: 91.281 s)
MCMC scan 4000 of 5000 (CPU time: 120.750 s)
MCMC scan 5000 of 5000 (CPU time: 150.047 s)
Error  in matrix(foo$f, nrow = ngrid, ncol = ngrid) : 
  Versuch ein Attribut von NULL zu setzen....



Some idea?
 Best regards,

rodrigo