{r setup, include=FALSE} eval = FALSE knitr::opts_chunk$set(echo = TRUE)
## Warning: package 'plotly' was built under R version 4.1.3
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
## Warning: package 'readxl' was built under R version 4.1.3
## Warning: package 'tidyverse' was built under R version 4.1.3
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v tibble 3.1.6 v dplyr 1.0.8
## v tidyr 1.2.0 v stringr 1.4.0
## v readr 2.1.2 v forcats 0.5.1
## v purrr 0.3.4
## Warning: package 'readr' was built under R version 4.1.3
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks plotly::filter(), stats::filter()
## x dplyr::lag() masks stats::lag()
## Warning: package 'gmodels' was built under R version 4.1.3
## Warning: package 'Hmisc' was built under R version 4.1.3
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
##
## Attaching package: 'Hmisc'
## The following objects are masked from 'package:dplyr':
##
## src, summarize
## The following object is masked from 'package:plotly':
##
## subplot
## The following objects are masked from 'package:base':
##
## format.pval, units
## Warning: package 'GGally' was built under R version 4.1.3
## Registered S3 method overwritten by 'GGally':
## method from
## +.gg ggplot2
## corrplot 0.92 loaded
## Warning: package 'PerformanceAnalytics' was built under R version 4.1.3
## Loading required package: xts
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
##
## Attaching package: 'xts'
## The following objects are masked from 'package:dplyr':
##
## first, last
##
## Attaching package: 'PerformanceAnalytics'
## The following object is masked from 'package:graphics':
##
## legend
Realice un análisis exploratorio de las variables precio de vivienda (millones de pesos COP) y area de la vivienda (metros cuadrados) - incluir graficos e indicadores apropiados interpretados
## Area_contruida precio_millon
## Min. : 80.0 Min. :240.0
## 1st Qu.: 86.0 1st Qu.:251.2
## Median : 97.0 Median :305.0
## Mean :115.7 Mean :332.1
## 3rd Qu.:130.0 3rd Qu.:395.0
## Max. :195.0 Max. :480.0
## vivienda
##
## 2 Variables 26 Observations
## --------------------------------------------------------------------------------
## Area_contruida
## n missing distinct Info Mean Gmd .05 .10
## 26 0 14 0.987 115.7 38.68 85.0 85.5
## .25 .50 .75 .90 .95
## 86.0 97.0 130.0 170.0 178.2
##
## lowest : 80 85 86 87 89, highest: 130 134 170 181 195
##
## Value 80.00 85.00 86.00 87.00 89.00 96.00 98.00 118.00 118.42
## Frequency 1 2 5 2 1 2 1 1 1
## Proportion 0.038 0.077 0.192 0.077 0.038 0.077 0.038 0.038 0.038
##
## Value 130.00 134.00 170.00 181.00 195.00
## Frequency 4 1 3 1 1
## Proportion 0.154 0.038 0.115 0.038 0.038
## --------------------------------------------------------------------------------
## precio_millon
## n missing distinct Info Mean Gmd .05 .10
## 26 0 15 0.991 332.1 93.45 240.0 240.0
## .25 .50 .75 .90 .95
## 251.2 305.0 395.0 440.0 450.0
##
## lowest : 240 250 255 260 268, highest: 410 419 430 450 480
##
## Value 240 250 255 260 268 272 290 320 385 395 410
## Frequency 4 3 1 1 1 1 2 1 4 2 1
## Proportion 0.154 0.115 0.038 0.038 0.038 0.038 0.077 0.038 0.154 0.077 0.038
##
## Value 419 430 450 480
## Frequency 1 1 2 1
## Proportion 0.038 0.038 0.077 0.038
## --------------------------------------------------------------------------------
## Rows: 26
## Columns: 2
## $ Area_contruida <dbl> 86.00, 118.00, 130.00, 181.00, 86.00, 98.00, 170.00, 96~
## $ precio_millon <dbl> 250, 385, 395, 419, 240, 320, 480, 268, 240, 450, 240, ~
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Se realiza analisis de caja para ver su respectiva distribucion
Se puede evidenciar que el precio promedio de las viviendas es de 332 millones, donde 240 millones es el menor precio y 480 millones el mayor. a su vez el area construida promedio es de 115 m2 y el area mas pequeña es de 80 m2 y el area mas grande es de 195 m2 ademas el area mediana es de 97 metros, tambien se observa que la mayoría de datos estan por debajo de un área 130 millones.
Realice un análisis exploratorio bivariado de datos enfocado en la relación entre la variable respuesta (y=precio) en función de la variable predictora (x=area) - incluir graficos e indicadores apropiados interpretados
Cross Table
##
##
## Cell Contents
## |-------------------------|
## | N |
## | Chi-square contribution |
## | N / Row Total |
## | N / Col Total |
## | N / Table Total |
## |-------------------------|
##
##
## Total Observations in Table: 26
##
##
## | vivienda$precio_millon
## vivienda$Area_contruida | 240 | 250 | 255 | 260 | 268 | 272 | 290 | 320 | 385 | 395 | 410 | 419 | 430 | 450 | 480 | Row Total |
## ------------------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## 80 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
## | 0.154 | 0.115 | 24.038 | 0.038 | 0.038 | 0.038 | 0.077 | 0.038 | 0.154 | 0.077 | 0.038 | 0.038 | 0.038 | 0.077 | 0.038 | |
## | 0.000 | 0.000 | 1.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.038 |
## | 0.000 | 0.000 | 1.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## | 0.000 | 0.000 | 0.038 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## ------------------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## 85 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
## | 9.308 | 0.231 | 0.077 | 0.077 | 0.077 | 0.077 | 0.154 | 0.077 | 0.308 | 0.154 | 0.077 | 0.077 | 0.077 | 0.154 | 0.077 | |
## | 1.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.077 |
## | 0.500 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## | 0.077 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## ------------------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## 86 | 1 | 3 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
## | 0.069 | 10.177 | 0.192 | 0.192 | 0.192 | 0.192 | 0.985 | 0.192 | 0.769 | 0.385 | 0.192 | 0.192 | 0.192 | 0.385 | 0.192 | |
## | 0.200 | 0.600 | 0.000 | 0.000 | 0.000 | 0.000 | 0.200 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.192 |
## | 0.250 | 1.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.500 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## | 0.038 | 0.115 | 0.000 | 0.000 | 0.000 | 0.000 | 0.038 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## ------------------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## 87 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
## | 1.558 | 0.231 | 0.077 | 11.077 | 0.077 | 0.077 | 0.154 | 0.077 | 0.308 | 0.154 | 0.077 | 0.077 | 0.077 | 0.154 | 0.077 | |
## | 0.500 | 0.000 | 0.000 | 0.500 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.077 |
## | 0.250 | 0.000 | 0.000 | 1.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## | 0.038 | 0.000 | 0.000 | 0.038 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## ------------------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## 89 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
## | 0.154 | 0.115 | 0.038 | 0.038 | 0.038 | 0.038 | 11.077 | 0.038 | 0.154 | 0.077 | 0.038 | 0.038 | 0.038 | 0.077 | 0.038 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 1.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.038 |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.500 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.038 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## ------------------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## 96 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
## | 0.308 | 0.231 | 0.077 | 0.077 | 11.077 | 11.077 | 0.154 | 0.077 | 0.308 | 0.154 | 0.077 | 0.077 | 0.077 | 0.154 | 0.077 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.500 | 0.500 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.077 |
## | 0.000 | 0.000 | 0.000 | 0.000 | 1.000 | 1.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.038 | 0.038 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## ------------------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## 98 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
## | 0.154 | 0.115 | 0.038 | 0.038 | 0.038 | 0.038 | 0.077 | 24.038 | 0.154 | 0.077 | 0.038 | 0.038 | 0.038 | 0.077 | 0.038 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 1.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.038 |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 1.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.038 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## ------------------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## 118 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
## | 0.154 | 0.115 | 0.038 | 0.038 | 0.038 | 0.038 | 0.077 | 0.038 | 4.654 | 0.077 | 0.038 | 0.038 | 0.038 | 0.077 | 0.038 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 1.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.038 |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.250 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.038 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## ------------------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## 118.42 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
## | 0.154 | 0.115 | 0.038 | 0.038 | 0.038 | 0.038 | 0.077 | 0.038 | 4.654 | 0.077 | 0.038 | 0.038 | 0.038 | 0.077 | 0.038 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 1.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.038 |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.250 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.038 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## ------------------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## 130 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 0 | 4 |
## | 0.615 | 0.462 | 0.154 | 0.154 | 0.154 | 0.154 | 0.308 | 0.154 | 0.240 | 9.308 | 0.154 | 0.154 | 4.654 | 0.308 | 0.154 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.250 | 0.500 | 0.000 | 0.000 | 0.250 | 0.000 | 0.000 | 0.154 |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.250 | 1.000 | 0.000 | 0.000 | 1.000 | 0.000 | 0.000 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.038 | 0.077 | 0.000 | 0.000 | 0.038 | 0.000 | 0.000 | |
## ------------------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## 134 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
## | 0.154 | 0.115 | 0.038 | 0.038 | 0.038 | 0.038 | 0.077 | 0.038 | 4.654 | 0.077 | 0.038 | 0.038 | 0.038 | 0.077 | 0.038 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 1.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.038 |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.250 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.038 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | |
## ------------------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## 170 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 3 |
## | 0.462 | 0.346 | 0.115 | 0.115 | 0.115 | 0.115 | 0.231 | 0.115 | 0.462 | 0.231 | 6.782 | 0.115 | 0.115 | 2.564 | 6.782 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.333 | 0.000 | 0.000 | 0.333 | 0.333 | 0.115 |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 1.000 | 0.000 | 0.000 | 0.500 | 1.000 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.038 | 0.000 | 0.000 | 0.038 | 0.038 | |
## ------------------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## 181 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 |
## | 0.154 | 0.115 | 0.038 | 0.038 | 0.038 | 0.038 | 0.077 | 0.038 | 0.154 | 0.077 | 0.038 | 24.038 | 0.038 | 0.077 | 0.038 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 1.000 | 0.000 | 0.000 | 0.000 | 0.038 |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 1.000 | 0.000 | 0.000 | 0.000 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.038 | 0.000 | 0.000 | 0.000 | |
## ------------------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## 195 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |
## | 0.154 | 0.115 | 0.038 | 0.038 | 0.038 | 0.038 | 0.077 | 0.038 | 0.154 | 0.077 | 0.038 | 0.038 | 0.038 | 11.077 | 0.038 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 1.000 | 0.000 | 0.038 |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.500 | 0.000 | |
## | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.038 | 0.000 | |
## ------------------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
## Column Total | 4 | 3 | 1 | 1 | 1 | 1 | 2 | 1 | 4 | 2 | 1 | 1 | 1 | 2 | 1 | 26 |
## | 0.154 | 0.115 | 0.038 | 0.038 | 0.038 | 0.038 | 0.077 | 0.038 | 0.154 | 0.077 | 0.038 | 0.038 | 0.038 | 0.077 | 0.038 | |
## ------------------------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|-----------|
##
##
## Area_contruida precio_millon
## Area_contruida 1.0 0.9
## precio_millon 0.9 1.0
## [1] 2683.271
## [1] 0.9190295
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Loading required package: CGPfunctions
## Registered S3 method overwritten by 'DescTools':
## method from
## reorder.factor gdata
## Warning in geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabel() has yet to be implemented in plotly.
## If you'd like to see this geom implemented,
## Please open an issue with your example code at
## https://github.com/ropensci/plotly/issues
En los graficos se puede observar la correlación directa, donde paso siguiente la validamos con el indicador de correlación de Person que es igual al 92%, tambien se observa una covarianza positiva, lo que indica una relación lineal positiva entre estas variables donde se puede concluir que al aumentar la Area construida el precio millon tambien lo hace.
Estime el modelo de regresión lineal simple entre precio = f(area) +e.Interprete los coeficientes del modelo β0, β1 en caso de ser correcto.
##
## Call:
## lm(formula = precio_millon ~ Area_contruida)
##
## Residuals:
## Min 1Q Median 3Q Max
## -51.673 -25.612 -6.085 24.875 67.650
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 86.234 22.479 3.836 0.000796 ***
## Area_contruida 2.124 0.186 11.422 3.45e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 33.05 on 24 degrees of freedom
## Multiple R-squared: 0.8446, Adjusted R-squared: 0.8381
## F-statistic: 130.5 on 1 and 24 DF, p-value: 3.45e-11
Y= Precio_Millon (Variable de Respuesta) X= Area_Construdia (Variable Predictora) β0= 86.234 (Intercepto) β1= 2.124 (Pendiente)
Este modelo de regresión lineal simple tiene un intercepto de 86 millones aproximadamente o b0, lo cual nos indica que este sera el valor minimo, mientras tanto el coeficiente o b1 nos muestra que por cada aumento de 1 metro en el área de la vivienda generará un aumento de al rededor de 2 unidades en el precio
Construir un intervalo de confianza (95%) para el coeficiente β1, interpretar y concluir si el coeficiente es igual a cero o no. Compare este resultado con una prueba de hipotesis t.
## 2.5 % 97.5 %
## Area_contruida 1.74017 2.507771
Para poder tener un intervalo de confianza del 95% los valores de área construida oscilarian entre 1.74 y 2.5
Calcule e interprete el indicador de bondad y ajuste R2.
##
## Call:
## lm(formula = precio_millon ~ Area_contruida)
##
## Residuals:
## Min 1Q Median 3Q Max
## -51.673 -25.612 -6.085 24.875 67.650
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 86.234 22.479 3.836 0.000796 ***
## Area_contruida 2.124 0.186 11.422 3.45e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 33.05 on 24 degrees of freedom
## Multiple R-squared: 0.8446, Adjusted R-squared: 0.8381
## F-statistic: 130.5 on 1 and 24 DF, p-value: 3.45e-11
Se observa que el ajuste del modelo presenta un coeficiente de determinacion - r2 de 0.8446, lo cual modelo explica el 84% de la variabilidad del precio del inmueble
Cual seria el precio promedio estimado para un apartamento de 110 metros cuadrados? Considera entonces con este resultado que un apartemento en la misma zona con 110 metros cuadrados en un precio de 200 millones seria una buena oferta? Que consideraciones adicionales se deben tener?
## fit lwr upr
## 1 319.8706 306.3133 333.4279
Se puede analizar que el precio promedio para una vivienda de 110 m2 estaria entre los 306 a 333 millones, para realizar analitica mas avanzada seria genial contar con las coordeanas y de esta manera validar el estrato y validar las zonas con mayor crecimiento y potencial de vivienda.
Realice la validación de supuestos del modelo por medio de graficos apropiados, interpretarlos y sugerir posibles soluciones si se violan algunos de ellos.
Se observa dispersion en los datos que es lo mismo que decir que la varianza no es constante, por eso el supuesto de aleatoriedad del error no se cumple, para mejorar esto se requiere realizar ajuste al modelo o probar otros modelos que nos permitan ajustarse mejor a los datos.
##Tranformación
De ser necesario realice una transformación apropiada para mejorar el ajuste y supuestos del modelo.
##
## Call:
## lm(formula = precio_millon ~ log(Area_contruida))
##
## Residuals:
## Min 1Q Median 3Q Max
## -45.837 -20.153 -1.878 20.145 55.145
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -948.53 89.09 -10.65 1.42e-10 ***
## log(Area_contruida) 271.88 18.88 14.40 2.63e-13 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 27 on 24 degrees of freedom
## Multiple R-squared: 0.8963, Adjusted R-squared: 0.8919
## F-statistic: 207.4 on 1 and 24 DF, p-value: 2.63e-13
EL modelo tuvo una significacia alta y un valor R-squared del 89% gracias a la transformacion logaritmica
De ser necesario compare el ajuste y supuestos del modelo inicial y el transformado.
Se logramos mejorar el modelo tras el ajuste realizado a los datos, usando una transformacion logartimica, donde se aumento el R2 de un 84% al 89% y una aleatoriedad mayor y un ajuste normal mayor.