Sampling from predictive distribution when outcome has missingness

30 views
Skip to first unread message

Andrew Lawson

unread,
Jul 25, 2025, 10:53:44 AMJul 25
to nimble-users
Following on from Pedro's question: does this imply that if we have NAs in outcomes which are declared as data then they will not be automatically sampled unless we specify after the config stage : 
config$addSampler(allowData=TRUE)?

thanks
Andrew



Chris Paciorek

unread,
Jul 25, 2025, 6:20:18 PMJul 25
to Andrew Lawson, nimble-users
If the data nodes are scalar nodes, e.g.,

```
for(i in 1:n)
 y[i] ~ dnorm(mu, sd = sigma)
```

and you specify `y` as `data` with `nimbleModel` with some NAs in there, then nimble will flag the nodes corresponding to elements with NAs as *not* being data and will sample them using a predictive sampler.

The tricky part in terms of Pedro's question was having a multivariate node with a mix of NAs and non-NAs.

Ultimately, if you print the MCMC config object or run the $printSamplers method, you should be able to see what NIMBLE is doing by default.

-chris

-chris

--
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 visit https://groups.google.com/d/msgid/nimble-users/5fe2a52b-2806-4af6-b7e2-077e5f121f59n%40googlegroups.com.

Lawson, Andrew B.

unread,
Jul 26, 2025, 10:28:58 AMJul 26
to Andrew Lawson, paci...@stat.berkeley.edu, nimble-users
Hi Chris
Thanks for the clarification. I did run an old parametric survival model with missing times and they were sampled correctly as missing. 
Thanks again
best
Andrew


From: 'Chris Paciorek' via nimble-users <nimble...@googlegroups.com>
Sent: Friday, July 25, 2025 6:19 PM
To: Andrew Lawson <abla...@gmail.com>
Cc: nimble-users <nimble...@googlegroups.com>
Subject: Re: Sampling from predictive distribution when outcome has missingness
 
If the data nodes are scalar nodes, e. g. , ``` for(i in 1: n) y[i] ~ dnorm(mu, sd = sigma) ``` and you specify `y` as `data` with `nimbleModel` with some NAs in there, then nimble will flag the nodes corresponding to elements with NAs as *not*
Reply all
Reply to author
Forward
0 new messages