Running examples in 'rineq-Ex.R' failed
The error most likely occurred in:

> ### Name: contribution
> ### Title: Function to decompose the Relative Concentration Index into its
> ###   components
> ### Aliases: contribution
> 
> ### ** Examples
> 
> data(housing)
> 
> ## Linear regression direct decomposition
> fit.lm <- lm(bmi ~ sex + tenure + place + age,data = housing)
>        
> # decompose relative concentration index
> contrib.lm <- contribution(fit.lm, housing$income) 
> summary(contrib.lm)
Overall CI: 0.121004 
95% confidence interval: 0.1181791 0.123829 

Decomposition:
                    Contribution (%) Contribution (Abs) Elasticity
residual                  38.2448886          0.0462779  0.0000000
sexmale                   70.3033532          0.0850699  0.2241433
tenureirregular          -16.8438839         -0.0203818  0.0307882
tenureown_apartment        0.0751962          0.0000910  0.0018771
tenureown_house            1.3489119          0.0016322  0.0136284
tenurerent                 6.6988511          0.0081059  0.0517000
placeurban                 0.0671404          0.0000812 -0.0123887
age                        0.1055426          0.0001277  0.0324067
                    Concentration Index   lower 5%   upper 5% Corrected
residual                             NA         NA         NA        no
sexmale                       0.3795336  0.3691540  0.3899131        no
tenureirregular              -0.6619993 -0.6980505 -0.6259481        no
tenureown_apartment           0.0484737  0.0260028  0.0709447        no
tenureown_house               0.1197676  0.0926766  0.1468586        no
tenurerent                    0.1567869  0.1440879  0.1694859        no
placeurban                   -0.0065578 -0.0188208  0.0057052        no
age                           0.0039409 -0.0000583  0.0079401        no
> plot(contrib.lm, decreasing = FALSE, horiz = TRUE)
> 
>     
> # GLM: Decomposition based on predicted outcome
> fit.logit <-glm(high.bmi ~ sex + tenure + place + age, data = housing)
> 
> contrib.logit <- contribution(fit.logit, housing$income) 
> summary(contrib.logit)
Overall CI: 0.2502025 
95% confidence interval: 0.2429066 0.2574983 

Decomposition:
                    Contribution (%) Contribution (Abs) Elasticity
residual                   0.0000000          0.0000000  0.0000000
sexmale                  108.4563232          0.2713604  0.7149839
tenureirregular          -17.2872968         -0.0432532  0.0653373
tenureown_apartment        0.1140275          0.0002853  0.0058857
tenureown_house            1.4916426          0.0037321  0.0311614
tenurerent                 7.0608518          0.0176664  0.1126780
placeurban                 0.0573415          0.0001435 -0.0218778
age                        0.1071102          0.0002680  0.0680031
                    Concentration Index   lower 5%   upper 5% Corrected
residual                             NA         NA         NA        no
sexmale                       0.3795336  0.3691540  0.3899131        no
tenureirregular              -0.6619993 -0.6980505 -0.6259481        no
tenureown_apartment           0.0484737  0.0260028  0.0709447        no
tenureown_house               0.1197676  0.0926766  0.1468586        no
tenurerent                    0.1567869  0.1440879  0.1694859        no
placeurban                   -0.0065578 -0.0188208  0.0057052        no
age                           0.0039409 -0.0000583  0.0079401        no
> plot(contrib.logit, decreasing = FALSE,horiz = TRUE)
> 
> 
> # GLM probit: Decomposition based on predicted outcome
> fit.probit <-glm(high.bmi ~ sex + tenure + place + age, data = housing, 
+                 family = binomial(link = probit))
> 
> # binary, set type to 'CIw'
> contrib.probit <- contribution(fit.probit, housing$income, type = "CIw") 
> summary(contrib.probit)
Overall CI: -0.26355 
95% confidence interval: -0.2718336 -0.2552664 
(based on a corrected value)

