- Can I use the mean of the estimates of coefficients for forecasting out of sample?
You could, but why? A big selling point of Bayesian modelling is the ability to integrate over uncertainty in the parameters. You would do this by generating from the posterior predictive distribution, namely
$$ p(\tilde{y} \vert y) = \int p(\tilde{y}\vert \theta) p(\theta \vert y) d \theta $$
This integral can be approximated by taking estimates of your coefficients and generating data via the likelihood. In Stan, you might right a linear regression and posterior predictive quantities as
data{
int n;
int p;
vector[n] y;
matrix[n, p] X;
}
parameters{
vector[p] beta;
real<lower=0> sigma;
}
model{
beta ~ <priors_here>;
sigma ~ <priors_here>;
y ~ normal(X*b, sigma);
}
generated quantities{
//Here is the posterior predictive
vector[n] y_tilde;
for(i in 1:n){
y_tilde[i] = normal_rng(X*b, sigma);
}
}
For each sample, Stan will compute X*b
and then draw a gaussian random vairable with mean X*b
and standard deviation sigma
. If you average each of these, then you get a prediction for each row in X
.
- How do I find the standard error of my regression?
Uncertainty in the parameters can be obtained directly from the samples outputted by Stan.
- can I just plot the result of the residuals of regression against fitted values to see the test for heteroskedasticity?
That is certainly one way to check the model.