jlsp
performs the joint location-and-scale test using
Fisher's method.
Arguments
- y
vector of outcome values
- x
vector of exposure values
- covar
data.frame
of covariates- covar.var
adjust the second stage (variance component) of the approach by the covariates
- x.sq
include x-squared in the variance part of the model
- type
type of test, where
1
= Breusch-Pagan variance test, and2
= Brown-Forsythe variance test (default:1
)
Value
jlsp
returns a list
of results:
- Q / F
the test statistic
- DF
the degrees of freedom
- P
the p-value
Author
James Staley jrstaley95@gmail.com
Examples
x <- rbinom(1000, 1, 0.5)
y <- 0.5 + 0.025 * x + rnorm(1000, 0, sqrt(0.005 * x)) + rnorm(1000, 0, 0.1)
jlsp(y, x, var.type = 2)
#> $location_test
#> $location_test$coef
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 0.5051985 0.004923175 102.616400 0.0000000000
#> x 0.0248402 0.007091233 3.502946 0.0004805401
#>
#> $location_test$test
#> F DF P
#> 1 12.27063 1 0.0004805401
#>
#>
#> $scale_test
#> $scale_test$coef
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 0.08014668 0.002967853 27.004939 5.160697e-121
#> x 0.01835758 0.004274830 4.294343 1.923144e-05
#>
#> $scale_test$test
#> F DF P
#> 1 18.44138 1 1.923144e-05
#>
#>
#> $location_scale_test
#> Q DF P
#> 1 36.99913 4 1.802048e-07
#>