Dear nimble experts and development team,
I am new to nimble and trying to fit a spatial factor model using nimble package. I keep having warning messages: Warning message: In model$setData(data) : setData: data not used in model: a.
Part of my dataset looks like this, which has multiple outcomes:
$a
[,1] [,2] [,3] [,4] [,5]
[1,] 0.80311037 1.318244 -0.35708283 0.387287479 0.63856167
[2,] 2.17591673 1.318244 0.02443401 -1.268981362 0.61417849
[3,] 1.46409121 1.318244 -0.86889420 0.496739068 1.00430938
[4,] 1.00648909 1.318244 -0.77226228 0.286631492 0.37847441
[5,] 0.80311037 1.318244 -0.51151908 0.178904863 0.28094169
[6,] 0.49804229 1.318244 0.42561468 -0.018625146 0.05336534
And here is my code...
#code####
Fmodel<-nimbleCode({
for (i in 1:Nareas){
for (k in 1:Nindicators){
Z[i,k]~dnorm(u[i,k], sig[k])
u[i,k]<-alpha[k]+delta[k]*theta[i]
}
}
theta[1:Nareas]~dcar_normal(adj[1:L], weights[1:L], num[1:Nareas], 1, zero_mean = 0)
delta[1]~dlnorm(0, 0.01)
delta[2]~dnorm(0, 0.001)
delta[3]~dnorm(0, 0.001)
delta[4]~dnorm(0, 0.001)
delta[5]~dnorm(0, 0.001)
for (k in 1:Nindicators){
alpha[k]~dflat()
sig[k]~dgamma(0.5, 0.0005)
}
#tautheta=1
})
#####inits######
LSTinits<-list( alpha=c(0.1,0.1,0.1,0.1,0.1),
sig=c(0.1,0.1,0.1,0.1,0.1),
delta=c(0.1,0.1,0.1,0.1,0.1),theta=rep(0,67))
####running with monitors and CODA output######
Model1<-nimbleModel(code=Fmodel, name="Model1", constants=LSTConstants,
data=Phy.data, inits=LSTinits)
I really appreciate any suggestions and helps!
Many thanks!
Best,
Yang