Closed testing procedure

closed.testing(
  object,
  idx = seq_along(coef(object)),
  null,
  return.all = FALSE,
  ...
)

Arguments

object

estimate object

idx

Index of parameters to adjust for multiple testing

null

Null hypothesis value

return.all

If TRUE details on all intersection hypotheses are returned

...

Additional arguments

Examples

m <- lvm()
regression(m, c(y1,y2,y3,y4,y5,y6,y7)~x) <- c(0,0.25,0,0.25,0.25,0,0)
regression(m, to=endogenous(m), from="u") <- 1
variance(m,endogenous(m)) <- 1
set.seed(2)
d <- sim(m,200)
l1 <- lm(y1~x,d)
l2 <- lm(y2~x,d)
l3 <- lm(y3~x,d)
l4 <- lm(y4~x,d)
l5 <- lm(y5~x,d)
l6 <- lm(y6~x,d)
l7 <- lm(y7~x,d)

(a <- merge(l1,l2,l3,l4,l5,l6,l7,subset=2))
#>     Estimate Std.Err      2.5%  97.5%   P-value
#> x   -0.02201 0.09932 -0.216676 0.1727 8.246e-01
#> ───                                            
#> x.1  0.37231 0.11565  0.145637 0.5990 1.285e-03
#> ───                                            
#> x.2  0.11982 0.11103 -0.097795 0.3374 2.805e-01
#> ───                                            
#> x.3  0.42234 0.09264  0.240763 0.6039 5.143e-06
#> ───                                            
#> x.4  0.29344 0.12136  0.055578 0.5313 1.561e-02
#> ───                                            
#> x.5  0.20565 0.10618 -0.002458 0.4138 5.277e-02
#> ───                                            
#> x.6  0.05240 0.11817 -0.179216 0.2840 6.575e-01
if (requireNamespace("mets",quietly=TRUE)) {
   p.correct(a)
}
#>        Estimate      P-value  Adj.P-value
#> x   -0.02200928 8.246281e-01 9.999717e-01
#> x.1  0.37230924 1.285283e-03 7.949481e-03
#> x.2  0.11982376 2.805072e-01 7.862887e-01
#> x.3  0.42233507 5.143276e-06 3.258334e-05
#> x.4  0.29343730 1.560907e-02 7.879128e-02
#> x.5  0.20565002 5.276836e-02 2.278589e-01
#> x.6  0.05240058 6.574626e-01 9.974245e-01
#> attr(,"adjusted.significance.level")
#> [1] 0.009449507
as.vector(closed.testing(a))
#>  [1] -2.200928e-02  3.723092e-01  1.198238e-01  4.223351e-01  2.934373e-01
#>  [6]  2.056500e-01  5.240058e-02  8.246281e-01  1.285283e-03  2.805072e-01
#> [11]  5.143276e-06  1.560907e-02  5.276836e-02  6.574626e-01  8.246281e-01
#> [16]  2.079368e-02  6.158723e-01  1.020005e-04  8.219621e-02  1.907677e-01
#> [21]  7.835113e-01