Skip to contents

mid.breakdown() calculates the MID breakdown of a prediction of the MID model.

Usage

mid.breakdown(
  object,
  data = NULL,
  sort = TRUE,
  digits = 6L,
  format = c("%s", "%s, %s")
)

# S3 method for class 'mid.breakdown'
print(x, digits = max(3L, getOption("digits") - 2L), ...)

Arguments

object

a "mid" object.

data

a data.frame containing a single observation to be used to calculate the MID breakdown. If NULL, data is extracted from parent.env() based on the function call of the "mid" object.

sort

logical. If TRUE, the output data frame is sorted by MID .

digits

an integer specifying the minimum number of significant digits.

format

a character vector of length two to be used as the formats of the sprintf() function for each value or pair of values of predictor variables.

x

a "mid.importance" object to be printed.

...

additional parameters to be passed to print.data.frame() to print the importance of component functions.

Value

mid.breakdown() returns an object of the class "mid.breakdown" containing the following components.

breakdown

the data frame containing the breakdown of the prediction.

data

the data frame containing the values of predictor variables used for the prediction.

intercept

the intercept of the MID model.

prediction

the predicted value.

Details

mid.breakdown() returns an object of class "mid.breakdown".

Examples

data(airquality, package = "datasets")
mid <- interpret(Ozone ~ .^2, airquality, lambda = 1)
#> 'model' not passed: response variable in 'data' is used
mbd <- mid.breakdown(mid, airquality[1L, ])
mbd
#> 
#> MID Breakdown of a Prediction
#> 
#> Intercept: 42.099
#> 
#> Prediction: 39.739
#> 
#> Breakdown of Effects:
#>             term    value         mid order
#> 1           Temp       67 -1.5043e+01     1
#> 2            Day        1  4.9770e+00     1
#> 3          Month        5  3.7575e+00     1
#> 4     Wind:Month   7.4, 5  2.0404e+00     2
#> 5       Temp:Day    67, 1  1.3885e+00     2
#> 6  Solar.R:Month   190, 5  1.3124e+00     2
#> 7           Wind      7.4  1.0227e+00     1
#> 8        Solar.R      190 -9.4228e-01     1
#> 9      Wind:Temp  7.4, 67 -6.2914e-01     2
#> 10  Solar.R:Temp  190, 67 -5.6533e-01     2
#> 11     Month:Day     5, 1  5.0500e-01     2
#> 12   Solar.R:Day   190, 1 -2.4755e-01     2
#> 13      Wind:Day   7.4, 1  4.2771e-02     2
#> 14    Temp:Month    67, 5  2.0660e-02     2
#> 15  Solar.R:Wind 190, 7.4 -3.4803e-04     2