Skip to content

predictOOS when mean_factor=False #15

@PhilippHoefler

Description

@PhilippHoefler

Hi,

first thank you for providing this great package!
I have been playing around with the example code and noticed that the length of the array returned by predictOOS does not match the length of the data when setting mean_factor to False.

One can use the Grunfeld data to see this:

regr = InstrumentedPCA(n_factors=1, intercept=True)
regr = regr.fit(X=data_IS, y=y_IS)
Ypred1 = regr.predictOOS(X=data_OOS, y=y_OOS, mean_factor=True)
Ypred2 = regr.predictOOS(X=data_OOS, y=y_OOS, mean_factor=False)

print(y_OOS, "\n")
print(Ypred1, "\n")
print(Ypred2, "\n")

This is what the output looks like:

firm  year
11    1954    1486.700
14    1954     459.300
10    1954     189.600
8     1954     172.490
7     1954      81.430
13    1954     135.720
15    1954      89.510
16    1954      68.600
12    1954      49.340
9     1954       5.120
6     1954       6.281
Name: invest, dtype: float64 

[780.89716506 291.46947239 380.59479685 101.20025869  65.84867622
 126.53074081  36.65394197 160.14977461  72.50646239   7.91635846
   8.04336863] 

[1244.4912375] 

Apparently the method only returns a prediction for the first entity-time pair.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions