glebas2: Urban large parcels with built area data

glebas2R Documentation

Urban large parcels with built area data

Description

A tibble containing a sample of 20 large parcels with different built areas.

Usage

glebas2

Format

A tibble with 20 rows and 5 variables:

  • R: id

  • Ficha: another id (unused)

  • VI: sale price

  • AT: land area, in sq. meters

  • AC: Built area, in sq. meters

Examples

data(glebas2)
fit <- lm(VI ~ log(AT) + AC, data = glebas2)
library(effects)
plot(predictorEffects(fit, residuals = T), id = T,
      axes = list(
        grid = TRUE,
        x = list(rotate=30)
))
powerPlot(fit, axis="inverted", smooth = TRUE, methods = c("lm", "loess"))
# Issue: Influential Points 5 and 10 (see also plot(fit))

# Solution 1 (better to interpret):
fit1 <- update(fit, VI ~ AT + AC, subset = -c(2, 5,10))
plot(predictorEffects(fit1, residuals = T), id = T,
      axes = list(
        grid = TRUE,
        x = list(rotate=30)
))
powerPlot(fit1, axis = "inverted", smooth = TRUE, methods = c("lm", "loess"))
predict(fit1, newdata = list(AT = 9123.50, AC = 2272.47),
             interval = 'confidence', level = .80)
# + 30% higher value than predicted with the original fit

# Solution 2 (just to add some nonlinear relationship between the original
               variables)
fit2 <- update(fit, sqrt(VI) ~ sqrt(AT) + sqrt(AC), subset = -c(2, 10))
plot(predictorEffects(fit2, residuals = T), id = T,
      axes = list(
        grid = TRUE,
        x = list(rotate=30),
        y = list(transform=list(trans=sqrt, inverse=sqr), lab = "VI")
))
powerPlot(fit2, axis = "inverted", smooth = TRUE, methods = c("lm", "loess"),
            func="sqrt") # note bias and nonlinearity

predict(fit2, newdata = list(AT = 9123.50, AC = 2272.47),
             interval = 'confidence', level = .80)
# Almost 50% higher value than predicted with the original fit

lfpdroubi/appraiseR documentation built on April 14, 2024, 10:27 p.m.