createGrid | R Documentation |
createGrid
create grids to predictions for ploting model variables
(terms) with or without confidence/prediction intervals
createGrid(x, object, at, ...)
object |
object of class lm |
at |
List to be used to calculate the predictions (defaults for center of each variable). |
... |
further arguments passed to predict.lm. |
variable |
variable to be plotted against response variable |
func |
function used to transform the response (optional) |
interval |
the type of interval calculation (provided to predict.lm) to be ploted. |
level |
Tolerance/confidence level (provided to predict.lm) to be ploted. |
ca |
(T/F) should the limits of the invertal of arbitration be plotted? |
av |
(T/F) should the arbitrated value be plotted? |
# Crete random bivariate normal data just for testing
library(MASS)
sample_mean <- c(10000, 250)
sample_cov <- matrix(c(1000^2, -37500,
-37500, 50^2),
ncol = 2, byrow = T)
n <- 10
set.seed(1)
dados <- mvrnorm(n = n,
mu = sample_mean,
Sigma = sample_cov)
colnames(dados) <- c("VU", "Area")
dados <- as.data.frame(dados)
fit <- lm(VU ~ Area, data = dados)
createGrid("Area", fit)
#
# Test with real data
library(sf)
data(centro_2015)
centro_2015 <- within(centro_2015, VU <- valor/area_total)
fit <- lm(sqrt(VU) ~ sqrt(area_total) + quartos + suites + garagens +
sqrt(dist_b_mar) + padrao,
data = centro_2015)
createGrid("area_total", fit)
createGrid("area_total", fit,
at = list(area_total = 205, quartos = 3, suites = 1,
garagens = 2, dist_b_mar = 250, padrao = "medio"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.