Nimble data issue

31 views
Skip to first unread message

yang xu

unread,
Jul 22, 2021, 3:28:38 PM7/22/21
to nimble...@googlegroups.com
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


Perry de Valpine

unread,
Jul 22, 2021, 4:39:20 PM7/22/21
to yang xu, nimble-users
Dear Yang,

This look interesting, but I don't see a variable 'a' declared in your model.  Can you say more about what you are trying to do?  Normally a variable provided in the data list will correspond to some stochastic node(s) in the model.

-Perry


--
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/CADjkiwv5EfGrTEfb-RgNOMn2XFDkvJ2vgKp7YJvh_8s-0M5sdw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages