Extract a table of results for each response
Arguments
- fit
object from
lmFitResponses(),glmFitResponses(),lmmFitResponses(),glmmFitResponses()- coef
specify which coefficient, or combination of coefficients to test. Can be 1) a single coef name to test one coefficient:
"x1", 2) an array coef names to test multiple coefficients:c("x1", "x2"), 3) string of linear functions of coefficients:"x1 - x2".- ddf
"finite": use Satterthwaite approximation to denominator degrees of freedom for the Student t or F distribution, or"asymptotic"to use normal or chisq distribution as null for the test statistic- ...
other args, not used here
- df.prior
augment degrees of freedom due to shrinking residual variance terms. Defaults to zero to have no impact
Examples
# simulate data
n <- 1000
m <- 3
nc <- 2
Y <- matrix(rnorm(n * m), m, n)
data = data.frame(x = sample(c("0", "1", "2"), n, replace=TRUE))
rownames(Y) <- seq(m)
X <- model.matrix(~ x, data)
# fit regressions with model j using Y[,j] as a response
fit <- lmFitResponses(Y, X, detail=2)
# Univariate test
results(fit, "x1")
#> # A tibble: 3 × 5
#> ID Estimate se df p.value
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 1 -0.0183 0.0798 997 0.819
#> 2 2 -0.0406 0.0790 997 0.608
#> 3 3 0.139 0.0816 997 0.0881
# Joint test of 2 coefs
results(fit, c("x1", "x2"))
#> # A tibble: 3 × 5
#> ID F df1 df2 p.value
#> <chr> <dbl> <int> <dbl> <dbl>
#> 1 1 0.0271 2 997 0.973
#> 2 2 1.58 2 997 0.207
#> 3 3 1.47 2 997 0.230
# Contrast to compare coefficeints
results(fit, c("x1 - x2"))
#> # A tibble: 3 × 5
#> ID Estimate se df p.value
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 1 -0.0119 0.0809 997 0.883
#> 2 2 0.0992 0.0801 997 0.216
#> 3 3 0.0565 0.0828 997 0.495