confidence and prediction intervals with StatsModels

前端 未结 6 1141
青春惊慌失措
青春惊慌失措 2020-11-27 11:32

I do this linear regression with StatsModels:

import numpy as np
import statsmodels.api as sm
from statsmodels.sandbox.regression.p         


        
6条回答
  •  悲哀的现实
    2020-11-27 12:14

    You can get the prediction intervals by using LRPI() class from the Ipython notebook in my repo (https://github.com/shahejokarian/regression-prediction-interval).

    You need to set the t value to get the desired confidence interval for the prediction values, otherwise the default is 95% conf. interval.

    The LRPI class uses sklearn.linear_model's LinearRegression , numpy and pandas libraries.

    There is an example shown in the notebook too.

提交回复
热议问题