Description Usage Arguments Details Value Note See Also Examples

This function tests the specified linear hypothesis in `model`

assuming the errors are distributionally invariant
with respect to stochastic function `g_invar`

.

1 | ```
rrtest(model, g_invar, num_R = 999, alpha = 0.05, val_type = "decision")
``` |

`model` |
Regression model and hypothesis. See example_model for details. |

`g_invar` |
Stochastic function that transforms residuals. Accepts n-vector and returns n-vector. |

`num_R` |
Number of test statistic values to calculate in the randomization test. |

`alpha` |
Nominal test level (between 0 to 1). |

`val_type` |
The type of return value. |

For the regression y = X * beta + e, this function is testing the following linear null hypothesis:

H0: lam' beta = lam[1] * beta[1] + ... + lam[p] * beta[p] = lam0,

where y, X, lam, lam0 are specified in `model`

.
The assumption is that the errors, e, have some form of cluster invariance.
Specifically:

(e_1, e_2, ..., e_n) ~ g_invar(e_1, e_2, ..., e_n),

where ~ denotes equality in distribution, and `g_invar`

is the supplied
invariance function.

If `val_type`

= "decision" (default) we get the test binary decision (1=REJECT H0).

If `val_type`

= "pval" we get the test p-value.

If `val_type`

= "full" we get the full test output, i.e., a `List`

with elements `tobs`

, `tvals`

,
the observed and randomization values of the test statistic, respectively.

There is no guarantee that an arbitrary `g_invar`

will produce valid tests.
The rrtest_clust function has such guarantees under mild assumptions.

Life after bootstrap: residual randomization inference in regression models (Toulis, 2019)

https://www.ptoulis.com/residual-randomization

1 2 3 | ```
model = example_model(n = 100) # test H0: beta2 = 0 (here, H0 is true)
g_invar = function(e) sample(e) # Assume errors are exchangeable.
rrtest(model, g_invar) # same as rrtest_clust(model, "perm")
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.