The error is variable dll not found in modelValues. I have attached both the log and my code below:
Log.
Show in New Window
nc.sds> if (requireNamespace("sf", quietly = TRUE)) {
nc.sds+ if (requireNamespace("spdep", quietly = TRUE)) {
nc.sds+ library(spdep)
nc.sds+ nc.sids <- sf::st_read(system.file("shapes/sids.shp", package="spData")[1])
nc.sds+ nc.sids <- as(nc.sids, "Spatial")
nc.sds+ proj4string(nc.sids) <- CRS("+proj=longlat +ellps=clrk66")
nc.sds+ row.names(nc.sids) <- as.character(nc.sids$FIPS)
nc.sds+ rn <- row.names(nc.sids)
nc.sds+ ncCC89_nb <- read.gal(system.file("weights/ncCC89.gal", package="spData")[1],
nc.sds+ region.id=rn)
nc.sds+ ncCR85_nb <- read.gal(system.file("weights/ncCR85.gal", package="spData")[1],
nc.sds+ region.id=rn)
nc.sds+
nc.sds+ plot(nc.sids, border="grey")
nc.sds+ plot(ncCR85_nb, coordinates(nc.sids), add=TRUE, col="blue")
nc.sds+ plot(nc.sids, border="grey")
nc.sds+ plot(ncCC89_nb, coordinates(nc.sids), add=TRUE, col="blue")
nc.sds+ }
nc.sds+ }
Reading layer `sids' from data source `C:\Users\governors\AppData\Local\Programs\R\R-4.2.1\library\spData\shapes\sids.shp' using driver `ESRI Shapefile'
Simple feature collection with 100 features and 22 fields
Geometry type: MULTIPOLYGON
Dimension: XY
Bounding box: xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965
CRS: NA
OGR data source with driver: ESRI Shapefile
Source: "C:\Users\governors\AppData\Local\Programs\R\R-4.2.1\library\spData\shapes\sids.shp", layer: "sids"
with 100 features
It has 22 fields
R Console
Show in New Window
Show in New Window
Defining model
Building model
Setting data and initial values
Running calculate on model
[Note] Any error reports that follow may simply reflect missing values in model variables.
Checking model sizes and dimensions
Compiling
[Note] This may take a minute.
[Note] Use 'showCompilerOutput = TRUE' to see C++ compilation details.
Reference class 'Cnc.sids.co_MID_2' [package ".GlobalEnv"] with 44 fields
$ modelDef : NULL
$ nodes :<environment: 0x000002506dd92ef8>
$ vars :List of 10
..$ lifted_d1_over_sqrt_oPtau_cP : num(0)
..$ theta : int 100
..$ lifted_n_oBi_cB_times_exp_oPtheta_oBi_cB_cP_L3: num 100
..$ y : int 100
..$ mu : num(0)
..$ tau : num(0)
..$ logProb_theta : num 100
..$ logProb_y : num 100
..$ logProb_mu : num(0)
..$ logProb_tau : num(0)
$ graph : NULL
$ defaultModelValues :
Error in object[[ch]] : variable dll not found in modelValues
And this is my code:
nc.sids.code = nimbleCode(
{
for (i in 1:k){
theta[i] ~ dnorm(mu, tau)
y[i] ~ dpois(n[i] *exp(theta[i]))
}
#prior for hyperparameters
mu ~ dnorm(-6, 0.001)
tau ~ dgamma(1, 0.001)
}
)
k= 100
n= nc.sids$BIR79
y= nc.sids$SID79
nc.sids.Consts = list(k = k, n = n)
nc.sids.Data= list(y = y)
nc.sids.Inits = list(mu = -2, tau = 12, theta = rep(0.002, k))
nc.sids.Model = nimbleModel( nc.sids.code,
data= nc.sids.Data,
constants = nc.sids.Consts,
inits= nc.sids.Inits)
compile.nc.sids.Model = compileNimble(nc.sids.Model)
str(compile.nc.sids.Model)
nc.sids.conf = configureMCMC(nc.sids.Model, print= T)
nc.sids.conf$addMonitors(c("mu", "tau", "theta"))
nc.sids.MCMC = buildMCMC(nc.sids.conf)
compile.nc.sids.MCMC = compileNimble(nc.sids.MCMC, project= nc.sids.Model)
niter = 55000
nburn = 5000
set.seed(1)
inits = list(mu = -2, tau =12, theta = rep(0.002, k))
start.time = proc.time()
samples = runMCMC( compile.nc.sids.MCMC, niter = niter, nburnin = nburn,
inits = inits, nchains = 1, samplesAsCodaMCMC = TRUE)
stop.time = proc.time()
time.elapsed = stop.time - start.time
print(time.elapsed)
--
You received this message because you are subscribed to the Google Groups "nimble-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/47125bc6-64ed-42cf-98ef-15fcc1d9af46n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/18b19773-aec3-44f6-bfc7-7c6d79b3a975n%40googlegroups.com.