Hi All,
Here is a summary of the responses I received. It seems that the best way to
handle prediction with this model is to treat it as a missing data problem.
I have yet to find any good examples of "cut" function usage.
Regards,
Richard
-------------------------------------------------------------------------------------------------------
[1]
I'm just wondering if you tried the missing data trick: regard the
y.new.pred as
missing data "NA" and monitor their posterior sampling result.
[2]
The other alternative that was suggested to me that appears to be a "trick"
is to augment the y vector with NA's for those new values you wish to
predict and then monitor the posterior probs for those y.
In other words treating it as a missing data problem.
One clarification. You also need to add the y vector to your initial
guesses. But you only need to put numeric initial guesses at the positions
where you have NA in the y vector.
for the other postions where you have corresponding bonified observed y
values, you use NA as the initial guess. If you don't include initial
guesses for the y vector, WinBUGS will make you press the
"generate initials" button and it may use initial guesses you would not want
it to.
[3]
Well the usual setup for random effects makes them have expected value 0.
However, they reduce the precision and create attenuation in the regression
coefficients which shrinks the predictions
towards the mean (in this case the modal chosen category). Probably the
easiest thing to do in winBUGS would be to simulate from the posterior while
entering the desired values for
the covariates into the prediction equation once you're happy with the
model. (I'm a longtime user of GLMMs but a winBUGS newbie so I'm not 100%
sure how.)
If you can find a copy, take a look at Charles E. McCulloch's (2003)
Generalized Linear Mixed Models. It may be kind of hard to find but if you
have access to a university
library you should be able to get a copy. He explains the prediction problem
really well. McCulloch and Searle (2001) is similarly good.
[4]
Not sure, but maybe this will be of some use... It sounds like you want to
obtain samples from the posterior predictive distribution of y (i.e.
predicting future observations
based on priors and available data). This distribution is the analogue of
the frequentist "prediction interval for a single new individual
observation" that is used in regression. For a linear model with flat
priors,
the Bayesian and frequentist "prediction intervals" will be virtually
identical, but of course interpreted very differently. Doing this is in
WinBUGS is like using the program as a Monte-Carlo simulator for new data.
If so then you can obtain predictions at a given x1 and x2 by including
missing observations (y=NA) in your y vector with appropriate values in your
x1 and x2 vectors. You also need to provide initial guesses for
your y vector, but with NA in every element except for the new missing
observation. For this you supply a guess. WinBUGS will treat this missing y
observation as a parameter and it's posterior will be the posterior
predictive distribution. I am not familiar with your particular model
although from your description you are including random effects. The above
assumes you want those random effects to be included in the predictive
uncertainty. If there are some random effects that you do not want included
then I am getting a little out of my expertise, but I suspect you could
somehow "subtract off" these effects by forming an
appropriate contrast in your model statement and letting WinBUGS give you
it's posterior.
[5]
Ah, trick number 11...
Place all the x1s and x2s in their respective vector, and define the model
(odds of y, expectation of y, etc), indexing y, say 1 to n.big. Where you
have ys, say 1 to n.little, assign the data value.
Where you don't have ys observed, you report out the posterious
distribution, y[n.little+1 ... n.big].
A slight variation to the trick adds an data-grounded index vector (of size
n.little, with values ranging from 1...n.big) pointing to the ys with
observed results, so you don't need consecutive values of observed ys.
This is the main way to access parameter values within the MCMC.
This trick is essentially the way to manage missing values.
Also, you can sweep out a regular matrix of x1, x2 and draw yourself a
surface/2-way table. Whenever the predictions from the model are of more
interest than the internal parameters themselves, you probably want
to do something like this.
[6]
The "cut" function is what you're looking for to generate the predictions.
-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list
|