--
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 post to this group, send email to r-inla-disc...@googlegroups.com.
Visit this group at https://groups.google.com/group/r-inla-discussion-group.
For more options, visit https://groups.google.com/d/optout.
No, the standard deviations definitely don't transform in that way!
No, the standard deviations definitely don't transform in that way!
No, the standard deviations definitely don't transform in that way!
For predictions using the link function, the indexing needs to be intosummary.fitted.values, not summary.linear.predictor.
Finn
On 11/01/2016 12:37 PM, Finn Lindgren wrote:
Oops... The correct code to extract the predictions is thenNo, the standard deviations definitely don't transform in that way!
field_pred_mean <- res$summary.linear.predictor[inla.stack.index(jdat,"pred")$data, "mean"]field_pred_sd <- res$summary.linear.predictor[inla.stack.index(jdat,"pred")$data, "sd"]
Elias
--
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-group+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion...@googlegroups.com.
To post to this group, send email to r-inla-disc...@googlegroups.com.
Visit this group at https://groups.google.com/group/r-inla-discussion-group.
For more options, visit https://groups.google.com/d/optout.
<INLA-hurdle2.R>
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion...@googlegroups.com.
To post to this group, send email to r-inla-disc...@googlegroups.com.
Visit this group at https://groups.google.com/group/r-inla-discussion-group.
For more options, visit https://groups.google.com/d/optout.
<INLA-hurdle2.R>
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion...@googlegroups.com.
Ok, I fixed that error. Where I'm confused is specifically in which effects to list in the prediction stack. For the z (binomial) and y (gamma) stacks there are different effects (ie.. ix1, ix2, iu & z.b0, y.b0). So for the prediction stack wouldn't I have to take into account both of those stacks? That then causes an issue in stacking them as there is a name mismatch.
Do I make a prediction stack for z and y separately?
Also, one last question just for clarification. Should the dataset for training have values in the last time step? Or do those need to be NAed out? I have 8 weeks of data. I am trying to predict the 8th week.
Does INLA know based off of n.group=8 not to include the last week in the model training?
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion...@googlegroups.com.
Ok, I fixed that error. Where I'm confused is specifically in which effects to list in the prediction stack. For the z (binomial) and y (gamma) stacks there are different effects (ie.. ix1, ix2, iu & z.b0, y.b0). So for the prediction stack wouldn't I have to take into account both of those stacks? That then causes an issue in stacking them as there is a name mismatch.Ah, I missed that you have two likelihoods. You should set link=1 for stk.z and link=2 for stk.y (but I think they both have the same link, so it won't actually make a difference in this case).Do I make a prediction stack for z and y separately?Yes, that would be easiest. For z-prediction, just include the covariates etc that make sense for z, and for y-prediction, just include the ones that make sense for y. The stack functions will join the stacks together as needed by adding NA vectors for "missing" effects. (NA in an effect vector means "no effect")
Also, one last question just for clarification. Should the dataset for training have values in the last time step? Or do those need to be NAed out? I have 8 weeks of data. I am trying to predict the 8th week.When you say "data", do you mean just covariate, or also response variables?The way to think about these models is that they exist wether you observe the responses or not. So build the model to include any time steps that need to exist to make a coherent universe.
Does INLA know based off of n.group=8 not to include the last week in the model training?If you only have non-NA response variables for time steps 2 through 7, there is nothing to "train" for time step 8. The NA response "values" in the prediction stacks mean "these were not observed".Finn
Erin
Ok, for a joint logistic(binomial)/gamma regression model does this look right? I'm a bit unfamiliar with formulas in this sense with gamma likelihoods.z=occurencez(s)=beta1*Temp(s)+beta2*Precip(s) +spde(s)Pred_z~exp(z(s))/(1+exp(z(s))y=concentratony(s)=gamma * spde(s) +beta1*Temp(s) + beta2*Precip(s)Pred_y=exp(y(s))
Will I use these to get the simulated predictions? Or do I have to take the exponent of them?field_pred_mean <- res$summary.fitted.values[inla.stack.index(jdat,"pred.y")$data, "mean"]field_pred_sd <- res$summary.fitted.values[inla.stack.index(jdat,"pred.y")$data, "sd"]
Thanks!-Erin
On Tuesday, November 1, 2016 at 2:54:53 PM UTC-4, Finn Lindgren wrote:
> OK, but I fit the models jointly right, thus a "joint" model? In the precipitation example in the spde tutorial they fit the models separately then jointly. I am not looking for separately predictions of z and y, but rather 1 overall prediction based on the z and y likelihoods.
Well, the predictions are not on the data level, but rather on the linear model level, but apart from that, yes, the modeling and estimation is done jointly. However, the predictions are made for _something_, and if I understand correctly that would be for your GLM predictor models, of which there is one for z and one for y. Or I'm misunderstanding what you are trying to predict. You may need to spell out the actual mathematics of what your model is; R code only goes so far, and if it doesn't already describe what you want, then there is no way to figure it out without a proper model definition.
> So for the 1 prediction stack and 1 joint model how do I include the different inla.spde.make.index from z and y? That is where I am getting the name mismatch error. This is highlighted in the red part of my previous included code.
Please provide the exact error message.
Can you write down the two separate formula definitions you would have used if you were modeling z and y separately, as well as the joint model formula? The terms in those first 2 subformulas should be what you need to put in the respective stacks.
The joint model formula is just the union of those two formulas. This means that any effects that should be in both submodels must use the same names, and any effect that only should occur in one of the submodels must use a name that does not occur in the other submodel. Each substack should then only include names used corresponding subformula.
> By data I mean both covariate values and response variables. I have values for all 8 weeks.
As I said, the mathematical model exists independently of any response variables. Prediction just means "for these values of the covariates (including spatial locations etc), what would I expect the observances to be?".
> Ideally this would eventually be an operational model where I would not have response variables or covariate models. As I am doing hindcast prediction right now, I have the data for the "next" week.
You can't do prediction (in time) without a model. In particular, if your model includes covariates, you must have them for the time/locations you want to do a prediction. If not, you should also have to build a prediction model for the covariates themselves.
(As I said, I haven't followed the entire thread, so I may be missing something obvious)
Finn
--
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 unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion-group+unsub...@googlegroups.com.
--
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.
You can additionally try to run with fewer threads, like num.threads=2. That will use less memory. Also use verbose=TRUE, and you’ll see what is going on.
H
On 8 Nov 2017, at 06:50, Kimberly <kfor...@gmail.com> wrote:
Thanks so much for pointing this out to me - I had missed this example in the book and it was very useful.I've managed to run the full hurdle model with part of my dataset but am still having trouble running with the full dataset (~ 400,000 observations). The error I get when I try to run the full dataset is status 253 so I think this is an issue with memory?From the other threads in this group, I've specified the strategy="gaussian", int.strategy = "eb" and added starting values for hyperparameters based on the results from the model run with the subset of data. Would you have any other suggestions on how to optimise this model for a large dataset?Thanks again, Kimberly
On Thursday, 26 October 2017 19:14:18 UTC+8, Elias T. Krainski wrote:The Bernoulli, Gamma example is now in the Chapter 8 of the INLA book
https://sites.google.com/a/r-inla.org/stbook/
Elias
--
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-group+unsub...@googlegroups.com.