Tidy summarizes information about the components of a model. A model component might be a single term in a regression, a single hypothesis, a cluster, or a class. Exactly what tidy considers to be a model component varies across models but is usually self-evident. If a model has several distinct types of components, you will need to specify which components to return.

# S3 method for lmrob
tidy(x, conf.int = FALSE, conf.level = 0.95, ...)

Arguments

x

A lmrob object returned from robustbase::lmrob().

conf.int

Logical indicating whether or not to include a confidence interval in the tidied output. Defaults to FALSE.

conf.level

The confidence level to use for the confidence interval if conf.int = TRUE. Must be strictly greater than 0 and less than 1. Defaults to 0.95, which corresponds to a 95 percent confidence interval.

...

Additional arguments. Not used. Needed to match generic signature only. Cautionary note: Misspelled arguments will be absorbed in ..., where they will be ignored. If the misspelled argument has a default value, the default value will be used. For example, if you pass conf.lvel = 0.9, all computation will proceed using conf.level = 0.95. Additionally, if you pass newdata = my_tibble to an augment() method that does not accept a newdata argument, it will use the default value for the data argument.

Details

For tidiers for robust models from the MASS package see tidy.rlm().

See also

Examples


library(robustbase)
# From the robustbase::lmrob examples:
data(coleman)
set.seed(0)

m <- robustbase::lmrob(Y ~ ., data = coleman)
tidy(m)
#> # A tibble: 6 × 5
#>   term        estimate std.error statistic  p.value
#>   <chr>          <dbl>     <dbl>     <dbl>    <dbl>
#> 1 (Intercept)  30.5       6.71        4.54 4.59e- 4
#> 2 salaryP      -1.67      0.431      -3.86 1.72e- 3
#> 3 fatherWc      0.0843    0.0147      5.74 5.10e- 5
#> 4 sstatus       0.668     0.0339     19.7  1.30e-11
#> 5 teacherSc     1.17      0.110      10.6  4.35e- 8
#> 6 motherLev    -4.14      0.921      -4.49 5.07e- 4
augment(m)
#> # A tibble: 20 × 8
#>        Y salaryP fatherWc sstatus teacherSc motherLev .fitted .resid
#>    <dbl>   <dbl>    <dbl>   <dbl>     <dbl>     <dbl>   <dbl>  <dbl>
#>  1  37.0    3.83    28.9     7.2       26.6      6.19    36.8  0.191
#>  2  26.5    2.89    20.1   -11.7       24.4      5.17    26.7 -0.159
#>  3  36.5    2.86    69.0    12.3       25.7      7.04    40.7 -4.16 
#>  4  40.7    2.92    65.4    14.3       25.7      7.1     41.3 -0.625
#>  5  37.1    3.06    29.6     6.31      25.4      6.15    36.3  0.768
#>  6  33.9    2.07    44.8     6.16      21.6      6.41    33.7  0.249
#>  7  41.8    2.52    77.4    12.7       24.9      6.86    42.0 -0.203
#>  8  33.4    2.45    24.7    -0.17      25.0      5.78    33.7 -0.282
#>  9  41.0    3.13    65.0     9.85      26.6      6.51    41.5 -0.466
#> 10  37.2    2.44     9.99   -0.05      28.0      5.57    36.9  0.286
#> 11  23.3    2.09    12.2   -12.9       23.5      5.62    23.7 -0.368
#> 12  35.2    2.52    22.6     0.92      23.6      5.34    34.3  0.912
#> 13  34.9    2.22    14.3     4.77      24.5      5.8     35.8 -0.924
#> 14  33.1    2.67    31.8    -0.96      25.8      6.19    32.6  0.486
#> 15  22.7    2.71    11.6   -16.0       25.2      5.62    22.4  0.266
#> 16  39.7    3.14    68.5    10.6       25.0      6.94    38.6  1.07 
#> 17  31.8    3.54    42.6     2.66      25.0      6.33    33.0 -1.19 
#> 18  31.7    2.52    16.7   -11.0       24.8      6.01    24.5  7.23 
#> 19  43.1    2.68    86.3    15.0       25.5      7.51    42.1  1.03 
#> 20  41.0    2.37    76.7    12.8       24.5      6.96    41.4 -0.367
glance(m)
#> # A tibble: 1 × 3
#>   r.squared sigma df.residual
#>       <dbl> <dbl>       <int>
#> 1     0.981  1.13          14

# From the robustbase::glmrob examples:
data(carrots)
Rfit <- glmrob(cbind(success, total - success) ~ logdose + block,
  family = binomial, data = carrots, method = "Mqle",
  control = glmrobMqle.control(tcc = 1.2)
)
tidy(Rfit)
#> # A tibble: 4 × 5
#>   term        estimate std.error statistic      p.value
#>   <chr>          <dbl>     <dbl>     <dbl>        <dbl>
#> 1 (Intercept)    2.39      0.692      3.45 0.000561    
#> 2 logdose       -2.05      0.368     -5.56 0.0000000268
#> 3 blockB2        0.235     0.212      1.11 0.268       
#> 4 blockB3       -0.450     0.241     -1.87 0.0620      
augment(Rfit)
#> # A tibble: 24 × 4
#>    `cbind(success, total - success)`[,"success"] [,""] logdose block .fitted
#>                                            <int> <int>   <dbl> <fct>   <dbl>
#>  1                                            10    25    1.52 B1     -0.726
#>  2                                            16    26    1.64 B1     -0.972
#>  3                                             8    42    1.76 B1     -1.22 
#>  4                                             6    36    1.88 B1     -1.46 
#>  5                                             9    26    2    B1     -1.71 
#>  6                                             9    33    2.12 B1     -1.96 
#>  7                                             1    31    2.24 B1     -2.20 
#>  8                                             2    26    2.36 B1     -2.45 
#>  9                                            17    21    1.52 B2     -0.491
#> 10                                            10    30    1.64 B2     -0.737
#> # … with 14 more rows