ARIMA
ARIMA using For
Example 1
Summary: Generates a forecasted value for 'Steel Shipments' based on ARIMA analysis, using the Match function to handle different cases and populate a list with relevant data.
Code:
dt = Open("data_table.jmp");
y = "";
xlist = {"1", "2", "3", "4"};
testVar = {};
For( i = 1, i <= N Items( xlist ), i++,
If( i == 3,
y = Column( "Steel Shipments" )
);
Match( xlist[i],
xlist[1], Insert Into( testVar, Eval List( {i, y} ) ),
xlist[2], Insert Into( testVar, Eval List( {i, y} ) ),
xlist[3],
Insert Into(
testVar,
Eval List(
{i, y, Round(
ARIMA Forecast(
y,
96,
ARIMA( 1, 0, 1 ),
{AR Coefficients( {0.900397691783565} ), MA Coefficients( {0.483316746530245} ), Intercept( 6466.03264802329 )},
1,
2
),
3
)}
)
),
xlist[4], Insert Into( testVar, Eval List( {i, y} ) ),
Insert Into( testVar, Eval List( {i, y, "error"} ) )
);
);
Code Explanation:
- Open data table.
- Initialize variable
yas empty string. - Define list
xlistwith four elements. - Initialize empty list
testVar. - Loop through each item in
xlist. - If index
iequals 3, assign column "Steel Shipments" toy. - Use
Matchto handle different cases based onxlist[i]. - For first two cases, insert
{i, y}intotestVar. - For third case, insert
{i, y, forecast value}intotestVar. - For fourth case, insert
{i, y}intotestVar.
Example 2
Summary: Generates a forecasted distribution analysis for continuous variables in a specified data table using ARIMA forecasting and MatchMZ matching.
Code:
dt = Open("data_table.jmp");
y = "";
xlist = {"1", "2", "3", "4"};
testVar = {};
For( i = 1, i <= N Items( xlist ), i++,
If( i == 3,
y = Column( "Steel Shipments" )
);
MatchMZ( xlist[i],
xlist[1], Insert Into( testVar, Eval List( {i, y} ) ),
xlist[2], Insert Into( testVar, Eval List( {i, y} ) ),
xlist[3],
Insert Into(
testVar,
Eval List(
{i, y, Round(
ARIMA Forecast(
y,
96,
ARIMA( 1, 0, 1 ),
{AR Coefficients( {0.900397691783565} ), MA Coefficients( {0.483316746530245} ), Intercept( 6466.03264802329 )},
1,
2
),
3
)}
)
),
xlist[4], Insert Into( testVar, Eval List( {i, y} ) ),
Insert Into( testVar, Eval List( {i, y, "error"} ) )
);
);
Code Explanation:
- Open data table.
- Initialize variable
y. - Define list
xlist. - Initialize empty list
testVar. - Loop through
xlistitems. - Set
yfor third item. - Match current
xlistitem. - Insert
iandyfor first two items. - Insert
i,y, and ARIMA forecast for third item. - Insert
iandyfor fourth item.
Example 3
Summary: Generates a distribution analysis for continuous variables in a specified data table using the Distribution platform, incorporating ARIMA forecasting and error handling.
Code:
dt = Open("data_table.jmp");
y = "";
xlist = {"1", "2", "3", "4"};
testVar = {};
For( i = 1, i <= N Items( xlist ), i++,
If( i == 3,
y = Column( "Steel Shipments" )
);
MatchV3( xlist[i],
xlist[1], Insert Into( testVar, Eval List( {i, y} ) ),
xlist[2], Insert Into( testVar, Eval List( {i, y} ) ),
xlist[3],
Insert Into(
testVar,
Eval List(
{i, y, Round(
ARIMA Forecast(
y,
96,
ARIMA( 1, 0, 1 ),
{AR Coefficients( {0.900397691783565} ), MA Coefficients( {0.483316746530245} ), Intercept( 6466.03264802329 )},
1,
2
),
3
)}
)
),
xlist[4], Insert Into( testVar, Eval List( {i, y} ) ),
Insert Into( testVar, Eval List( {i, y, "error"} ) )
);
);
Code Explanation:
- Open data table.
- Initialize variables.
- Loop through list items.
- Check if index is 3.
- Assign column to variable.
- Match list item 1.
- Insert into testVar.
- Match list item 2.
- Insert into testVar.
- Match list item 3.
- Perform ARIMA forecast.
- Round forecast value.
- Insert into testVar.
- Match list item 4.
- Insert into testVar.
- Handle unmatched cases.