### Define coordinates coords<-as.matrix(data[,1:2]) ### Boundary bnd<-inla.nonconvex.hull(coords, convex=-0.1) ### Mesh cmv.mesh<-inla.mesh.2d(boundary=bnd, offset=c(.06,.1), max.edge=c(.05,.2)) ### Create SPDE object cmv.spde<-inla.spde2.matern(mesh=cmv.mesh, alpha=2) ### List of indexes for the spatial effect s.index<-inla.spde.make.index("spatial", n.spde = cmv.spde$n.spde) ### Projector matrix A.est<-inla.spde.make.A(mesh=cmv.mesh, loc=coords, index=rep(1:nrow(coords))) dim(A.est) [1] 3504 800 cmv.stack.est<-inla.stack( + data=list(y=data$result), + tag="est", + A=list(A.est), + effects=list(c(s.index, list(intercept=1)))) formula<- y~ -1 + intercept + f(spatial, model=cmv.spde) output1<- inla(formula, data = list(y=data$result), family="binomial", Ntrials=1) Error in eval(expr, envir, enclos) : object 'intercept' not found
> gproj <- inla.mesh.projector(cmv.mesh, xlim = 0:1, ylim = 0:1, dims = c(300, 300)) > > g.mean <- inla.mesh.project(gproj, model_1b$summary.random$s$mean) > > g.sd <- inla.mesh.project(gproj, model_1b$summary.random$s$sd) > > library(lattice); library(gridExtra) > > trellis.par.set(regions=list(col=terrain.colors(16))) > > grid.arrange(levelplot(g.mean, scales=list(draw=F), xlab='', ylab='', main='mean'), + levelplot(g.sd, scal=list(draw=F), xla='', yla='', main='sd'), nrow=1) Error in seq.default(zrng[1], zrng[2], length.out = cuts + 2) : 'from' cannot be NA, NaN or infinite In addition: Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: In max(x) : no non-missing arguments to max; returning -Inf
> summary(model_1b) Call: c("inla(formula = formula_1b, family = \"binomial\", data = inla.stack.data(stk.e), ", " control.compute = list(dic = TRUE), control.predictor = list(A = inla.stack.A(stk.e), ", " compute = TRUE))") Time used: Pre-processing Running inla Post-processing Total 0.9201 78.0915 2.8592 81.8707 Fixed effects: mean sd 0.025quant 0.5quant 0.975quant mode kld b0 16.4385 24.9048 -33.1165 16.6287 64.8924 17.0072 0 x 0.2089 0.3159 -0.4197 0.2113 0.8235 0.2160 0 Random effects: Name Model s SPDE2 model fips IID model Model hyperparameters: mean sd 0.025quant 0.5quant 0.975quant mode Theta1 for s -3.579 4.658e-01 -4.526 -3.565 -2.699 -3.523 Theta2 for s 3.261 4.172e-01 2.471 3.249 4.111 3.212 Precision for fips 18216.870 1.807e+04 1217.048 12879.568 65805.303 3301.420 Expected number of effective parameters(std dev): 36.89(9.628) Number of equivalent replicates : 94.98 Deviance Information Criterion (DIC) ...: 4710.81 Effective number of parameters .........: 38.01 Marginal log-Likelihood: -2376.97 Posterior marginals for linear predictor and fitted values computed | |
--
You received this message because you are subscribed to the Google Groups "R-inla discussion group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion...@googlegroups.com.
To post to this group, send email to r-inla-disc...@googlegroups.com.
Looks like for some reason I'm getting NAs in g.mean and g.sd
> summary(cmv.mesh) Manifold: R2 Vertices: 800 Triangles: 1547 Boundary segm.: 51 (1 group: 0) Interior segm.: 92 (1 group: 1) xlim: -79.43167 -78.27963 ylim: 35.39146 36.56701 zlim: 0 0
> summary(g.mean) V1 V2 V3 V4 V5 V6 Min. : NA Min. : NA Min. : NA Min. : NA Min. : NA Min. : NA 1st Qu.: NA 1st Qu.: NA 1st Qu.: NA 1st Qu.: NA 1st Qu.: NA 1st Qu.: NA Median : NA Median : NA Median : NA Median : NA Median : NA Median : NA Mean :NaN Mean :NaN Mean :NaN Mean :NaN Mean :NaN Mean :NaN 3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA Max. : NA Max. : NA Max. : NA Max. : NA Max. : NA Max. : NA NA's :300 NA's :300 NA's :300 NA's :300 NA's :300 NA's :300 V7 V8 V9 V10 V11 V12 Min. : NA Min. : NA Min. : NA Min. : NA Min. : NA Min. : NA
> summary(g.sd) V1 V2 V3 V4 V5 V6 Min. : NA Min. : NA Min. : NA Min. : NA Min. : NA Min. : NA 1st Qu.: NA 1st Qu.: NA 1st Qu.: NA 1st Qu.: NA 1st Qu.: NA 1st Qu.: NA Median : NA Median : NA Median : NA Median : NA Median : NA Median : NA Mean :NaN Mean :NaN Mean :NaN Mean :NaN Mean :NaN Mean :NaN 3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA Max. : NA Max. : NA Max. : NA Max. : NA Max. : NA Max. : NA NA's :300 NA's :300 NA's :300 NA's :300 NA's :300 NA's :300 V7 V8 V9 V10 V11 V12 Min. : NA Min. : NA Min. : NA Min. : NA Min. : NA Min. : NA
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion-group+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion...@googlegroups.com.
Finn
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion-group+unsubscr...@googlegroups.com.
To post to this group, send email to r-inla-disc...@googlegroups.com.
Visit this group at https://groups.google.com/group/r-inla-discussion-group.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "R-inla discussion group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion-group+unsub...@googlegroups.com.
To post to this group, send email to r-inla-discussion-group@googlegroups.com.
Finn
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion-group+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion-group+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion...@googlegroups.com.

To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion-group+unsub...@googlegroups.com.