Kernel: Python 3 (system-wide)
In [1]:
In [2]:
playerID | yearID | stint | teamID | lgID | G | AB | R | H | 2B | ... | RBI | SB | CS | BB | SO | IBB | HBP | SH | SF | GIDP | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | abercda01 | 1871 | 1 | TRO | NaN | 1 | 4 | 0 | 0 | 0 | ... | 0.0 | 0.0 | 0.0 | 0 | 0.0 | NaN | NaN | NaN | NaN | 0.0 |
1 | addybo01 | 1871 | 1 | RC1 | NaN | 25 | 118 | 30 | 32 | 6 | ... | 13.0 | 8.0 | 1.0 | 4 | 0.0 | NaN | NaN | NaN | NaN | 0.0 |
2 | allisar01 | 1871 | 1 | CL1 | NaN | 29 | 137 | 28 | 40 | 4 | ... | 19.0 | 3.0 | 1.0 | 2 | 5.0 | NaN | NaN | NaN | NaN | 1.0 |
3 | allisdo01 | 1871 | 1 | WS3 | NaN | 27 | 133 | 28 | 44 | 10 | ... | 27.0 | 1.0 | 1.0 | 0 | 2.0 | NaN | NaN | NaN | NaN | 0.0 |
4 | ansonca01 | 1871 | 1 | RC1 | NaN | 25 | 120 | 29 | 39 | 11 | ... | 16.0 | 6.0 | 2.0 | 2 | 1.0 | NaN | NaN | NaN | NaN | 0.0 |
5 rows × 22 columns
In [3]:
playerID | yearID | stint | teamID | lgID | G | AB | R | H | 2B | ... | SB | CS | BB | SO | IBB | HBP | SH | SF | GIDP | Batting_Average | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | addybo01 | 1871 | 1 | RC1 | NaN | 25 | 118 | 30 | 32 | 6 | ... | 8.0 | 1.0 | 4 | 0.0 | NaN | NaN | NaN | NaN | 0.0 | 0.271186 |
2 | allisar01 | 1871 | 1 | CL1 | NaN | 29 | 137 | 28 | 40 | 4 | ... | 3.0 | 1.0 | 2 | 5.0 | NaN | NaN | NaN | NaN | 1.0 | 0.291971 |
3 | allisdo01 | 1871 | 1 | WS3 | NaN | 27 | 133 | 28 | 44 | 10 | ... | 1.0 | 1.0 | 0 | 2.0 | NaN | NaN | NaN | NaN | 0.0 | 0.330827 |
4 | ansonca01 | 1871 | 1 | RC1 | NaN | 25 | 120 | 29 | 39 | 11 | ... | 6.0 | 2.0 | 2 | 1.0 | NaN | NaN | NaN | NaN | 0.0 | 0.325000 |
7 | barnero01 | 1871 | 1 | BS1 | NaN | 31 | 157 | 66 | 63 | 10 | ... | 11.0 | 6.0 | 13 | 1.0 | NaN | NaN | NaN | NaN | 1.0 | 0.401274 |
5 rows × 23 columns
In [4]:
149
In [5]:
y | |
---|---|
yearID | |
1871-01-01 | 0.293249 |
1872-01-01 | 0.295763 |
1873-01-01 | 0.292417 |
1874-01-01 | 0.274479 |
1875-01-01 | 0.252712 |
In [6]:
In [7]:
train size = 111, test size = 11, total size = 150
In [8]:
In [9]:
In [10]:
In [11]:
==============================
Results of Dickey Fuller Test:
Test Statistic -2.782635
p-value 0.060797
#Lags Used 0.000000
Number of Observations Used 110.000000
Critical Value (1%) -3.491245
Critical Value (5%) -2.888195
Critical Value (10%) -2.580988
dtype: float64
The next thing to do is to make the series stationary by removing the upward trend through 1st order differencing of the series using the following formula:
1st Differencing (d=1)
In [12]:
==============================
Results of Dickey Fuller Test:
Test Statistic -1.078853e+01
p-value 2.162826e-19
#Lags Used 0.000000e+00
Number of Observations Used 1.090000e+02
Critical Value (1%) -3.491818e+00
Critical Value (5%) -2.888444e+00
Critical Value (10%) -2.581120e+00
dtype: float64
In [16]:
==============================
Results of Dickey Fuller Test:
Test Statistic -3.027460
p-value 0.032408
#Lags Used 2.000000
Number of Observations Used 107.000000
Critical Value (1%) -3.492996
Critical Value (5%) -2.888955
Critical Value (10%) -2.581393
dtype: float64
In [33]:
==============================
Results of Dickey Fuller Test:
Test Statistic -2.710344
p-value 0.072265
#Lags Used 0.000000
Number of Observations Used 106.000000
Critical Value (1%) -3.493602
Critical Value (5%) -2.889217
Critical Value (10%) -2.581533
dtype: float64
In [0]:
In [0]:
In [0]:
In [0]:
In [0]:
In [0]:
p = 2, q=0, d=1
In [0]:
In [0]:
Best: ARIMA(0,1,0)x(0,1,2,12)
In [0]:
In [0]:
In [0]:
In [0]:
In [0]:
In [0]: