regression-tests.permutations
permute-r-squared
(permute-r-squared y x permutations)
Runs a permutation test for overall significance of the regression model.
y: A list of dependent variable values.
x: A list of predictors.
permutations: A list of random permutations (by index).
returns: A hash-map with p-value, lower and upper bound of
the 95% confidence interval and permutation sample for r-squared.
## Usage
(require '[regression-tests.permutations :refer :all])
(def y [1.1 1 0.95 1.15 2.1 2.05 3 3.01 3.02 2.9])
(def x [[1 1 4] [2 3 2] [2 2 3] [1.5 1.5 1.5] [3 3.1 5] [3.5 3 5.5]
[4 3 6] [3.8 2.5 6.3] [3.9 2.7 6.5] [4.2 3.4 6]])
(def permutations [[0 2 1 8 3 4 5 6 9 7]
[5 0 1 3 2 4 8 6 7 9]
[0 2 3 5 4 1 6 7 8 9]])
(permute-r-squared y x permutations)
=>
{:p-value [0.25 -0.17435244785437493 0.674352447854375],
:sample [0.9467146097039536 0.7483687115380364 0.7974802262317389 0.6996691908442358]}
## References
[1] Anderson, M. (2001). Permutation tests for univariate or multivariate analysis of variance and regression.
Canadian Journal of Fisheries and Aquatic Sciences, 58(3): 626-639. DOI: 10.1139/f01-004.
permute-t-stat
(permute-t-stat y x permutations index)
Runs a permutation test to check significance
of the individual coefficient in the regression model
(by Freedman & Lane, 1983).
y: A list of dependent variable values.
x: A list of predictors.
permutations: A list of random permutations (by index).
index: Coefficient index.
returns: p-value, lower and upper bound of the 95% confidence interval.
## Usage
(require '[regression-tests.permutations :refer :all])
(def y [1.1 1 0.95 1.15 2.1 2.05 3 3.01 3.02 2.9])
(def x [[1 1 4] [2 3 2] [2 2 3] [1.5 1.5 1.5] [3 3.1 5] [3.5 3 5.5]
[4 3 6] [3.8 2.5 6.3] [3.9 2.7 6.5] [4.2 3.4 6]])
(def permutations [[0 2 1 8 3 4 5 6 9 7]
[5 0 1 3 2 4 8 6 7 9]
[0 2 3 5 4 1 6 7 8 9]])
(permute-t-stat y x permutations 0)
=> [0.0 0.0 0.0]
(permute-t-stat y x permutations 1)
=> [0.0 0.0 0.0]
(permute-t-stat y x permutations 2)
=> [0.25 -0.17435244785437493 0.674352447854375]
## References
[1] Anderson, M. (2001). Permutation tests for univariate or multivariate analysis of variance and regression.
Canadian Journal of Fisheries and Aquatic Sciences, 58(3): 626-639. DOI: 10.1139/f01-004.
[2] Freedman, D., & Lane, D. (1983). A Nonstochastic Interpretation of Reported Significance Levels.
Journal of Business & Economic Statistics, 1(4): 292-298. DOI: 10.2307/1391660.