flxglht.RdExtracts coefficient estimates and their covariance estimate to perform tests for zero coefficients or constant effects re-using functionality from package multcomp.
flxglht(model, linfct, ...)
# S4 method for class 'flexmix,character'
flxglht(model, linfct, ...)
# S4 method for class 'FLXRoptim,character'
flxglht(model, linfct, ...)Only tested for finite mixture models fitted with driver
FLXMRglm.
An object of class "glht".
Friedrich Leisch and Torsten Hothorn. Simultaneous Inference in Finite Mixtures of Regression Models. Austrian Journal of Statistics, forthcoming.
data("NPreg", package = "flexmix")
ex1 <- flexmix(yn ~ x + I(x^2), data = NPreg, k = 2,
control = list(verb = 5, iter = 100))
#> Classification: weighted
#> 5 Log-likelihood : -720.7965
#> 10 Log-likelihood : -649.6249
#> 15 Log-likelihood : -642.5451
#> converged
zero_effect <- flxglht(ex1, "zero")
zero_effect
#>
#> General Linear Hypotheses
#>
#> Linear Hypotheses:
#> Estimate
#> C1.(Intercept) == 0 -0.20851
#> C2.(Intercept) == 0 14.71325
#> C1.x == 0 4.81446
#> C2.x == 0 9.84830
#> C1.I(x^2) == 0 0.03654
#> C2.I(x^2) == 0 -0.96852
#>
summary(zero_effect)
#>
#> Simultaneous Tests for General Linear Hypotheses
#>
#> Linear Hypotheses:
#> Estimate Std. Error z value Pr(>|z|)
#> C1.(Intercept) == 0 -0.20851 1.00921 -0.207 0.999
#> C2.(Intercept) == 0 14.71325 1.32377 11.115 <1e-04 ***
#> C1.x == 0 4.81446 0.50961 9.447 <1e-04 ***
#> C2.x == 0 9.84830 0.59158 16.647 <1e-04 ***
#> C1.I(x^2) == 0 0.03654 0.04976 0.734 0.865
#> C2.I(x^2) == 0 -0.96852 0.05526 -17.526 <1e-04 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> (Adjusted p values reported -- single-step method)
#>
comp_effect <- flxglht(ex1, "tukey")
comp_effect
#>
#> General Linear Hypotheses
#>
#> Linear Hypotheses:
#> Estimate
#> C2.(Intercept)-C1.(Intercept) == 0 14.922
#> C2.x-C1.x == 0 5.034
#> C2.I(x^2)-C1.I(x^2) == 0 -1.005
#>
summary(comp_effect)
#>
#> Simultaneous Tests for General Linear Hypotheses
#>
#> Linear Hypotheses:
#> Estimate Std. Error z value Pr(>|z|)
#> C2.(Intercept)-C1.(Intercept) == 0 14.92176 1.59810 9.337 <1e-10 ***
#> C2.x-C1.x == 0 5.03383 0.74393 6.766 <1e-10 ***
#> C2.I(x^2)-C1.I(x^2) == 0 -1.00506 0.07098 -14.160 <1e-10 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> (Adjusted p values reported -- single-step method)
#>