permTest_LR_int: Perform a permutation test on an interaction using the...

View source: R/permTest_LR_int.R

permTest_LR_intR Documentation

Perform a permutation test on an interaction using the likelyhood ratio test

Description

This function performs a permutation test on an interaction in a model object using a likelyhood ratio test. It does this by re-sampling the column(s) indicated, and refitting two models to the new data: one with and one without the interaction. The function then performs a likelyhood ratio test using the anova function on these two models, creating a simulated permutation test output. Because two models are needed to be created on each iteration to test the interaction, this function is the slowest of the permutation tests.

Usage

permTest_LR_int(
  Model_Object,
  Test_Parameter,
  Randomize_Variables,
  Test_Statistic,
  Replication,
  UseAllAvailableCores = TRUE,
  OutputData = FALSE
)

Arguments

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"

Randomize_Variables

A character vector of variables that are to be randomized in the permutation test. ex. c("var1","var2") or "var1".

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 ?

Value

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.


RichieHonor/PermutateR documentation built on July 2, 2023, 2:07 p.m.