seems like `StatsBase.predict()`

gives only the point estimate (the mean) of prediction. How could I get more information like confidence interval or standard error **of the prediction** (not the coefficients)? thanks.

Depends on the model I suppose? For a `LinearModel`

it’s:

```
predict(mm::LinearModel, newx::AbstractMatrix;
interval::Union{Symbol,Nothing} = nothing, level::Real = 0.95)
If interval is nothing (the default), return a vector with the predicted values for model mm and new data newx. Otherwise, return a
3-column matrix with the prediction and the lower and upper confidence bounds for a given level (0.95 equates alpha = 0.05). Valid
values of interval are :confidence delimiting the uncertainty of the predicted relationship, and :prediction delimiting estimated
bounds for new data points.
```

4 Likes

A few things:

Suppose the true model is y = E[y|X] + \varepsilon

- Confidence intervals (CI) give a range for the conditional expectation E[y|X]

Prediction intervals (PI) give a range for y

PIs tend to be wider than CIs b/c they also take the true error term into account - There are many different ways of estimating PIs, some have different properties, others work better under different assumptions.

My favorite recent paper on this is: Predictive inference with the jackknife+

1 Like