F_test {breakaway}R Documentation

Conduct F test of null hypothesis LB = 0 using output from betta() or betta_random()

Description

This function performs an F-test of a null hypothesis LB = 0 where B is a vector of p fixed effects returned by betta() or betta_random() and L is an m x p matrix with linearly independent rows.

Usage

F_test(fitted_betta, L, method = "bootstrap", nboot = 1000)

Arguments

fitted_betta

A fitted betta object – i.e., the output of either betta() or betta_random() – containing fixed effect estimates of interest.

L

An m x p matrix defining the null LB = 0. L must have full row rank.

method

A character variable indicating which method should be used to estimate the distribution of the test statistic under the null.

nboot

Number of bootstrap samples to use if method = "bootstrap". Ignored if method = "asymptotic".

Value

A list containing

pval

The p-value

F_stat

The calculated F statistic

boot_F

A vector of bootstrapped F statistics if bootstrap has been used. Otherwise NULL.

Author(s)

David Clausen

References

Willis, A., Bunge, J., and Whitman, T. (2015). Inference for changes in biodiversity. arXiv preprint.

See Also

betta;

betta_random;

betta;

get_F_stat

Examples


# generate example data
df <- data.frame(chats = c(2000, 3000, 4000, 3000,
2000, 3000, 4000, 3000), ses = c(100, 200, 150, 180,
100, 200, 150, 180),
                 Cont_var = c(100, 150, 100, 50,
                 100, 150, 100, 50),
                 Cont_var_2 = c(50,200,25,125,
                 50,200,25,125))

# fit betta()
example_fit <- betta(formula = chats ~ Cont_var + Cont_var_2, ses = ses, data = df)


# construct L for hypothesis that B_cont_var = B_cont_var_2 = 0
L <- rbind(c(0,1,0),
           c(0,0,1))

F_test_results <- F_test(example_fit, L, nboot = 100)


[Package breakaway version 4.8.4 Index]