Prediction with confidence interval
Hello.
Is there an option to get the confidence interval in mlr.predict()?
If not, might you be interested in a pull request implementing this?
Hi @jospueyo , we do not currently have any method to compute the confidence interval in this library. Could you explain what you would like to implement exactly (what algorithm would you use to compute it)?
It would be ideal if you could link an article explaining the algorithm. Thanks!
Hi @opatiny, thanks for your answer.
Currently, I'm using a function from jstat library to calculate the student's T distribution based on the degress of freedom of the mlr. Then, I used a simplified method to estimate the confidence interval. I'm sorry but I don't have a reference for this, I just asked to a colleague in the statistics department.
const mlr = new MLR(x, y)
const prediction = mlr.predict([0.5, 0.5])
// first arg is the confidence level and second arg i degress of freedom
const Z_095 = jstat.studentt.inv(0.025, 97);
const interval = Z_095 * mlr.stdError / Math.sqrt(x.length)
const ci = [
prediction[0],
prediction[0] + interval,
prediction[0] - interval
]
So, at this moment, including this in mlr would add a dependence to jstat.