ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 6.6 months ago (distributed domain, exempt) |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://groups.google.com/g/r-inla-discussion-group/c/bstKUeRrIBg |
| Last Crawled | 2025-09-25 08:37:32 (6 months ago) |
| First Indexed | not set |
| HTTP Status Code | 200 |
| Meta Title | Zero-inflated models |
| Meta Description | null |
| Meta Canonical | null |
| Boilerpipe Text | Hi Victor,
Without being able to try it on your dataset, it's hard to know
exactly what happened.
I ran the following code, where the graph and data were taken from the
bym example.
library(INLA)
#taken from BYM example. Read data and graph and organise dataframe
data(Germany)
g = system.file("demodata/germany.graph", package="INLA")
source(system.file("demodata/Bym-map.R", package="INLA"))
Germany = cbind(Germany,region.struct=Germany$region)
#this is similar to your formula
formula1 = Y ~ f(region.struct,model="besag",graph.file=g) +x
#this is similar to your inla call
result = inla(formula1, family="zeroinflatedpoisson0",data=Germany,
E=E, control.compute = list(dic=TRUE, cpo=TRUE))
summary(result)
I get sensible results, but the following warning message is produced:
"Warning message:
In INLA::f(region.struct, model = "besag", graph.file = g) :
Argument 'graph.file' in 'f()' is obsolete; please use the more
general argument 'graph' instead." You can get rid of this by changing the formula to
formula1 = Y ~ f(region.struct,model="besag",graph=g) +x
So, can you please send me the exact error message that you got when
you tried to run the problem. There are also some things that you can
check:
-- Is INLA updated? Use inla.update(testing=TRUE)
-- Is your graph file valid? Use inla.debug.graph()
-- Is the data frame in order?
Best wishes,
Dan
|
| Markdown | [Groups](https://groups.google.com/g/r-inla-discussion-group/c/my-groups)
Groups
Send feedback to Google
Help
Training
[Sign in](https://accounts.google.com/ServiceLogin?hl=en&passive=true&continue=https://groups.google.com&ec=GAZA0AM)
[Groups](https://groups.google.com/g/r-inla-discussion-group/c/my-groups)
Groups
## R-inla discussion group
[Conversations](https://groups.google.com/g/r-inla-discussion-group/c/g/r-inla-discussion-group)
[About](https://groups.google.com/g/r-inla-discussion-group/c/g/r-inla-discussion-group/about)
[Privacy](https://policies.google.com/privacy?hl=en_US) • [Terms](https://policies.google.com/terms?hl=en_US)
# Zero-inflated models
1,977 views
Skip to first unread message

### Laura Serra Saurina
unread,
Mar 21, 2012, 11:08:35 AM3/21/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to r-inla-disc...@googlegroups.com
Hi,
I would like to know the difference between the two types of zero-inflated models (type 0 and type 1). Looking at the formula I noticed that type 0 only includes positives values and type 1 includes all kind of values. Is there any other difference?
Type 0: *Prob(y\|...) = p x 1\[y=0\] + (1 - p) x Poisson(y \| y \> 0)*
Type 1: *Prob(y\|...) = p x 1\[y=0\] + (1 - p) x Poisson(y)*
Moreover, could you give me the Type2's formula? I haven't found it.
Thank you very much.
Laura.

### Finn Lindgren
unread,
Mar 21, 2012, 12:22:03 PM3/21/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to r-inla-disc...@googlegroups.com
On Wednesday, 21 March 2012 11:08:35 UTC+1, Laura Serra Saurina wrote:
> I would like to know the difference between the two types of zero-inflated models (type 0 and type 1). Looking at the formula I noticed that type 0 only includes positives values and type 1 includes all kind of values. Is there any other difference?
>
> Type 0: *Prob(y\|...) = p x 1\[y=0\] + (1 - p) x Poisson(y \| y \> 0)*
>
> Type 1: *Prob(y\|...) = p x 1\[y=0\] + (1 - p) x Poisson(y)*
Type 1 is a mixture of a point mass at 0 and a regular Poisson distribution, whereas Type 0 is a mixture of a truncated Poisson (the y\>0 bit) and a point mass at 0, so that the probability at zero is governed directly by p.
This means e.g. that Type 0 can have a \_lower\_ probability at 0 than a pure Poisson, relative to the probability at 1, whereas Type 1 can only increase the relative probability for 0.
> Moreover, could you give me the Type2's formula? I haven't found it.
The description of Type 2 is at the end of page 6 of
<http://www.math.ntnu.no/~hrue/r-inla.org/doc/likelihood/zeroinflated.pdf>
It's like Type 1 but with a different definition of p.
/Finn

### Victor
unread,
May 2, 2012, 5:30:19 PM5/2/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to r-inla-disc...@googlegroups.com
I am new to INLA and i was trying to fit a zero inflated poisson model (0) but i required the model to include a spatial component for example CAR model
i seem to be fitting the model well without fail when i do not include the spatial component, but perhaps am missing some part of model specification or parameters
my data distribution has a classical zero-inflated like histogram with very few large values
my question is 1) is a specification of spatial component the right thing to do e.g using besag 2) how best do i initiate the parameters when i call INLA

### Daniel Simpson
unread,
May 2, 2012, 5:31:34 PM5/2/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Victor, r-inla-disc...@googlegroups.com
Hi Victor,
Could you send some example code that doesn't work?
Thanks,
Dan

### Victor
unread,
May 2, 2012, 5:49:30 PM5/2/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to r-inla-disc...@googlegroups.com, Victor
am still trying to figure out how best to include a sample data set, but basically (y) comprise of values with range from zero (0) (highest frequency) to 800 (just one value)
hist(y, breaks = 400)
f.mod1 \<- y ~ cov1 + f(ID, model="besag", graph.file = "dist.adj") \# where cov1 is a linear covariate
mod1 \<- inla(f.mod1, family = "zeroinflatedpoisson0", data = mydata, E=pop, control.compute=list(dic=TRUE,cpo=TRUE))
basically the PIT values fail in above
Thanks

### Daniel Simpson
unread,
May 2, 2012, 8:14:57 PM5/2/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Victor, r-inla-disc...@googlegroups.com
Hi Victor,
Without being able to try it on your dataset, it's hard to know
exactly what happened.
I ran the following code, where the graph and data were taken from the
bym example.
library(INLA)
\#taken from BYM example. Read data and graph and organise dataframe
data(Germany)
g = system.file("demodata/germany.graph", package="INLA")
source(system.file("demodata/Bym-map.R", package="INLA"))
Germany = cbind(Germany,region.struct=Germany\$region)
\#this is similar to your formula
formula1 = Y ~ f(region.struct,model="besag",graph.file=g) +x
\#this is similar to your inla call
result = inla(formula1, family="zeroinflatedpoisson0",data=Germany,
E=E, control.compute = list(dic=TRUE, cpo=TRUE))
summary(result)
I get sensible results, but the following warning message is produced:
"Warning message:
In INLA::f(region.struct, model = "besag", graph.file = g) :
Argument 'graph.file' in 'f()' is obsolete; please use the more
general argument 'graph' instead."
You can get rid of this by changing the formula to
formula1 = Y ~ f(region.struct,model="besag",graph=g) +x
So, can you please send me the exact error message that you got when
you tried to run the problem. There are also some things that you can
check:
\-- Is INLA updated? Use inla.update(testing=TRUE)
\-- Is your graph file valid? Use inla.debug.graph()
\-- Is the data frame in order?
Best wishes,
Dan
Message has been deleted

### Belay Birlie
unread,
Aug 12, 2016, 10:11:19 AM8/12/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to R-inla discussion group
Dear All
I am trying to fit a zero inflated model in INLA using *Prob(y\|...) = p x 1\[y=0\] + (1 - p) x Poisson(y \| y \> 0).* Is there a possibility to model p as a function of covariates. In JAGS I can specify this in this way.
model {
for( j in 1 : N )
{
y\[j\] ~dpois(mu\[j\])
mu\[j\] \<- (1 - u\[j\])\*lambda\[j\]
u\[j\]~dbern(p\[j\])
logit(p\[j\]) \<- a\[1\]+ a\[2\]\*time\[j\]+a\[3\]\*Trt\[j\]+a\[4\]\*Season\[j\]+b1\[id2\[j\]\]
log(lambda\[j\]) \<-beta\[1\]+ beta\[2\]\*time\[j\]+beta\[3\]\*Trt\[j\]+ beta\[4\]\*Season\[j\]+beta\[5\]\*Trt\[j\]\*time\[j\]+b2\[id2\[j\]\]
}
Thus, I am looking for help to do the same thing in INLA
Belay

### Håvard Rue
unread,
Aug 12, 2016, 10:13:39 AM8/12/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Belay Birlie, R-inla discussion group
On Fri, 2016-08-12 at 01:11 -0700, Belay Birlie wrote:
\> Dear All
\>
\> I am trying to fit a zero inflated model in INLA using Prob(y\|...) =
\> p x 1\[y=0\] + (1 - p) x Poisson(y \| y \> 0). Is there a possibility to
\> model p as a function of covariates.
yes. since the poisson part is y\|y\>0, you can. see
inla.doc("zeroinflated") and the spde-tutorial for a worked out example
for zero-inflated rain data, which is the same as yours. you have to
use two likelihoods, one for the 'p' and one for the 'y'.
\--
Håvard Rue
Department of Mathematical Sciences
Norwegian University of Science and Technology
N-7491 Trondheim, Norway
Voice: [\+47-7359-3533](tel:+47%2073%2059%2035%2033) URL : <http://www.math.ntnu.no/~hrue>
Mobile: [\+47-9260-0021](tel:+47%2092%2060%2000%2021) Email: [havar...@math.ntnu.no](https://groups.google.com/g/r-inla-discussion-group/c/bstKUeRrIBg)
R-INLA: [www.r-inla.org](http://www.r-inla.org/)
Reply all
Reply to author
Forward
0 new messages
Search
Clear search
Close search
Google apps
Main menu |
| Readable Markdown | null |
| Shard | 95 (laksa) |
| Root Hash | 744624608793826895 |
| Unparsed URL | com,google!groups,/g/r-inla-discussion-group/c/bstKUeRrIBg s443 |