Skip to content

Commit

Permalink
Merge pull request #4 from roqua/ae-elske-fixes
Browse files Browse the repository at this point in the history
Elske fixes
  • Loading branch information
emerencia committed Feb 5, 2015
2 parents 5566a97 + 2e98b44 commit 067366b
Show file tree
Hide file tree
Showing 53 changed files with 205 additions and 140 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: autovar
Version: 0.1-1
Date: 2014-07-07
Version: 0.2-0
Date: 2015-02-05
Title: Automated Vector Autoregression Model Creation
Authors@R: c(person("Ando","Emerencia",role = c("aut","cre"),
email = "[email protected]"))
Expand Down Expand Up @@ -28,6 +28,6 @@ Depends:
Suggests:
testthat,
roxygen2
Description: A package to simplify the process from raw SPSS or
STATA data to VAR models.
Description: A package to simplify the process from raw
data to VAR models.
License: Unlimited
9 changes: 7 additions & 2 deletions R/var_main.r
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@
#' @param 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 \code{\link{order_by}} function.
#' @param normalize_data determines whether the endogenous variables should be normalized.
#' @param 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.
#' @param split_up_outliers determines whether each outlier should have its own exogenous variable. This will make a difference for restricted models only, and only when there is a variable with multiple outliers.
#' @param split_up_outliers determines whether each outlier should have its own exogenous variable. This will make a difference only when there is a variable with multiple outliers.
#' @param format_output_like_stata when \code{TRUE}, all constraints and exogenous variables are always shown (i.e., it will now show exogenous variables that were included but constrained in all equations), and the constraints are formatted like in Stata.
#' @param exclude_almost when \code{TRUE}, only Granger causalities with p-value <= 0.05 are included in the results. When \code{FALSE}, p-values between 0.05 and 0.10 are also included in results as "almost Granger causalities" that have half the weight of actual Granger causalities in the Granger causality summary graph.
#' @param simple_models when \code{TRUE}, only simple models are returned, meaning we don't add constrained models. Also, this setting forces \code{exogenous_max_iterations} to 1 and forces the first iteration to search for outliers at the 2.5x std range (essentially skipping the first and second iteration).
#' @param simple_models when \code{TRUE}, four changes are made in the way Autovar works. \itemize{
#' \item \code{1} - Sets autovar to search only for lag 1 and lag 2 models. Additionally, the lag 2 models are restricted in the sense that only the autoregressive lag 2 is used, i.e., the cross-lagged parameters for lag 2 are constrained.
#' \item \code{2} - The normality assumption (sktest) no longer tests for kurtosis (only for skewness).
#' \item \code{3} - \code{exogenous_max_iterations} is set to 1, meaning we only search one iteration deep for masking outliers, and in this iteration, points that are 2.5xstd away in the residuals or in the squared residuals are masked as outliers.
#' \item \code{4} - Autovar no longer adds constrained versions of the valid models to the list of accepted models.
#' }
#' @param numcores is the number of cores to use in parallel for evaluation the model. When this variable is \code{1}, no parallel processing is used and all processing is done serially. This variable has to be an integer between 1 and 16. The default value is the detected number of cores on the system (using \code{detectCores()}). If the \code{log_level} is less than 3, the value for \code{numcores} is forced to 1 because output doesn't show up otherwise.
#' @return This function returns the modified \code{av_state} object. The lists of accepted and rejected models can be retrieved through \code{av_state$accepted_models} and \code{av_state$rejected_models}. To print these, use \code{print_accepted_models(av_state)} and \code{print_rejected_models(av_state)}.
#' @examples
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Autovar
=======

Autovar is an R package for automating and simplifying the process from raw SPSS or STATA data to VAR models. For the actual VAR calculations, Bernhard Pfaff's vars package is used.
Autovar is an R package for automating and simplifying the process from raw data to VAR models. For the actual VAR calculations, Bernhard Pfaff's vars package is used.

To install, type the following:

Expand Down
64 changes: 38 additions & 26 deletions inst/help_files/add_derived_column.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>add_derived_column. autovar 0.1-1</title>
<title>add_derived_column. autovar 0.2-0</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="">

