For my evaluation, I wanted to run a rolling 1000 window OLS regression estimation
of the dataset found in this URL:
https://drive.google.com/open?id=0B2Iv8dfU4fTUa3dPYW5tejA0bzg
using the following Python
script.
# /usr/bin/python -tt
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from statsmodels.formula.api import ols
df = pd.read_csv('estimated.csv', names=('x','y'))
model = pd.stats.ols.MovingOLS(y=df.Y, x=df[['y']],
window_type='rolling', window=1000, intercept=True)
df['Y_hat'] = model.y_predict
However, when I run my Python script, I am getting this error: AttributeError: module 'pandas.stats' has no attribute 'ols'
. Could this error be from the version that I am using? The pandas
installed on my Linux node has a version of 0.20.2
from pandas.stats import ols
? – GeotaxisImportError: cannot import name 'ols'
. – Meghanmeghannprint (dir(pd.stats))
? I'm not at laptop atm, will be back home soon to test myself. Is it in the list? – Geotaxis['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'api', 'moments']
. It seems theols
is not listed. – Meghanmeghannreg_test.py
. – Meghanmeghanndir
. I guess they restructured. – Geotaxispandas
- otherwise I will rollback my current version to 0.17 which i think is not a good idea though. – Meghanmeghannfrom statsmodels.regression.linear_model import OLS
taken from statsmodels.org/dev/importpaths.html#import-examples – Tyrocidine