REF: Results.predict convert to array and adjust shape #1254

merged 1 commit into from Dec 19, 2013


None yet

2 participants


convert to ndarray, and check and adjust shape, with unit_tests

closes #1032
supersedes #1178

I tried to let pandas through, but it doesn't help. for example returns an ndarray.
I left the commented out code for testing DataFrame in the generic tests, but it needs special handling on before return.
I don't know if we have any wrapper code for predict. I didn't see any.

Some comments on the requirements

  • CountModels require 2d even if it's only a single prediction because of exog.shape[1]
  • single regressor (OLS example) needs reshape to column_vector as in AR(MA)
  • I'm not sure we always have model.exog as 2d, so I check also for 1d model.exog
  • I didn't find or, so I did a model.exog.shape check directly

@jseabold Do you know if there is any wrapper for predict, or any examples were predict returns a DataFrame with correct index?

This PR converts every exog to ndarray. subclasses need to handle extra arrays, like exposure in count models.


Coverage Status

Coverage remained the same when pulling ada08b9 on josef-pkt:fix_predict_1032 into 01fd4a2 on statsmodels:master.


ready to merge IMO, unless there is a problem with DataFrames.

@josef-pkt josef-pkt merged commit 0b5ed74 into statsmodels:master Dec 19, 2013

1 check passed

default The Travis CI build passed
@josef-pkt josef-pkt deleted the josef-pkt:fix_predict_1032 branch Dec 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment