View source: R/PermTest_Contrast.R
permTest_Contrast | R Documentation |
This function performs a permutation test on a model object. The permutation test is based on the test statistics derived from the function "summary", which are typically contrasts. One must specify the variable(s) to be randomized, the test parameter(s), and the amount of replication to be performed. This function can perform extract multiple test parameters from the same fitted model thus allowing permutation tests of multiple parameters to be performed at once, efficiently. This function works on lm, glm, lmer, glmer, glmmTMB, and Lavaan classes.
permTest_Contrast(
Model_Object,
Test_Parameter,
Randomize_Variables,
Test_Statistic,
Replication,
UseAllAvailableCores = TRUE,
OutputData = FALSE,
Data_Supplement = NULL
)
Model_Object |
A statistical model object. |
Test_Parameter |
A character string indicating the parameter that the permutation test is to be performed on. For example, 'var1:var2' or "var1". This function also has functionality to extract multiple test statistics from a single permutation test. To perform permutation tests on multiple parameters, input a vector of parameters. For example c("var1:var2","var1","var3"). |
Randomize_Variables |
A character vector indicating the variables that are to be randomized in the permutation test |
Test_Statistic |
A Character string indicating the desired test statistic to conduct the permutation test.This can be an f value, chi-squared value, p-value...etc, depending on what test statistics are available for your model object. These are different for lm, glm, glmmTMB, etc. |
Replication |
The number of simulations in the permutation test. |
OutputData |
Should the simulated test statistics be outputted ? |
Data_Supplement |
The data frame that the model is built on. This is necessary to supply for models of the class "lavaan" as there is not functionality to extract the data frame from the model object. |
A list of two items. The first is a data frame of results of the permutation test. The second is a histogram displaying the sampling distribution of the simulated test statistics, with a red line displaying the test statistic of the original (non-randomized) data. If OutputData=T, then a vector of simulated test statistics will also be included in the output list. If multiple test parameters are supplied, then this output will be in a list for each test parameter.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.