[R] density estimation for d>2 for the DPpackage

rodrigo herrera rherrera at gmx.net
Sat Feb 21 20:37:37 CET 2009


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
-- 
   Besuchen Sie meine Web Seite http://rodrigoherrera.blogspot.com/ Viel Spass beim Surfen

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   
Habe nun, ach! Philosophie, Juristerei, Theologie und Medizin und leider auch
Volkswirtschaft durchaus studiert, mit heißem Bemühn. Da steh' ich nun, ich armer Tor, und
bin so klug als wie zuvor! Heiße Magister, heiße Doktor gar, und ziehe schon and die zehen
Jahr' herauf, herab und quer und krumm meinen Schüler an der Nase herum
- Und sehe, daß wir nichts wissen können!
Das will mir schier das Herz verbrennen.

                                                  Aus dem Faust
                                      Johann Wolfgang von Goethe
                                                  1749 - 1832



Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL 
für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a




More information about the R-help mailing list