Compute permutation marginal tests for linear models. This function produces t statistics with univariate and bivariate p-values. It gives the choice between multiple methods to handle nuisance variables.
lmperm(
formula,
data = NULL,
np = 5000,
method = NULL,
type = "permutation",
...
)
A formula object.
A data frame or matrix.
The number of permutations. Default value is 5000
.
A character string indicating the method use to handle nuisance variables. Default is "freedman_lane"
. For the other methods, see details.
A character string to specify the type of transformations: "permutation" and "signflip" are available. Is overridden if P is given. See help from Pmat.
Futher arguments, see details.
A lmperm
object. See aovperm.
The following methods are available for the fixed effects model defined as \(y = D\eta + X\beta + \epsilon\). If we want to test \(\beta = 0\) and take into account the effects of the nuisance variables \(D\), we transform the data :
method argument | \(y*\) | \(D*\) | \(X*\) |
"draper_stoneman" | \(y\) | \(D\) | \(PX\) |
"freedman_lane" | \((H_D+PR_D)y\) | \(D\) | \(X\) |
"manly" | \(Py\) | \(D\) | \(X\) |
"terBraak" | \((H_{X,D}+PR_{X,D})y\) | \(D\) | \(X\) |
"kennedy" | \(PR_D y\) | \(R_D X\) | |
"huh_jhun" | \(PV'R_Dy\) | \(V'R_D X\) | |
"dekker" | \(y\) | \(D\) | \(PR_D X\) |
Other arguments could be pass in ...
:P
: a matrix containing the permutations of class matrix
or Pmat
for the reproductibility of the results. The first column must be the identity. P
overwrites np
argument. rnd_rotation
: a random matrix of size \(n \times n\) to compute the rotation used for the "huh_jhun"
method.
Kherad-Pajouh, S., & Renaud, O. (2010). An exact permutation method for testing any effect in balanced and unbalanced fixed effect ANOVA. Computational Statistics & Data Analysis, 54(7), 1881-1893.
Kherad-Pajouh, S., & Renaud, O. (2015). A general permutation approach for analyzing repeated measures ANOVA and mixed-model designs. Statistical Papers, 56(4), 947-967.
Winkler, A. M., Ridgway, G. R., Webster, M. A., Smith, S. M., & Nichols, T. E. (2014). Permutation inference for the general linear model. Neuroimage, 92, 381-397.
## data
data("emergencycost")
## Testing at 14 days
emergencycost$LOS14 <- emergencycost$LOS - 14
## Univariate t test
contrasts(emergencycost$insurance) <- contr.sum
contrasts(emergencycost$sex) <- contr.sum
## Warning : np argument must be greater (recommendation: np>=5000)
modlm_cost_14 <- lmperm(cost ~ LOS14*sex*insurance, data = emergencycost, np = 2000)
modlm_cost_14
#> Table of marginal t-test of the betas
#> Resampling test using freedman_lane to handle nuisance variables and 2000 permutations.
#> Estimate Std. Error t value parametric Pr(>|t|)
#> (Intercept) 14217.0 360.17 39.4730 6.648e-87
#> LOS14 845.5 38.45 21.9873 2.588e-51
#> sex1 -894.7 360.17 -2.4840 1.397e-02
#> insurance1 169.1 360.17 0.4696 6.392e-01
#> LOS14:sex1 -52.2 38.45 -1.3575 1.765e-01
#> LOS14:insurance1 98.1 38.45 2.5512 1.163e-02
#> sex1:insurance1 -149.7 360.17 -0.4155 6.783e-01
#> LOS14:sex1:insurance1 -66.7 38.45 -1.7347 8.463e-02
#> resampled Pr(<t) resampled Pr(>t) resampled Pr(>|t|)
#> (Intercept)
#> LOS14 1.0000 0.0005 0.0005
#> sex1 0.0130 0.9875 0.0210
#> insurance1 0.6890 0.3115 0.6085
#> LOS14:sex1 0.0775 0.9230 0.1655
#> LOS14:insurance1 0.9900 0.0105 0.0215
#> sex1:insurance1 0.3345 0.6660 0.6435
#> LOS14:sex1:insurance1 0.0435 0.9570 0.0860