Unsual Mean Fitted Values

38 views
Skip to first unread message

sekar dewi

unread,
2:20 AM (16 hours ago) 2:20 AM
to R-inla discussion group
Hello,

Currently I'm trying to fit a spatio-temporal model in analyzing dengue cases based on meteorology covariates. But when I fit the model, it creates such an unsual fitted values, where:

> summary(res$summary.fitted.values["mean"]) mean Min. : 0.000e+00 1st Qu.: 0.000e+00 Median : 5.780e+02 Mean :1.344e+298 3rd Qu.: 1.836e+05 Max. :8.097e+300
For data understanding, here's my dataset summary:
Screenshot 2024-07-21 121149.png
and the formula was:

> formula <- O ~ temperature + rainfall+humidity+
    f(id.zone, model = "bym", graph = jpr.adj) +
    f(id.zone.int, id.month, model = "iid") +
    id.month

>res <- inla(formula,
            family = "poisson",
            data = data.INLA, E = E,
            control.compute = list(dic = TRUE, waic = TRUE, cpo = TRUE),
            control.predictor = list(compute = TRUE)
     )

Is there something wrong with my dataset or did I have misunderstandings on defining my model? Thank you

Sincerly,

Sekar

Håvard Rue

unread,
7:30 AM (11 hours ago) 7:30 AM
to sekar dewi, R-inla discussion group
something seems odd, yes. can you retry replacing 'bym' with 'bym2' ?

if its still bad, can should share data/code so I can rerun ?


On Sat, 2024-07-20 at 22:17 -0700, sekar dewi wrote:
> Hello,
>
> Currently I'm trying to fit a spatio-temporal model in analyzing dengue cases
> based on meteorology covariates. But when I fit the model, it creates such an
> unsual fitted values, where:
>
> > summary(res$summary.fitted.values["mean"])
>       mean
>  Min. : 0.000e+00
>  1st Qu.: 0.000e+00
>  Median : 5.780e+02
>  Mean :1.344e+298
>  3rd Qu.: 1.836e+05
>  Max. :8.097e+300
>
> For data understanding, here's my dataset summary:
> Screenshot 2024-07-21 121149.png
> and the formula was:
>
> > formula <- O ~ temperature + rainfall+humidity+
>     f(id.zone, model = "bym", graph = jpr.adj) +
>     f(id.zone.int, id.month, model = "iid") +
>     id.month
>
> > res <- inla(formula,
>             family = "poisson",
>             data = data.INLA, E = E,
>             control.compute = list(dic = TRUE, waic = TRUE, cpo = TRUE),
>             control.predictor = list(compute = TRUE)
>      )
>
> Is there something wrong with my dataset or did I have misunderstandings on
> defining my model? Thank you
>
> Sincerly,
>
> Sekar
>
> --
> You received this message because you are subscribed to the Google Groups "R-
> inla discussion group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to r-inla-discussion...@googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/r-inla-discussion-group/4b7735f6-c72a-4cb5-9826-bf9d701239d4n%40googlegroups.com
> .

--
Håvard Rue
hr...@r-inla.org

Aditya L. Ramadona

unread,
12:23 PM (6 hours ago) 12:23 PM
to sekar dewi, R-inla discussion group
I’m curious if you have applied any treatments to the meteorological variables. For example, the values for rainfall appear to be unusual - the minimum value is -1.31 and the maximum value is 2.2. Additionally, it seems there are numerous zero values for the observed variable. Could you please provide some clarification?


--
You received this message because you are subscribed to the Google Groups "R-inla discussion group" group.

sekar dewi

unread,
12:45 PM (6 hours ago) 12:45 PM
to R-inla discussion group
Hello, regarding to your question, yes you're right. I've already scaled the meteorology dataset before but I still confused is this consider as the right decision or should I not scale the dataset? But after I changed it into bym2 model, it also works. Thank you

sekar dewi

unread,
1:04 PM (5 hours ago) 1:04 PM
to R-inla discussion group
Thank you. I've changed it into bym2 model and it works. Actually, I also tried to run some other models in order to see the comparison and get the best model. However, it appears to be the same case where there were values with Inf and also many NA's. This was the formula:

## Type II interaction and RW1 prior for time ##
f.TypeII.RW1<- O ~ temperature + rainfall+humidity +
  f(id.zone,model="bym2",graph=jpr.adj) +
  f(id.month,model="rw1") +
  f(id.monthu,model="iid") +
  f(id.zone.int,
    model="iid", group=id.month.int,
    control.group=list(model="rw1"))

TypeII.RW1 <- inla(
  f.TypeII.RW1,
  data = data.INLA, E=E,
  control.predictor = list(compute = TRUE),

  control.compute = list(dic = TRUE, waic = TRUE, cpo = TRUE),
  family = "poisson"
)

> summary(TypeII.RW1$summary.fitted.values) mean sd 0.025quant 0.5quant 0.975quant mode Min. :0.00157 Min. : 0.002 Min. :0.000000 Min. :0.000000 Min. : 0.000e+00 Min. :0.00000 1st Qu.:0.05093 1st Qu.: 0.022 1st Qu.:0.000000 1st Qu.:0.000002 1st Qu.: 0.000e+00 1st Qu.:0.00000 Median :0.20082 Median : 0.070 Median :0.005983 Median :0.026595 Median : 1.000e+00 Median :0.01424 Mean : Inf Mean : 4.170 Mean :0.051896 Mean :0.124369 Mean :2.335e+218 Mean :0.09707 3rd Qu.: Inf 3rd Qu.: 0.158 3rd Qu.:0.037873 3rd Qu.:0.123738 3rd Qu.:2.954e+188 3rd Qu.:0.08245 Max. : Inf Max. :3553.627 Max. :1.909425 Max. :3.502612 Max. :1.174e+221 Max. :3.12943 NA's :840
I also put the dataset below. Thank you
dengue_data.RData
Reply all
Reply to author
Forward
0 new messages