Hi,
more general versions of such models can be implemented with rgeneric
and generic, but in your particular example, there are some simpler
alternatives:
Since you treat the "outliers" as having known location in the data,
you could introduce a random effect component that is added only to
those observations, in effect giving them variance variance_obs +
extra_variance_outlier, instead of what you did, which was to have two
separate models. By adding the random effect only to the outliers, you
will be guaranteed that their model variance is larger than for
non-outliers. This can be accomplished by
+f(additional_variability, model="iid")
where additional_variability has NA for all non-outliers, and indices
1, 2, 3, 4, ..., number_of_outliers, for the outliers.
Similarly, to get increased innovation variance after a specific time
point, you could add another random walk component there, constrained
to start at zero at that time, and applied only after that time (by
having NA in the input vector for earlier time points.
The combined effect would be that of an increased innovation variance
from that time (drawback of that approach is that it doesn't allow you
to estimate whether the change is a decrease or an increase).
Something like this:
+ f(extra_walk,model="rw1",constr=FALSE,extraconstr=list(A=matrix(rep(c(0,1,0),c(start_time-1,1,total_time-start_time)),
e = 0))
> --
> 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/853cb581-c2f8-43d1-b938-b00edd2da360n%40googlegroups.com.
--
Finn Lindgren
email:
finn.l...@gmail.com