Learn R Programming

permuco (version 1.1.1)

lmperm: Permutation tests for regression parameters

Description

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.

Usage

lmperm(
  formula,
  data = NULL,
  np = 5000,
  method = NULL,
  type = "permutation",
  ...
)

Arguments

formula

A formula object.

data

A data frame or matrix.

np

The number of permutations. Default value is 5000.

method

A character string indicating the method use to handle nuisance variables. Default is "freedman_lane". For the other methods, see details.

type

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.

Value

A lmperm object. See aovperm.

Details

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.

References

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.

See Also

aovperm plot.lmperm

Other main function: aovperm(), clusterlm()

Examples

Run this code
# NOT RUN {
## 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
# }

Run the code above in your browser using DataLab