won't calculate predicted.p.value for LipCancerData example

37 views
Skip to first unread message

Alok Bohara

unread,
May 9, 2022, 3:18:10 PMMay 9
to R-inla discussion group
Hi I am trying to reproduce the results of the LIpCancerData to graph posterior p-value.
It gives me these errors:
Error in seq.default(xmin, xmax, len = n) :
  'from' must be a finite number
In addition: Warning messages:
1: In max(marginal[["y"]]) :
  no non-missing arguments to max; returning -Inf
2: In min(x, na.rm = na.rm) :
  no non-missing arguments to min; returning Inf
3: In max(x, na.rm = na.rm) :
  no non-missing arguments to max; returning -Inf
4: In min(m[["x"]]) : no non-missing arguments to min; returning Inf
5: In max(m[["x"]]) : no non-missing arguments to max; returning -Inf

The codes I am using are as follows:

formula.inla <- O ~ 1 + X + f(id,model="iid", hyper=list(prec=list(prior="loggamma",param=c(1,0.0001))))
lipcancer.poisson <- inla(formula.inla,family="poisson",
                            data=LipCancerData, offset=log(E),                      
                            control.predictor=list(link=1, compute=TRUE),
                            control.fixed=list(mean=0,prec=0.00001))
summary(lipcancer.poisson)


n<-length(LipCancerData[,1])

predicted.p.value <- c()
n <- length(LipCancerData[,1])
for(i in (1:56)) {
  predicted.p.value[i] <- inla.pmarginal(q=LipCancerData$O[i],
  marginal=lipcancer.poisson$marginals.fitted.values[[i]])
}


Alok

Alok Bohara

unread,
May 10, 2022, 12:01:18 AMMay 10
to R-inla discussion group
I did not see this in the book (Spatial and Spatio-temp ..)  but I added the following line 
  control.compute = list(dic = TRUE, waic = TRUE, cpo = TRUE, return.marginals.predictor=TRUE),  .. and the errors went away and gave me the histogram of the posterior predicted p values...
Reply all
Reply to author
Forward
0 new messages