vartest | R Documentation |
vartest performs variability tests by either the Breusch-Pagan or Brown-Forsythe methods.
vartest(y, x, covar = NULL, covar.var = FALSE, type = 1, x.sq = FALSE)
y |
vector of outcome values |
x |
vector of exposure values |
covar |
|
covar.var |
adjust the second stage (variance component) of the approach by the covariates |
type |
type of test, where
|
x.sq |
include x-squared in the variance part of the model |
vartest
returns a list
of results:
coef |
model coefficients from variance part of the model |
test |
|
F
: the test statistic
DF
: the degrees of freedom
P
: the p-value
James Staley jrstaley95@gmail.com
x <- rbinom(1000, 1, 0.5)
y <- 0.5 + 0.025 * x + rnorm(1000, 0, sqrt(0.005 * x)) + rnorm(1000, 0, 0.1)
vartest(y, x, type = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.