Expand All @@ -20,7 +20,7 @@
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="#">autovar 0.1-1</a>
<a class="brand" href="#">autovar 0.2-0</a>
<div class="nav">
<ul class="nav">
<li><a href="index.html"><i class="icon-home icon-white"></i> Index</a></li>
Expand Down Expand Up @@ -86,18 +86,24 @@ <h2 id="examples">Examples</h2>
<pre class="examples"><div class='input'>av_state &lt;- load_file(&quot;../data/input/RuwedataAngela.sav&quot;)
</div>
<div class='output'>load_file loaded SPSS file with 35 columns:
[1] &quot;id (scl)&quot; &quot;geslacht (nom)&quot; &quot;leeftijd (scl)&quot;
[4] &quot;datum_MI (scl)&quot; &quot;roken (nom)&quot; &quot;BMI (scl)&quot;
[7] &quot;depressie_verleden (scl)&quot; &quot;hartfalen (nom)&quot; &quot;tijdstip (scl)&quot;
[10] &quot;norm_bewegen (nom)&quot; &quot;woon_werk (nom)&quot; &quot;minuten_woonwerk (scl)&quot;
[13] &quot;licht_matigwerk (nom)&quot; &quot;minuten_werk_licht (scl)&quot; &quot;zwaar_werk (nom)&quot;
[16] &quot;minuten_zwaar_werk (scl)&quot; &quot;licht_huishouden (nom)&quot; &quot;minuten_licht_huishouden (scl)&quot;
[19] &quot;zwaar_huishouden (nom)&quot; &quot;minuten_zwaarhuishouden (scl)&quot; &quot;vrije_tijd (nom)&quot;
[22] &quot;minuten_vrijetijd (scl)&quot; &quot;sport (nom)&quot; &quot;minuten_sport (scl)&quot;
[25] &quot;PHQ1 (nom)&quot; &quot;PHQ2 (nom)&quot; &quot;PHQ3 (nom)&quot;
[28] &quot;PHQ4 (nom)&quot; &quot;PHQ5 (nom)&quot; &quot;PHQ6 (nom)&quot;
[31] &quot;PHQ7 (nom)&quot; &quot;PHQ8 (nom)&quot; &quot;PHQ9 (nom)&quot;
[34] &quot;beperking (nom)&quot; &quot;angst (nom)&quot;
[1] &quot;id (scl)&quot; &quot;geslacht (nom)&quot;
[3] &quot;leeftijd (scl)&quot; &quot;datum_MI (scl)&quot;
[5] &quot;roken (nom)&quot; &quot;BMI (scl)&quot;
[7] &quot;depressie_verleden (scl)&quot; &quot;hartfalen (nom)&quot;
[9] &quot;tijdstip (scl)&quot; &quot;norm_bewegen (nom)&quot;
[11] &quot;woon_werk (nom)&quot; &quot;minuten_woonwerk (scl)&quot;
[13] &quot;licht_matigwerk (nom)&quot; &quot;minuten_werk_licht (scl)&quot;
[15] &quot;zwaar_werk (nom)&quot; &quot;minuten_zwaar_werk (scl)&quot;
[17] &quot;licht_huishouden (nom)&quot; &quot;minuten_licht_huishouden (scl)&quot;
[19] &quot;zwaar_huishouden (nom)&quot; &quot;minuten_zwaarhuishouden (scl)&quot;
[21] &quot;vrije_tijd (nom)&quot; &quot;minuten_vrijetijd (scl)&quot;
[23] &quot;sport (nom)&quot; &quot;minuten_sport (scl)&quot;
[25] &quot;PHQ1 (nom)&quot; &quot;PHQ2 (nom)&quot;
[27] &quot;PHQ3 (nom)&quot; &quot;PHQ4 (nom)&quot;
[29] &quot;PHQ5 (nom)&quot; &quot;PHQ6 (nom)&quot;
[31] &quot;PHQ7 (nom)&quot; &quot;PHQ8 (nom)&quot;
[33] &quot;PHQ9 (nom)&quot; &quot;beperking (nom)&quot;
[35] &quot;angst (nom)&quot;
</div>
<div class='input'>av_state &lt;- add_derived_column(av_state,&#39;SomPHQ&#39;,c(&#39;PHQ1&#39;,&#39;PHQ2&#39;,&#39;PHQ3&#39;,&#39;PHQ4&#39;,
&#39;PHQ5&#39;,&#39;PHQ6&#39;,&#39;PHQ7&#39;,&#39;PHQ8&#39;,&#39;PHQ9&#39;),
Expand All @@ -107,18 +113,24 @@ <h2 id="examples">Examples</h2>
</div>
<div class='input'>column_names_output(av_state)
</div>
<div class='output'> [1] &quot;id (scl)&quot; &quot;geslacht (nom)&quot; &quot;leeftijd (scl)&quot;
[4] &quot;datum_MI (scl)&quot; &quot;roken (nom)&quot; &quot;BMI (scl)&quot;
[7] &quot;depressie_verleden (scl)&quot; &quot;hartfalen (nom)&quot; &quot;tijdstip (scl)&quot;
[10] &quot;norm_bewegen (nom)&quot; &quot;woon_werk (nom)&quot; &quot;minuten_woonwerk (scl)&quot;
[13] &quot;licht_matigwerk (nom)&quot; &quot;minuten_werk_licht (scl)&quot; &quot;zwaar_werk (nom)&quot;
[16] &quot;minuten_zwaar_werk (scl)&quot; &quot;licht_huishouden (nom)&quot; &quot;minuten_licht_huishouden (scl)&quot;
[19] &quot;zwaar_huishouden (nom)&quot; &quot;minuten_zwaarhuishouden (scl)&quot; &quot;vrije_tijd (nom)&quot;
[22] &quot;minuten_vrijetijd (scl)&quot; &quot;sport (nom)&quot; &quot;minuten_sport (scl)&quot;
[25] &quot;PHQ1 (nom)&quot; &quot;PHQ2 (nom)&quot; &quot;PHQ3 (nom)&quot;
[28] &quot;PHQ4 (nom)&quot; &quot;PHQ5 (nom)&quot; &quot;PHQ6 (nom)&quot;
[31] &quot;PHQ7 (nom)&quot; &quot;PHQ8 (nom)&quot; &quot;PHQ9 (nom)&quot;
[34] &quot;beperking (nom)&quot; &quot;angst (nom)&quot; &quot;SomPHQ (scl)&quot;
<div class='output'> [1] &quot;id (scl)&quot; &quot;geslacht (nom)&quot;
[3] &quot;leeftijd (scl)&quot; &quot;datum_MI (scl)&quot;
[5] &quot;roken (nom)&quot; &quot;BMI (scl)&quot;
[7] &quot;depressie_verleden (scl)&quot; &quot;hartfalen (nom)&quot;
[9] &quot;tijdstip (scl)&quot; &quot;norm_bewegen (nom)&quot;
[11] &quot;woon_werk (nom)&quot; &quot;minuten_woonwerk (scl)&quot;
[13] &quot;licht_matigwerk (nom)&quot; &quot;minuten_werk_licht (scl)&quot;
[15] &quot;zwaar_werk (nom)&quot; &quot;minuten_zwaar_werk (scl)&quot;
[17] &quot;licht_huishouden (nom)&quot; &quot;minuten_licht_huishouden (scl)&quot;
[19] &quot;zwaar_huishouden (nom)&quot; &quot;minuten_zwaarhuishouden (scl)&quot;
[21] &quot;vrije_tijd (nom)&quot; &quot;minuten_vrijetijd (scl)&quot;
[23] &quot;sport (nom)&quot; &quot;minuten_sport (scl)&quot;
[25] &quot;PHQ1 (nom)&quot; &quot;PHQ2 (nom)&quot;
[27] &quot;PHQ3 (nom)&quot; &quot;PHQ4 (nom)&quot;
[29] &quot;PHQ5 (nom)&quot; &quot;PHQ6 (nom)&quot;
[31] &quot;PHQ7 (nom)&quot; &quot;PHQ8 (nom)&quot;
[33] &quot;PHQ9 (nom)&quot; &quot;beperking (nom)&quot;
[35] &quot;angst (nom)&quot; &quot;SomPHQ (scl)&quot;
</div>
<div class='input'>av_state &lt;- load_file(&quot;../data/input/pp1 nieuw compleet.sav&quot;,log_level=3)
av_state &lt;- add_derived_column(av_state,&#39;SomBewegUur&#39;,&#39;SomBewegen&#39;,
Expand Down
Loading

0 comments on commit 067366b

Please sign in to comment.