Decomposition:
                    Contribution (%) Contribution (Abs) Elasticity
residual                 272.0517695         -0.7169924  0.0000000
sexmale                 -179.3760257          0.4727455  0.6287769
tenureirregular           25.5830437         -0.0674241  0.0866431
tenureown_apartment       -0.1800413          0.0004745  0.0077997
tenureown_house           -2.1688445          0.0057160  0.0404237
tenurerent               -15.7773222          0.0415811  0.1471374
placeurban                -0.1352142          0.0003564 -0.0293442
age                        0.0026347         -0.0000069  0.0893297
                    Concentration Index   lower 5%   upper 5% Corrected
residual                             NA         NA         NA        no
sexmale                       0.7518494  0.7312877  0.7724110        no
tenureirregular              -0.7781818 -0.8205601 -0.7358035        no
tenureown_apartment           0.0608355  0.0326340  0.0890370        no
tenureown_house               0.1414021  0.1094175  0.1733867        no
tenurerent                    0.2826007  0.2597114  0.3054901        no
placeurban                   -0.0121440 -0.0348533  0.0105652        no
age                          -0.0000777 -0.0001566  0.0000012        no
> plot(contrib.probit, decreasing = FALSE,horiz = TRUE)
> 
> 
> # Marginal effects probit using package 'mfx': Decomposition based on predicted outcome
> fit.mfx <-mfx::probitmfx(high.bmi ~ sex + tenure + place + age, data = housing)
> 
> contrib.mfx <- contribution(fit.mfx, housing$income, type = "CIw") 
> summary(contrib.mfx, type="CIw")
Overall CI: 0.6906082 
95% confidence interval: 0.6694697 0.7117467 

Decomposition:
                    Contribution (%) Contribution (Abs) Elasticity
residual                  22.2833787          0.1538908  0.0000000
sexmale                   80.4392036          0.5555197  0.7388710
tenureirregular          -12.5529543         -0.0866917  0.1114029
tenureown_apartment        0.0984600          0.0006800  0.0111772
tenureown_house            1.1582469          0.0079989  0.0565688
tenurerent                 8.5011533          0.0587097  0.2077477
placeurban                 0.0739535          0.0005107 -0.0420559
age                       -0.0014417         -0.0000100  0.1280922
                    Concentration Index   lower 5%   upper 5% Corrected
residual                             NA         NA         NA        no
sexmale                       0.7518494  0.7312877  0.7724110        no
tenureirregular              -0.7781818 -0.8205601 -0.7358035        no
tenureown_apartment           0.0608355  0.0326340  0.0890370        no
tenureown_house               0.1414021  0.1094175  0.1733867        no
tenurerent                    0.2826007  0.2597114  0.3054901        no
placeurban                   -0.0121440 -0.0348533  0.0105652        no
age                          -0.0000777 -0.0001566  0.0000012        no
> plot(contrib.mfx, decreasing = FALSE, horiz = TRUE)
> 
> 
> # package survey svy 
> des = survey::svydesign(~1, data= housing, weights = rep(1, NROW(housing)))
> fit.svy = survey::svyglm(bmi ~ tenure+height+weight, design = des)
> contrib.svy = contribution(fit.svy, housing$income)
> 
> 
> # adopted from the `coxph` example in survival package 
> testcph <- data.frame(time = c(4,3,1,1,2,2,3), 
+               status = c(1,1,1,0,1,1,0), 
+               x      = c(0,2,1,1,1,0,0), 
+               sex    = c(0,0,0,0,1,1,1),
+               income = c(100,50, 20, 20, 50, 60,100))
>               
> # Fit a stratified model 
> fit.coxph = survival::coxph(survival::Surv(time, status) ~ x + survival::strata(sex), testcph) 
> contrib.coxph = contribution(fit.coxph, testcph$income) 
Error in model.matrix(object)[, names(object$coefficients)][, -1, drop = F] : 
  incorrect number of dimensions
Calls: contribution -> contribution.coxph
Execution halted