I'm working with R and confirming my results in Python with the overwhelming majority of the work matching between the two quite well. There are two outputs coming out of R that I'm not seeing how to get in Python and for now I'm looking for pre-packaged calls but if I have to do it manually so be it. Still, I would expect the pre-packaged calls to be available since practically everything else that is in R is in Python.
First question: How do you get the R 'Residual standard error'(see the red box) in Python?
Here is the R code and below that the results:
fit_1a <- lm(rpaapl~rpsp, data=df_returns)
summary(fit_1a)
Here is the Python/statsmodels.ols code and below that the results:
est_1a = smf.ols(formula='rpaapl ~ rpsp', data=xl).fit()
print(est_1a.summary())
$\color{red}{\text{So how can I get this residual standard error in Python?}}$
Second question: How do you get the R 'standard error of each prediction' in Python?
Here is the R code and below that the results:
forecast_1d <- data.frame(predict(fit_1a, newdata=data.frame(rpsp=mrp), se.fit=TRUE))
forecast_1d
Here is the Python/statsmodels.ols code and below that the results:
df_1d["estimate"] = est_1a.predict(df_1d)
print(type(est_1a.predict(df_1d)))
df_1d["estimate"]
$\color{red}{\text{So how can I get these standard errors for each prediction in Python?}}$
Please note that the est_1a object has a bunch of values but I'm not finding the standard error. Also, est_1a.predict only returns a timeseries so the predict call does not seem to calculate the standard error (se.fit in R). Any help is much appreciated.