Constructs tours of data space based on fits.

lofPath(
  data,
  fits,
  length = 10,
  reorder = TRUE,
  conditionvars = NULL,
  predictArgs = NULL,
  response = NULL,
  ...
)

diffitsPath(
  data,
  fits,
  length = 10,
  reorder = TRUE,
  conditionvars = NULL,
  predictArgs = NULL,
  ...
)

hiresponsePath(
  data,
  response = NULL,
  length = 10,
  reorder = TRUE,
  conditionvars = NULL,
  ...
)

loresponsePath(
  data,
  response = NULL,
  length = 10,
  reorder = TRUE,
  conditionvars = NULL,
  ...
)

Arguments

data

A dataframe

fits

A model fit or list of fits

length

Path length, defaults to 10

reorder

If TRUE (default) uses DendSer to reorder the path dser

conditionvars

A vector of variable names. The returned tour is for this subset of variables.

predictArgs

Extra inputs to CVpredict

response

The name of the response variable

...

ignored

Value

A dataframe with the path

Functions

  • lofPath(): Constructs a tour of data space showing biggest absolute residuals from fits.

  • diffitsPath(): Constructs a tour of data space showing biggest differences in fits.

  • hiresponsePath(): Constructs a tour of data space showing high (numeric) response values

  • loresponsePath(): Constructs a tour of data space showing low (numeric) response values

Examples

fit1 <- lm(mpg ~ wt+hp+am, data=mtcars)
fit2 <- lm(mpg ~ wt, data=mtcars)
lofPath(mtcars,fit1, response="mpg")
#>                    mpg cyl  disp  hp drat    wt  qsec vs am gear carb
#> Chrysler Imperial 14.7   8 440.0 230 3.23 5.345 17.42  0  0    3    4
#> Pontiac Firebird  19.2   8 400.0 175 3.08 3.845 17.05  0  0    3    2
#> Dodge Challenger  15.5   8 318.0 150 2.76 3.520 16.87  0  0    3    2
#> AMC Javelin       15.2   8 304.0 150 3.15 3.435 17.30  0  0    3    2
#> Mazda RX4         21.0   6 160.0 110 3.90 2.620 16.46  0  1    4    4
#> Mazda RX4 Wag     21.0   6 160.0 110 3.90 2.875 17.02  0  1    4    4
#> Datsun 710        22.8   4 108.0  93 3.85 2.320 18.61  1  1    4    1
#> Lotus Europa      30.4   4  95.1 113 3.77 1.513 16.90  1  1    5    2
#> Fiat 128          32.4   4  78.7  66 4.08 2.200 19.47  1  1    4    1
#> Toyota Corolla    33.9   4  71.1  65 4.22 1.835 19.90  1  1    4    1
diffitsPath(mtcars,list(fit1,fit2))
#>                      mpg cyl  disp  hp drat    wt  qsec vs am gear carb
#> Fiat 128            32.4   4  78.7  66 4.08 2.200 19.47  1  1    4    1
#> Lotus Europa        30.4   4  95.1 113 3.77 1.513 16.90  1  1    5    2
#> Merc 240D           24.4   4 146.7  62 3.69 3.190 20.00  1  0    4    2
#> Mazda RX4 Wag       21.0   6 160.0 110 3.90 2.875 17.02  0  1    4    4
#> Maserati Bora       15.0   8 301.0 335 3.54 3.570 14.60  0  1    5    8
#> Ford Pantera L      15.8   8 351.0 264 4.22 3.170 14.50  0  1    5    4
#> Camaro Z28          13.3   8 350.0 245 3.73 3.840 15.41  0  0    3    4
#> Duster 360          14.3   8 360.0 245 3.21 3.570 15.84  0  0    3    4
#> Lincoln Continental 10.4   8 460.0 215 3.00 5.424 17.82  0  0    3    4
#> Cadillac Fleetwood  10.4   8 472.0 205 2.93 5.250 17.98  0  0    3    4