Type: | Package |
Title: | Perform Permutation Test on General Linear and Mixed Linear Regression |
Version: | 0.1.9 |
Description: | We provide a solution for performing permutation tests on linear and mixed linear regression models. It allows users to obtain accurate p-values without making distributional assumptions about the data. By generating a null distribution of the test statistics through repeated permutations of the response variable, permutation tests provide a powerful alternative to traditional parameter tests (Holt et al. (2023) <doi:10.1007/s10683-023-09799-6>). In this early version, we focus on the permutation tests over observed t values of beta coefficients, i.e.original t values generated by parameter tests. After generating a null distribution of the test statistic through repeated permutations of the response variable, each observed t values would be compared to the null distribution to generate a p-value. To improve the efficiency,a stop criterion (Anscombe (1953) <doi:10.1111/j.2517-6161.1953.tb00121.x>) is adopted to force permutation to stop if the estimated standard deviation of the value falls below a fraction of the estimated p-value. By doing so, we avoid the need for massive calculations in exact permutation methods while still generating stable and accurate p-values. |
License: | GPL-3 |
Encoding: | UTF-8 |
Imports: | lmerTest,stats |
RoxygenNote: | 7.2.3 |
NeedsCompilation: | no |
Packaged: | 2023-04-16 17:55:41 UTC; Administrator |
Author: | Wentao Zeng [aut, cre, cph] |
Maintainer: | Wentao Zeng <wentaozeng@aliyun.com> |
Repository: | CRAN |
Date/Publication: | 2023-04-18 14:10:06 UTC |
This function is used for permutation test for general and mixed linear regression
Description
perform general and mixed linear regression by lm function in R base or lmer function in lmer/lmertest package and permutation tests on observed t values of beta coef -ficients
Usage
lmerp(formula, data, thresh, R, mixed, minimum)
Arguments
formula |
Regression formula in the form 'y~x1+x2+x3' for general linear function or 'y~x1+x2+x3+(1|x4)' or 'y~x1+x2+x3+(x3|x4)' for mixed linear function |
data |
A data frame specifying the data to be analysed |
thresh |
Threshold to stop iteration, default value is 0.1 |
R |
The maximum number of iteration, default value is 1000 |
mixed |
A logic value indicates if you desire to perform mixed linear model or not. Default value is FALSE. |
minimum |
The minimum number of iteration, default value is 50 |
Value
A list contains 2 items: Results and T_perm, the former contains results of origi -nal parameter test and results of permutation test including adjusted confident interval (Ci_perm), p values (P_perm), iteration number(Iteration), the later contains a list cont -ains all t values generated in each permutation
Examples
formula<-mpg~cyl
data<-mtcars
my_perm<-lmerp(formula,data)
This function defines the permutation strategry
Description
perform permuation on response variable i.e. y, using the stop criterion suggested by Anscombe
Usage
permute_fun(data, mle)
Arguments
data |
A data frame specifying the data to be analysed. |
mle |
A string that indicated response variable |
Value
A data frame containing the data with a permuted y.
Examples
data<-mtcars
permute<-permute_fun(data=data,mle='mpg')
Return t values of general linear model
Description
perform mixed linear regression in lmer/lmertest package for getting observed t values or permutation test
Usage
s1(data, formula)
Arguments
data |
A dataframe specifying the data to be analysed |
formula |
A formula in the form like'y~x1+x2+x3 in lm function |
Value
An object of class "lm"
Examples
data<-mtcars
formula<-mpg~cyl
s1(data=data,formula=formula)
Estimate t values of mixed linear model
Description
perform mixed linear regression in lmerTest package for getting observed t values or permutation test
Usage
s2(data, formula)
Arguments
data |
A dataframe specifying the data to be analysed |
formula |
A formula in the form like'y~x1+x2+x3+(1|x4) or like'y~x1+x2+x3 +(x3|x4) in lmer function |
Value
An object of class "lmerTest"
Examples
data<-mtcars
formula<-mpg~cyl+(1|gear)
statistic<-s2(data=data,formula=formula)