var_main | R Documentation |
This function generates and tests possible VAR models for the specified variables. The only required arguments are av_state
and vars
.
var_main( av_state, vars, lag_max = 2, significance = 0.05, exogenous_max_iterations = 2, subset = 1, log_level = av_state$log_level, small = FALSE, include_model = NULL, exogenous_variables = NULL, use_sktest = TRUE, restrictions.verify_validity_in_every_step = TRUE, restrictions.extensive_search = TRUE, criterion = c("AIC", "BIC"), use_varsoc = FALSE, use_pperron = TRUE, include_squared_trend = FALSE, normalize_data = FALSE, include_lag_zero = FALSE, split_up_outliers = TRUE, format_output_like_stata = FALSE, exclude_almost = FALSE, simple_models = FALSE, numcores = parallel::detectCores() )
av_state |
an object of class |
vars |
the vector of variables on which to perform vector autoregression. These should be the names of existing columns in the data sets of |
lag_max |
limits the highest possible number of lags that will be used in a model. This number sets the maximum limit in the search for optimal lags. |
significance |
the maximum P-value for which results are seen as significant. This argument is used only in the residual tests. |
exogenous_max_iterations |
determines how many times we should try to exclude additional outliers for a variable. This argument should be a number between 1 and 3:
|
subset |
specifies which data subset the VAR analysis should run on. The VAR analysis only runs on one data subset at a time. If not specified, the first subset is used (corresponding to |
log_level |
sets the minimum level of output that should be shown. It should be a number between 0 and 3. A lower level means more verbosity. |
small |
corresponds to the |
include_model |
can be used to forcibly include a model in the evaluation. Included models have to be lists, and can specify the parameters |
exogenous_variables |
should be a vector of variable names that already exist in the given data set, that will be supplied to every VAR model as exogenous variables. |
use_sktest |
affects which test is used for Skewness and Kurtosis testing of the residuals. When |
restrictions.verify_validity_in_every_step |
is an argument that affects how constraints are found for valid models. When this argument is |
restrictions.extensive_search |
is an argument that affects how constraints are found for valid models. When this argument is |
criterion |
is the information criterion used to sort the models. Valid options are |
use_varsoc |
determines whether VAR lag order selection criteria should be employed to restrict the search space for VAR models. When |
use_pperron |
determines whether the Phillips-Perron test should be used to determine whether trend variables should be included in the models. When |
include_squared_trend |
determines whether the square of the trend is included if the trend is included for a model. The trend variable is specified using the |
normalize_data |
determines whether the endogenous variables should be normalized. |
include_lag_zero |
determines whether models at lag order 0 are should be considered. These are models at lag 1 with constrained lag-1 parameters in all equations. |
split_up_outliers |
determines whether each outlier should have its own exogenous variable. Defaults to TRUE. This will make a difference only when there is a variable with multiple outliers. |
format_output_like_stata |
when |
exclude_almost |
when |
simple_models |
when
|
numcores |
is the number of cores to use in parallel for evaluation the model. When this variable is |
This function returns the modified av_state
object. The lists of accepted and rejected models can be retrieved through av_state$accepted_models
and av_state$rejected_models
. To print these, use print_accepted_models(av_state)
and print_rejected_models(av_state)
.
## Not run: av_state <- load_file("../data/input/Activity and depression pp5 Angela.dta",log_level=3) av_state <- group_by(av_state,'id') av_state <- order_by(av_state,'Day') av_state <- add_derived_column(av_state,'Activity_hours','Activity', operation='MINUTES_TO_HOURS') av_state <- var_main(av_state,c('Activity_hours','Depression'),log_level=3) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.