plotModel plots bestfit models

plotModel(object, ...)

# S3 method for bestfit
plotModel(object, fit = 1, ...)

# S3 method for lm
plotModel(object, ...)

Arguments

object

Object of class bestfit

...

further arguments passed to predict.lm.

fit

the number of the chosen fit from the combination matrix (defaults for the best fit found with bestfit).

interval

the type of interval calculation (provided to predict.lm) to be ploted with the model.

level

Tolerance/confidence level (provided to predict.lm) to be ploted.

func

function used to transform the response (optional)

local

Data Frame to be used for calculate the estimates (defaults for center of each variable).

Examples

library(sf) data <- st_drop_geometry(centro_2015) data$padrao <- as.numeric(data$padrao) ## plotModel.lm fit <- lm(log(valor)~area_total + quartos + suites + garagens + log(dist_b_mar) + I(1/padrao), data = data, subset = -c(31, 39)) plotModel(fit)
#> Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
plotModel(fit, interval = "both", level = .80)
#> Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
## On the original scale plotModel(fit, interval = "both", level = .80, func = "log")
#> Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
plotModel(fit, interval = "both", level = .80, func = "log", ca = TRUE, local = list(area_total = 205, quartos = 3, suites = 1, garagens = 2, dist_b_mar = 250, padrao = 2))
#> Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
plotModel(fit, interval = "both", level = .80, func = "log", ca = TRUE, local = list(area_total = 205, quartos = 3, suites = 1, garagens = 2, dist_b_mar = 250, padrao = 2), av = 1100000)
#> Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
## plotModel.best_fit best_fit <- bestfit(valor ~ ., data = data) plotModel(best_fit) # Plots the best fit
#> Error in terms.formula(formula, data = data): 'data' argument is of the wrong type
plotModel(best_fit, interval = "confidence") # adds CIs
#> Error in terms.formula(formula, data = data): 'data' argument is of the wrong type
plotModel(best_fit, func = "rsqrt") # plots in the original scale
#> Error in terms.formula(formula, data = data): 'data' argument is of the wrong type
plotModel(best_fit, func = "rsqrt", interval = "both", ca = TRUE)
#> Error in terms.formula(formula, data = data): 'data' argument is of the wrong type
plotModel(best_fit, func = "rsqrt", interval = "both", ca = TRUE, local = list(area_total = 205, quartos = 3, suites = 1, garagens = 2, dist_b_mar = 250, padrao = "medio"), av = 1100000)
#> Error in terms.formula(formula, data = data): 'data' argument is of the wrong type
plotModel(best_fit, fit = 2, interval = "confidence") # choose another fit
#> Error in terms.formula(formula, data = data): 'data' argument is of the wrong type
plotModel(best_fit, interval = "confidence", local = list(area_total = 205, quartos = 3, suites = 1, garagens = 2, dist_b_mar = 250, padrao = "medio"))
#> Error in terms.formula(formula, data = data): 'data' argument is of the wrong type
mod <- lm(log(valor) ~ ., data = data) plotModel(mod)
#> Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
plotModel(mod, interval = "confidence")
#> Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
plotModel(mod, interval = "confidence", func = "log")
#> Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
plotModel(mod, interval = "confidence", local = list(area_total = 205, quartos = 3, suites = 1, garagens = 2, dist_b_mar = 250, padrao = "medio"))
#> Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
plotModel(mod, interval = "confidence", func = "log", local = list(area_total = 205, quartos = 3, suites = 1, garagens = 2, dist_b_mar = 250, padrao = "medio"))
#> Error: evaluation nested too deeply: infinite recursion / options(expressions=)?