This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(modeldata)
## Warning: package 'modeldata' was built under R version 4.5.3
##
## Attaching package: 'modeldata'
## The following object is masked from 'package:datasets':
##
## penguins
# Data yang digunakan
data(ames)
str(ames)
## Classes 'tbl_df', 'tbl' and 'data.frame': 2930 obs. of 74 variables:
## $ MS_SubClass : Factor w/ 16 levels "One_Story_1946_and_Newer_All_Styles",..: 1 1 1 1 6 6 12 12 12 6 ...
## $ MS_Zoning : Factor w/ 7 levels "Floating_Village_Residential",..: 3 2 3 3 3 3 3 3 3 3 ...
## $ Lot_Frontage : num 141 80 81 93 74 78 41 43 39 60 ...
## $ Lot_Area : int 31770 11622 14267 11160 13830 9978 4920 5005 5389 7500 ...
## $ Street : Factor w/ 2 levels "Grvl","Pave": 2 2 2 2 2 2 2 2 2 2 ...
## $ Alley : Factor w/ 3 levels "Gravel","No_Alley_Access",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Lot_Shape : Factor w/ 4 levels "Regular","Slightly_Irregular",..: 2 1 2 1 2 2 1 2 2 1 ...
## $ Land_Contour : Factor w/ 4 levels "Bnk","HLS","Low",..: 4 4 4 4 4 4 4 2 4 4 ...
## $ Utilities : Factor w/ 3 levels "AllPub","NoSeWa",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Lot_Config : Factor w/ 5 levels "Corner","CulDSac",..: 1 5 1 1 5 5 5 5 5 5 ...
## $ Land_Slope : Factor w/ 3 levels "Gtl","Mod","Sev": 1 1 1 1 1 1 1 1 1 1 ...
## $ Neighborhood : Factor w/ 29 levels "North_Ames","College_Creek",..: 1 1 1 1 7 7 17 17 17 7 ...
## $ Condition_1 : Factor w/ 9 levels "Artery","Feedr",..: 3 2 3 3 3 3 3 3 3 3 ...
## $ Condition_2 : Factor w/ 8 levels "Artery","Feedr",..: 3 3 3 3 3 3 3 3 3 3 ...
## $ Bldg_Type : Factor w/ 5 levels "OneFam","TwoFmCon",..: 1 1 1 1 1 1 5 5 5 1 ...
## $ House_Style : Factor w/ 8 levels "One_and_Half_Fin",..: 3 3 3 3 8 8 3 3 3 8 ...
## $ Overall_Cond : Factor w/ 10 levels "Very_Poor","Poor",..: 5 6 6 5 5 6 5 5 5 5 ...
## $ Year_Built : int 1960 1961 1958 1968 1997 1998 2001 1992 1995 1999 ...
## $ Year_Remod_Add : int 1960 1961 1958 1968 1998 1998 2001 1992 1996 1999 ...
## $ Roof_Style : Factor w/ 6 levels "Flat","Gable",..: 4 2 4 4 2 2 2 2 2 2 ...
## $ Roof_Matl : Factor w/ 8 levels "ClyTile","CompShg",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Exterior_1st : Factor w/ 16 levels "AsbShng","AsphShn",..: 4 14 15 4 14 14 6 7 6 14 ...
## $ Exterior_2nd : Factor w/ 17 levels "AsbShng","AsphShn",..: 11 15 16 4 15 15 6 7 6 15 ...
## $ Mas_Vnr_Type : Factor w/ 5 levels "BrkCmn","BrkFace",..: 5 4 2 4 4 2 4 4 4 4 ...
## $ Mas_Vnr_Area : num 112 0 108 0 0 20 0 0 0 0 ...
## $ Exter_Cond : Factor w/ 5 levels "Excellent","Fair",..: 5 5 5 5 5 5 5 5 5 5 ...
## $ Foundation : Factor w/ 6 levels "BrkTil","CBlock",..: 2 2 2 2 3 3 3 3 3 3 ...
## $ Bsmt_Cond : Factor w/ 6 levels "Excellent","Fair",..: 3 6 6 6 6 6 6 6 6 6 ...
## $ Bsmt_Exposure : Factor w/ 5 levels "Av","Gd","Mn",..: 2 4 4 4 4 4 3 4 4 4 ...
## $ BsmtFin_Type_1 : Factor w/ 7 levels "ALQ","BLQ","GLQ",..: 2 6 1 1 3 3 3 1 3 7 ...
## $ BsmtFin_SF_1 : num 2 6 1 1 3 3 3 1 3 7 ...
## $ BsmtFin_Type_2 : Factor w/ 7 levels "ALQ","BLQ","GLQ",..: 7 4 7 7 7 7 7 7 7 7 ...
## $ BsmtFin_SF_2 : num 0 144 0 0 0 0 0 0 0 0 ...
## $ Bsmt_Unf_SF : num 441 270 406 1045 137 ...
## $ Total_Bsmt_SF : num 1080 882 1329 2110 928 ...
## $ Heating : Factor w/ 6 levels "Floor","GasA",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Heating_QC : Factor w/ 5 levels "Excellent","Fair",..: 2 5 5 1 3 1 1 1 1 3 ...
## $ Central_Air : Factor w/ 2 levels "N","Y": 2 2 2 2 2 2 2 2 2 2 ...
## $ Electrical : Factor w/ 6 levels "FuseA","FuseF",..: 5 5 5 5 5 5 5 5 5 5 ...
## $ First_Flr_SF : int 1656 896 1329 2110 928 926 1338 1280 1616 1028 ...
## $ Second_Flr_SF : int 0 0 0 0 701 678 0 0 0 776 ...
## $ Gr_Liv_Area : int 1656 896 1329 2110 1629 1604 1338 1280 1616 1804 ...
## $ Bsmt_Full_Bath : num 1 0 0 1 0 0 1 0 1 0 ...
## $ Bsmt_Half_Bath : num 0 0 0 0 0 0 0 0 0 0 ...
## $ Full_Bath : int 1 1 1 2 2 2 2 2 2 2 ...
## $ Half_Bath : int 0 0 1 1 1 1 0 0 0 1 ...
## $ Bedroom_AbvGr : int 3 2 3 3 3 3 2 2 2 3 ...
## $ Kitchen_AbvGr : int 1 1 1 1 1 1 1 1 1 1 ...
## $ TotRms_AbvGrd : int 7 5 6 8 6 7 6 5 5 7 ...
## $ Functional : Factor w/ 8 levels "Maj1","Maj2",..: 8 8 8 8 8 8 8 8 8 8 ...
## $ Fireplaces : int 2 0 0 2 1 1 0 0 1 1 ...
## $ Garage_Type : Factor w/ 7 levels "Attchd","Basment",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Garage_Finish : Factor w/ 4 levels "Fin","No_Garage",..: 1 4 4 1 1 1 1 3 3 1 ...
## $ Garage_Cars : num 2 1 1 2 2 2 2 2 2 2 ...
## $ Garage_Area : num 528 730 312 522 482 470 582 506 608 442 ...
## $ Garage_Cond : Factor w/ 6 levels "Excellent","Fair",..: 6 6 6 6 6 6 6 6 6 6 ...
## $ Paved_Drive : Factor w/ 3 levels "Dirt_Gravel",..: 2 3 3 3 3 3 3 3 3 3 ...
## $ Wood_Deck_SF : int 210 140 393 0 212 360 0 0 237 140 ...
## $ Open_Porch_SF : int 62 0 36 0 34 36 0 82 152 60 ...
## $ Enclosed_Porch : int 0 0 0 0 0 0 170 0 0 0 ...
## $ Three_season_porch: int 0 0 0 0 0 0 0 0 0 0 ...
## $ Screen_Porch : int 0 120 0 0 0 0 0 144 0 0 ...
## $ Pool_Area : int 0 0 0 0 0 0 0 0 0 0 ...
## $ Pool_QC : Factor w/ 5 levels "Excellent","Fair",..: 4 4 4 4 4 4 4 4 4 4 ...
## $ Fence : Factor w/ 5 levels "Good_Privacy",..: 5 3 5 5 3 5 5 5 5 5 ...
## $ Misc_Feature : Factor w/ 6 levels "Elev","Gar2",..: 3 3 2 3 3 3 3 3 3 3 ...
## $ Misc_Val : int 0 0 12500 0 0 0 0 0 0 0 ...
## $ Mo_Sold : int 5 6 6 4 3 6 4 1 3 6 ...
## $ Year_Sold : int 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 ...
## $ Sale_Type : Factor w/ 10 levels "COD","Con","ConLD",..: 10 10 10 10 10 10 10 10 10 10 ...
## $ Sale_Condition : Factor w/ 6 levels "Abnorml","AdjLand",..: 5 5 5 5 5 5 5 5 5 5 ...
## $ Sale_Price : int 215000 105000 172000 244000 189900 195500 213500 191500 236500 189000 ...
## $ Longitude : num -93.6 -93.6 -93.6 -93.6 -93.6 ...
## $ Latitude : num 42.1 42.1 42.1 42.1 42.1 ...
# Melihat struktur data
str(ames)
## Classes 'tbl_df', 'tbl' and 'data.frame': 2930 obs. of 74 variables:
## $ MS_SubClass : Factor w/ 16 levels "One_Story_1946_and_Newer_All_Styles",..: 1 1 1 1 6 6 12 12 12 6 ...
## $ MS_Zoning : Factor w/ 7 levels "Floating_Village_Residential",..: 3 2 3 3 3 3 3 3 3 3 ...
## $ Lot_Frontage : num 141 80 81 93 74 78 41 43 39 60 ...
## $ Lot_Area : int 31770 11622 14267 11160 13830 9978 4920 5005 5389 7500 ...
## $ Street : Factor w/ 2 levels "Grvl","Pave": 2 2 2 2 2 2 2 2 2 2 ...
## $ Alley : Factor w/ 3 levels "Gravel","No_Alley_Access",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Lot_Shape : Factor w/ 4 levels "Regular","Slightly_Irregular",..: 2 1 2 1 2 2 1 2 2 1 ...
## $ Land_Contour : Factor w/ 4 levels "Bnk","HLS","Low",..: 4 4 4 4 4 4 4 2 4 4 ...
## $ Utilities : Factor w/ 3 levels "AllPub","NoSeWa",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Lot_Config : Factor w/ 5 levels "Corner","CulDSac",..: 1 5 1 1 5 5 5 5 5 5 ...
## $ Land_Slope : Factor w/ 3 levels "Gtl","Mod","Sev": 1 1 1 1 1 1 1 1 1 1 ...
## $ Neighborhood : Factor w/ 29 levels "North_Ames","College_Creek",..: 1 1 1 1 7 7 17 17 17 7 ...
## $ Condition_1 : Factor w/ 9 levels "Artery","Feedr",..: 3 2 3 3 3 3 3 3 3 3 ...
## $ Condition_2 : Factor w/ 8 levels "Artery","Feedr",..: 3 3 3 3 3 3 3 3 3 3 ...
## $ Bldg_Type : Factor w/ 5 levels "OneFam","TwoFmCon",..: 1 1 1 1 1 1 5 5 5 1 ...
## $ House_Style : Factor w/ 8 levels "One_and_Half_Fin",..: 3 3 3 3 8 8 3 3 3 8 ...
## $ Overall_Cond : Factor w/ 10 levels "Very_Poor","Poor",..: 5 6 6 5 5 6 5 5 5 5 ...
## $ Year_Built : int 1960 1961 1958 1968 1997 1998 2001 1992 1995 1999 ...
## $ Year_Remod_Add : int 1960 1961 1958 1968 1998 1998 2001 1992 1996 1999 ...
## $ Roof_Style : Factor w/ 6 levels "Flat","Gable",..: 4 2 4 4 2 2 2 2 2 2 ...
## $ Roof_Matl : Factor w/ 8 levels "ClyTile","CompShg",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Exterior_1st : Factor w/ 16 levels "AsbShng","AsphShn",..: 4 14 15 4 14 14 6 7 6 14 ...
## $ Exterior_2nd : Factor w/ 17 levels "AsbShng","AsphShn",..: 11 15 16 4 15 15 6 7 6 15 ...
## $ Mas_Vnr_Type : Factor w/ 5 levels "BrkCmn","BrkFace",..: 5 4 2 4 4 2 4 4 4 4 ...
## $ Mas_Vnr_Area : num 112 0 108 0 0 20 0 0 0 0 ...
## $ Exter_Cond : Factor w/ 5 levels "Excellent","Fair",..: 5 5 5 5 5 5 5 5 5 5 ...
## $ Foundation : Factor w/ 6 levels "BrkTil","CBlock",..: 2 2 2 2 3 3 3 3 3 3 ...
## $ Bsmt_Cond : Factor w/ 6 levels "Excellent","Fair",..: 3 6 6 6 6 6 6 6 6 6 ...
## $ Bsmt_Exposure : Factor w/ 5 levels "Av","Gd","Mn",..: 2 4 4 4 4 4 3 4 4 4 ...
## $ BsmtFin_Type_1 : Factor w/ 7 levels "ALQ","BLQ","GLQ",..: 2 6 1 1 3 3 3 1 3 7 ...
## $ BsmtFin_SF_1 : num 2 6 1 1 3 3 3 1 3 7 ...
## $ BsmtFin_Type_2 : Factor w/ 7 levels "ALQ","BLQ","GLQ",..: 7 4 7 7 7 7 7 7 7 7 ...
## $ BsmtFin_SF_2 : num 0 144 0 0 0 0 0 0 0 0 ...
## $ Bsmt_Unf_SF : num 441 270 406 1045 137 ...
## $ Total_Bsmt_SF : num 1080 882 1329 2110 928 ...
## $ Heating : Factor w/ 6 levels "Floor","GasA",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Heating_QC : Factor w/ 5 levels "Excellent","Fair",..: 2 5 5 1 3 1 1 1 1 3 ...
## $ Central_Air : Factor w/ 2 levels "N","Y": 2 2 2 2 2 2 2 2 2 2 ...
## $ Electrical : Factor w/ 6 levels "FuseA","FuseF",..: 5 5 5 5 5 5 5 5 5 5 ...
## $ First_Flr_SF : int 1656 896 1329 2110 928 926 1338 1280 1616 1028 ...
## $ Second_Flr_SF : int 0 0 0 0 701 678 0 0 0 776 ...
## $ Gr_Liv_Area : int 1656 896 1329 2110 1629 1604 1338 1280 1616 1804 ...
## $ Bsmt_Full_Bath : num 1 0 0 1 0 0 1 0 1 0 ...
## $ Bsmt_Half_Bath : num 0 0 0 0 0 0 0 0 0 0 ...
## $ Full_Bath : int 1 1 1 2 2 2 2 2 2 2 ...
## $ Half_Bath : int 0 0 1 1 1 1 0 0 0 1 ...
## $ Bedroom_AbvGr : int 3 2 3 3 3 3 2 2 2 3 ...
## $ Kitchen_AbvGr : int 1 1 1 1 1 1 1 1 1 1 ...
## $ TotRms_AbvGrd : int 7 5 6 8 6 7 6 5 5 7 ...
## $ Functional : Factor w/ 8 levels "Maj1","Maj2",..: 8 8 8 8 8 8 8 8 8 8 ...
## $ Fireplaces : int 2 0 0 2 1 1 0 0 1 1 ...
## $ Garage_Type : Factor w/ 7 levels "Attchd","Basment",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Garage_Finish : Factor w/ 4 levels "Fin","No_Garage",..: 1 4 4 1 1 1 1 3 3 1 ...
## $ Garage_Cars : num 2 1 1 2 2 2 2 2 2 2 ...
## $ Garage_Area : num 528 730 312 522 482 470 582 506 608 442 ...
## $ Garage_Cond : Factor w/ 6 levels "Excellent","Fair",..: 6 6 6 6 6 6 6 6 6 6 ...
## $ Paved_Drive : Factor w/ 3 levels "Dirt_Gravel",..: 2 3 3 3 3 3 3 3 3 3 ...
## $ Wood_Deck_SF : int 210 140 393 0 212 360 0 0 237 140 ...
## $ Open_Porch_SF : int 62 0 36 0 34 36 0 82 152 60 ...
## $ Enclosed_Porch : int 0 0 0 0 0 0 170 0 0 0 ...
## $ Three_season_porch: int 0 0 0 0 0 0 0 0 0 0 ...
## $ Screen_Porch : int 0 120 0 0 0 0 0 144 0 0 ...
## $ Pool_Area : int 0 0 0 0 0 0 0 0 0 0 ...
## $ Pool_QC : Factor w/ 5 levels "Excellent","Fair",..: 4 4 4 4 4 4 4 4 4 4 ...
## $ Fence : Factor w/ 5 levels "Good_Privacy",..: 5 3 5 5 3 5 5 5 5 5 ...
## $ Misc_Feature : Factor w/ 6 levels "Elev","Gar2",..: 3 3 2 3 3 3 3 3 3 3 ...
## $ Misc_Val : int 0 0 12500 0 0 0 0 0 0 0 ...
## $ Mo_Sold : int 5 6 6 4 3 6 4 1 3 6 ...
## $ Year_Sold : int 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 ...
## $ Sale_Type : Factor w/ 10 levels "COD","Con","ConLD",..: 10 10 10 10 10 10 10 10 10 10 ...
## $ Sale_Condition : Factor w/ 6 levels "Abnorml","AdjLand",..: 5 5 5 5 5 5 5 5 5 5 ...
## $ Sale_Price : int 215000 105000 172000 244000 189900 195500 213500 191500 236500 189000 ...
## $ Longitude : num -93.6 -93.6 -93.6 -93.6 -93.6 ...
## $ Latitude : num 42.1 42.1 42.1 42.1 42.1 ...
dim(ames)
## [1] 2930 74
# Cek missing value
colSums(is.na(ames))
## MS_SubClass MS_Zoning Lot_Frontage Lot_Area
## 0 0 0 0
## Street Alley Lot_Shape Land_Contour
## 0 0 0 0
## Utilities Lot_Config Land_Slope Neighborhood
## 0 0 0 0
## Condition_1 Condition_2 Bldg_Type House_Style
## 0 0 0 0
## Overall_Cond Year_Built Year_Remod_Add Roof_Style
## 0 0 0 0
## Roof_Matl Exterior_1st Exterior_2nd Mas_Vnr_Type
## 0 0 0 0
## Mas_Vnr_Area Exter_Cond Foundation Bsmt_Cond
## 0 0 0 0
## Bsmt_Exposure BsmtFin_Type_1 BsmtFin_SF_1 BsmtFin_Type_2
## 0 0 0 0
## BsmtFin_SF_2 Bsmt_Unf_SF Total_Bsmt_SF Heating
## 0 0 0 0
## Heating_QC Central_Air Electrical First_Flr_SF
## 0 0 0 0
## Second_Flr_SF Gr_Liv_Area Bsmt_Full_Bath Bsmt_Half_Bath
## 0 0 0 0
## Full_Bath Half_Bath Bedroom_AbvGr Kitchen_AbvGr
## 0 0 0 0
## TotRms_AbvGrd Functional Fireplaces Garage_Type
## 0 0 0 0
## Garage_Finish Garage_Cars Garage_Area Garage_Cond
## 0 0 0 0
## Paved_Drive Wood_Deck_SF Open_Porch_SF Enclosed_Porch
## 0 0 0 0
## Three_season_porch Screen_Porch Pool_Area Pool_QC
## 0 0 0 0
## Fence Misc_Feature Misc_Val Mo_Sold
## 0 0 0 0
## Year_Sold Sale_Type Sale_Condition Sale_Price
## 0 0 0 0
## Longitude Latitude
## 0 0
# Cek data duplikat
sum(duplicated(ames))
## [1] 0
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.5.3
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
# Cek outlier
data_numerik <- ames %>%
select(where(is.numeric))
# Menghitung batas outlier
cek_outlier <- function(x) {
Q1 <- quantile(x, 0.25, na.rm = TRUE)
Q3 <- quantile(x, 0.75, na.rm = TRUE)
IQR_x <- IQR(x, na.rm = TRUE)
batas_bawah <- Q1 - 1.5 * IQR_x
batas_atas <- Q3 + 1.5 * IQR_x
sum(
x < batas_bawah | x > batas_atas,
na.rm = TRUE
)
}
# Jumlah outlier setiap variabel
jumlah_outlier <- sapply(
data_numerik,
cek_outlier
)
jumlah_outlier
## Lot_Frontage Lot_Area Year_Built Year_Remod_Add
## 31 127 9 0
## Mas_Vnr_Area BsmtFin_SF_1 BsmtFin_SF_2 Bsmt_Unf_SF
## 203 0 351 56
## Total_Bsmt_SF First_Flr_SF Second_Flr_SF Gr_Liv_Area
## 124 43 8 75
## Bsmt_Full_Bath Bsmt_Half_Bath Full_Bath Half_Bath
## 2 175 4 0
## Bedroom_AbvGr Kitchen_AbvGr TotRms_AbvGrd Fireplaces
## 78 134 51 13
## Garage_Cars Garage_Area Wood_Deck_SF Open_Porch_SF
## 17 42 67 159
## Enclosed_Porch Three_season_porch Screen_Porch Pool_Area
## 459 37 256 13
## Misc_Val Mo_Sold Year_Sold Sale_Price
## 103 0 0 137
## Longitude Latitude
## 0 0
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.
library(dplyr)
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.5.3
library(tidyr)
## Warning: package 'tidyr' was built under R version 4.5.3
# Distribusi Variabel respon (sale_price)
ggplot(ames, aes(x = Sale_Price)) +
geom_histogram(
aes(y = after_stat(density)),
bins = 30,
fill = "skyblue",
color = "black"
) +
geom_density(
color = "red",
linewidth = 1
) +
theme_minimal() +
labs(
title = "Distribusi Harga Jual Rumah",
x = "Sale_Price",
y = "Density"
)
library(dplyr)
library(ggplot2)
library(tidyr)
# Transformasi logaritma
ames$log_price <- log(ames$Sale_Price)
ggplot(ames, aes(x = log_price)) +
geom_histogram(
aes(y = after_stat(density)),
bins = 40,
color = "black",
fill = "skyblue"
) +
geom_density(
color = "red",
linewidth = 1
) +
labs(
title = "Distribusi Log Harga Jual Rumah",
x = "log(Sale_Price)",
y = "Density"
) +
theme_minimal()
# skewness distribusi sebelum dan sesudah transformasi
library(moments)
## Warning: package 'moments' was built under R version 4.5.2
data.frame(
Variabel = c("Sale_Price", "log_price"),
Skewness = c(
skewness(ames$Sale_Price, na.rm = TRUE),
skewness(ames$log_price, na.rm = TRUE)
)
)
## Variabel Skewness
## 1 Sale_Price 1.74260737
## 2 log_price -0.01478586
# Memeriksa missing value setiap variabel
colSums(is.na(ames))
## MS_SubClass MS_Zoning Lot_Frontage Lot_Area
## 0 0 0 0
## Street Alley Lot_Shape Land_Contour
## 0 0 0 0
## Utilities Lot_Config Land_Slope Neighborhood
## 0 0 0 0
## Condition_1 Condition_2 Bldg_Type House_Style
## 0 0 0 0
## Overall_Cond Year_Built Year_Remod_Add Roof_Style
## 0 0 0 0
## Roof_Matl Exterior_1st Exterior_2nd Mas_Vnr_Type
## 0 0 0 0
## Mas_Vnr_Area Exter_Cond Foundation Bsmt_Cond
## 0 0 0 0
## Bsmt_Exposure BsmtFin_Type_1 BsmtFin_SF_1 BsmtFin_Type_2
## 0 0 0 0
## BsmtFin_SF_2 Bsmt_Unf_SF Total_Bsmt_SF Heating
## 0 0 0 0
## Heating_QC Central_Air Electrical First_Flr_SF
## 0 0 0 0
## Second_Flr_SF Gr_Liv_Area Bsmt_Full_Bath Bsmt_Half_Bath
## 0 0 0 0
## Full_Bath Half_Bath Bedroom_AbvGr Kitchen_AbvGr
## 0 0 0 0
## TotRms_AbvGrd Functional Fireplaces Garage_Type
## 0 0 0 0
## Garage_Finish Garage_Cars Garage_Area Garage_Cond
## 0 0 0 0
## Paved_Drive Wood_Deck_SF Open_Porch_SF Enclosed_Porch
## 0 0 0 0
## Three_season_porch Screen_Porch Pool_Area Pool_QC
## 0 0 0 0
## Fence Misc_Feature Misc_Val Mo_Sold
## 0 0 0 0
## Year_Sold Sale_Type Sale_Condition Sale_Price
## 0 0 0 0
## Longitude Latitude log_price
## 0 0 0
# Menghitung total missing value
sum(is.na(ames))
## [1] 0
# Memeriksa data duplikat
sum(duplicated(ames))
## [1] 0
# Pembagian data latih dan data uji
set.seed(2026)
id_latih <- sample(
seq_len(nrow(ames)),
size = floor(0.80 * nrow(ames))
)
latih <- ames[id_latih, ]
uji <- ames[-id_latih, ]
# Melihat ukuran data
dim(latih)
## [1] 2344 75
dim(uji)
## [1] 586 75
# Melihat proporsi pembagian
proporsi <- data.frame(
Data = c("Data Latih", "Data Uji"),
Jumlah = c(nrow(latih), nrow(uji)),
Persentase = c(
nrow(latih) / nrow(ames) * 100,
nrow(uji) / nrow(ames) * 100
)
)
print(proporsi)
## Data Jumlah Persentase
## 1 Data Latih 2344 80
## 2 Data Uji 586 20
# Mengidentifikasi variabel prediktor
prediktor <- setdiff(
names(latih),
c("Sale_Price", "log_price")
)
# Mengidentifikasi prediktor numerik
num_vars <- prediktor[
sapply(latih[prediktor], is.numeric)
]
# Mengidentifikasi prediktor kategorik
factor_vars <- prediktor[
!sapply(latih[prediktor], is.numeric)
]
# Melihat daftar variabel
num_vars
## [1] "Lot_Frontage" "Lot_Area" "Year_Built"
## [4] "Year_Remod_Add" "Mas_Vnr_Area" "BsmtFin_SF_1"
## [7] "BsmtFin_SF_2" "Bsmt_Unf_SF" "Total_Bsmt_SF"
## [10] "First_Flr_SF" "Second_Flr_SF" "Gr_Liv_Area"
## [13] "Bsmt_Full_Bath" "Bsmt_Half_Bath" "Full_Bath"
## [16] "Half_Bath" "Bedroom_AbvGr" "Kitchen_AbvGr"
## [19] "TotRms_AbvGrd" "Fireplaces" "Garage_Cars"
## [22] "Garage_Area" "Wood_Deck_SF" "Open_Porch_SF"
## [25] "Enclosed_Porch" "Three_season_porch" "Screen_Porch"
## [28] "Pool_Area" "Misc_Val" "Mo_Sold"
## [31] "Year_Sold" "Longitude" "Latitude"
factor_vars
## [1] "MS_SubClass" "MS_Zoning" "Street" "Alley"
## [5] "Lot_Shape" "Land_Contour" "Utilities" "Lot_Config"
## [9] "Land_Slope" "Neighborhood" "Condition_1" "Condition_2"
## [13] "Bldg_Type" "House_Style" "Overall_Cond" "Roof_Style"
## [17] "Roof_Matl" "Exterior_1st" "Exterior_2nd" "Mas_Vnr_Type"
## [21] "Exter_Cond" "Foundation" "Bsmt_Cond" "Bsmt_Exposure"
## [25] "BsmtFin_Type_1" "BsmtFin_Type_2" "Heating" "Heating_QC"
## [29] "Central_Air" "Electrical" "Functional" "Garage_Type"
## [33] "Garage_Finish" "Garage_Cond" "Paved_Drive" "Pool_QC"
## [37] "Fence" "Misc_Feature" "Sale_Type" "Sale_Condition"
# Menentukan variabel untuk scatterplot matrix
variabel_utama <- c(
"log_price",
"Gr_Liv_Area",
"Lot_Area",
"Year_Built",
"Total_Bsmt_SF",
"Garage_Cars"
)
# Membuat scatterplot matrix
pairs(
latih[, variabel_utama],
main = "Scatterplot Matrix Variabel Ames Housing",
pch = 20,
col = rgb(0, 0, 1, 0.3)
)
# Visualisasi hubungan respons dengan prediktor numerik
for (v in num_vars) {
p <- ggplot(
latih,
aes(x = .data[[v]], y = log_price)
) +
geom_point(alpha = 0.25) +
geom_smooth(
method = "loess",
se = TRUE,
color = "red"
) +
labs(
title = paste("Hubungan Log Harga Rumah dengan", v),
x = v,
y = "log(Sale_Price)"
) +
theme_minimal()
print(p)
}
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : at -7.63
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : radius 58.217
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at -7.63
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 7.63
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : zero-width neighborhood. make span bigger
## Warning: Failed to fit group -1.
## Caused by error in `predLoess()`:
## ! NA/NaN/Inf in foreign function call (arg 5)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 1.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 3.3686e-28
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : There are other near singularities as well. 1
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used at
## -0.015
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 1.015
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal condition
## number 3.3686e-28
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other near
## singularities as well. 1
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : at -0.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : radius 0.0001
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at -0.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 0.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : There are other near singularities as well. 4.0401
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : zero-width neighborhood. make span bigger
## Warning: Failed to fit group -1.
## Caused by error in `predLoess()`:
## ! NA/NaN/Inf in foreign function call (arg 5)
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at -0.02
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 2.02
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 2.1913e-16
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : There are other near singularities as well. 1
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used at
## -0.02
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 2.02
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal condition
## number 2.1913e-16
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other near
## singularities as well. 1
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at -0.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 1.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 9.8808e-31
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : There are other near singularities as well. 4.0401
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used at
## -0.01
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 1.01
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal condition
## number 9.8808e-31
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other near
## singularities as well. 4.0401
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at 2
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : There are other near singularities as well. 1
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used at 2
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius 1
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal condition
## number 0
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other near
## singularities as well. 1
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 1.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : There are other near singularities as well. 4.0602
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : zero-width neighborhood. make span bigger
## Warning: Failed to fit group -1.
## Caused by error in `predLoess()`:
## ! NA/NaN/Inf in foreign function call (arg 5)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at -0.02
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 1.02
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 1.4617e-28
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : There are other near singularities as well. 1
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used at
## -0.02
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 1.02
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal condition
## number 1.4617e-28
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other near
## singularities as well. 1
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at -0.025
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 2.025
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 2.8294e-15
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : There are other near singularities as well. 1
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used at
## -0.025
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 2.025
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal condition
## number 2.8294e-15
## Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
## else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other near
## singularities as well. 1
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : at -5.06
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : radius 25.604
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at -5.06
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 5.06
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : zero-width neighborhood. make span bigger
## Warning: Failed to fit group -1.
## Caused by error in `predLoess()`:
## ! NA/NaN/Inf in foreign function call (arg 5)
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : at -2.54
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : radius 6.4516
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at -2.54
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 2.54
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : zero-width neighborhood. make span bigger
## Warning: Failed to fit group -1.
## Caused by error in `predLoess()`:
## ! NA/NaN/Inf in foreign function call (arg 5)
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : at -2.88
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : radius 8.2944
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at -2.88
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 2.88
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : zero-width neighborhood. make span bigger
## Warning: Failed to fit group -1.
## Caused by error in `predLoess()`:
## ! NA/NaN/Inf in foreign function call (arg 5)
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : at -4
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : radius 16
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at -4
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 4
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : zero-width neighborhood. make span bigger
## Warning: Failed to fit group -1.
## Caused by error in `predLoess()`:
## ! NA/NaN/Inf in foreign function call (arg 5)
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : at -85
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : radius 7225
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at -85
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 85
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : zero-width neighborhood. make span bigger
## Warning: Failed to fit group -1.
## Caused by error in `predLoess()`:
## ! NA/NaN/Inf in foreign function call (arg 5)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
# Menentukan variabel untuk matriks korelasi
variabel_korelasi <- c("log_price", num_vars)
# Menghitung matriks korelasi
mat_korelasi <- cor(
latih[, variabel_korelasi],
use = "complete.obs"
)
# Menampilkan matriks korelasi
round(mat_korelasi, 2)
## log_price Lot_Frontage Lot_Area Year_Built Year_Remod_Add
## log_price 1.00 0.16 0.25 0.60 0.58
## Lot_Frontage 0.16 1.00 0.14 0.02 0.06
## Lot_Area 0.25 0.14 1.00 0.02 0.02
## Year_Built 0.60 0.02 0.02 1.00 0.60
## Year_Remod_Add 0.58 0.06 0.02 0.60 1.00
## Mas_Vnr_Area 0.44 0.11 0.12 0.30 0.19
## BsmtFin_SF_1 -0.17 0.06 -0.05 -0.17 -0.04
## BsmtFin_SF_2 0.03 0.00 0.09 -0.03 -0.07
## Bsmt_Unf_SF 0.20 0.14 0.02 0.13 0.17
## Total_Bsmt_SF 0.62 0.21 0.25 0.39 0.28
## First_Flr_SF 0.59 0.24 0.33 0.29 0.23
## Second_Flr_SF 0.29 0.00 0.03 0.02 0.17
## Gr_Liv_Area 0.69 0.19 0.28 0.22 0.30
## Bsmt_Full_Bath 0.26 0.02 0.13 0.20 0.12
## Bsmt_Half_Bath -0.01 -0.02 0.03 -0.02 -0.03
## Full_Bath 0.58 0.09 0.13 0.45 0.45
## Half_Bath 0.32 -0.04 0.02 0.29 0.23
## Bedroom_AbvGr 0.19 0.12 0.14 -0.06 -0.02
## Kitchen_AbvGr -0.13 0.02 -0.02 -0.15 -0.15
## TotRms_AbvGrd 0.49 0.20 0.21 0.09 0.19
## Fireplaces 0.50 0.06 0.26 0.16 0.12
## Garage_Cars 0.68 0.13 0.17 0.53 0.42
## Garage_Area 0.66 0.17 0.20 0.48 0.38
## Wood_Deck_SF 0.33 0.01 0.17 0.22 0.20
## Open_Porch_SF 0.31 0.09 0.09 0.18 0.23
## Enclosed_Porch -0.13 0.03 0.02 -0.36 -0.21
## Three_season_porch 0.05 0.00 0.01 0.03 0.04
## Screen_Porch 0.09 0.04 0.03 -0.04 -0.06
## Pool_Area 0.03 0.11 0.10 -0.01 -0.03
## Misc_Val 0.01 0.02 0.08 0.00 0.00
## Mo_Sold 0.04 0.00 0.00 0.01 0.02
## Year_Sold -0.03 -0.02 -0.03 -0.01 0.03
## Longitude -0.27 -0.02 -0.10 -0.41 -0.32
## Latitude 0.29 0.05 -0.05 0.25 0.18
## Mas_Vnr_Area BsmtFin_SF_1 BsmtFin_SF_2 Bsmt_Unf_SF
## log_price 0.44 -0.17 0.03 0.20
## Lot_Frontage 0.11 0.06 0.00 0.14
## Lot_Area 0.12 -0.05 0.09 0.02
## Year_Built 0.30 -0.17 -0.03 0.13
## Year_Remod_Add 0.19 -0.04 -0.07 0.17
## Mas_Vnr_Area 1.00 -0.10 0.00 0.10
## BsmtFin_SF_1 -0.10 1.00 -0.12 0.49
## BsmtFin_SF_2 0.00 -0.12 1.00 -0.24
## Bsmt_Unf_SF 0.10 0.49 -0.24 1.00
## Total_Bsmt_SF 0.38 -0.17 0.10 0.41
## First_Flr_SF 0.38 -0.13 0.09 0.30
## Second_Flr_SF 0.14 0.16 -0.10 0.01
## Gr_Liv_Area 0.41 0.04 -0.01 0.24
## Bsmt_Full_Bath 0.13 -0.47 0.15 -0.39
## Bsmt_Half_Bath 0.01 -0.12 0.10 -0.11
## Full_Bath 0.26 0.05 -0.07 0.28
## Half_Bath 0.20 0.03 -0.03 -0.02
## Bedroom_AbvGr 0.09 0.10 -0.01 0.18
## Kitchen_AbvGr -0.05 0.10 -0.05 0.08
## TotRms_AbvGrd 0.28 0.10 -0.04 0.25
## Fireplaces 0.27 -0.14 0.09 0.00
## Garage_Cars 0.35 -0.08 -0.02 0.18
## Garage_Area 0.37 -0.10 0.00 0.17
## Wood_Deck_SF 0.18 -0.14 0.09 -0.03
## Open_Porch_SF 0.13 0.00 0.01 0.11
## Enclosed_Porch -0.10 0.09 0.05 0.00
## Three_season_porch 0.01 -0.06 -0.03 0.00
## Screen_Porch 0.05 -0.05 0.08 -0.05
## Pool_Area 0.01 -0.02 0.04 -0.02
## Misc_Val 0.07 -0.05 0.00 -0.01
## Mo_Sold 0.00 0.01 -0.02 0.03
## Year_Sold -0.02 -0.03 0.01 -0.03
## Longitude -0.08 0.05 -0.03 -0.04
## Latitude 0.22 0.01 -0.02 0.16
## Total_Bsmt_SF First_Flr_SF Second_Flr_SF Gr_Liv_Area
## log_price 0.62 0.59 0.29 0.69
## Lot_Frontage 0.21 0.24 0.00 0.19
## Lot_Area 0.25 0.33 0.03 0.28
## Year_Built 0.39 0.29 0.02 0.22
## Year_Remod_Add 0.28 0.23 0.17 0.30
## Mas_Vnr_Area 0.38 0.38 0.14 0.41
## BsmtFin_SF_1 -0.17 -0.13 0.16 0.04
## BsmtFin_SF_2 0.10 0.09 -0.10 -0.01
## Bsmt_Unf_SF 0.41 0.30 0.01 0.24
## Total_Bsmt_SF 1.00 0.80 -0.19 0.45
## First_Flr_SF 0.80 1.00 -0.23 0.57
## Second_Flr_SF -0.19 -0.23 1.00 0.66
## Gr_Liv_Area 0.45 0.57 0.66 1.00
## Bsmt_Full_Bath 0.32 0.25 -0.17 0.05
## Bsmt_Half_Bath 0.02 0.02 -0.06 -0.04
## Full_Bath 0.33 0.38 0.41 0.64
## Half_Bath -0.05 -0.10 0.61 0.43
## Bedroom_AbvGr 0.06 0.13 0.50 0.53
## Kitchen_AbvGr -0.03 0.07 0.09 0.13
## TotRms_AbvGrd 0.28 0.40 0.59 0.81
## Fireplaces 0.34 0.42 0.17 0.46
## Garage_Cars 0.43 0.43 0.19 0.49
## Garage_Area 0.49 0.49 0.15 0.49
## Wood_Deck_SF 0.24 0.24 0.08 0.25
## Open_Porch_SF 0.24 0.25 0.19 0.35
## Enclosed_Porch -0.07 -0.05 0.05 0.01
## Three_season_porch 0.05 0.05 -0.04 0.01
## Screen_Porch 0.07 0.09 -0.01 0.07
## Pool_Area 0.07 0.11 0.04 0.12
## Misc_Val 0.12 0.14 0.01 0.11
## Mo_Sold 0.03 0.05 0.00 0.04
## Year_Sold -0.01 -0.02 -0.02 -0.03
## Longitude -0.14 -0.11 -0.06 -0.13
## Latitude 0.16 0.12 0.11 0.18
## Bsmt_Full_Bath Bsmt_Half_Bath Full_Bath Half_Bath
## log_price 0.26 -0.01 0.58 0.32
## Lot_Frontage 0.02 -0.02 0.09 -0.04
## Lot_Area 0.13 0.03 0.13 0.02
## Year_Built 0.20 -0.02 0.45 0.29
## Year_Remod_Add 0.12 -0.03 0.45 0.23
## Mas_Vnr_Area 0.13 0.01 0.26 0.20
## BsmtFin_SF_1 -0.47 -0.12 0.05 0.03
## BsmtFin_SF_2 0.15 0.10 -0.07 -0.03
## Bsmt_Unf_SF -0.39 -0.11 0.28 -0.02
## Total_Bsmt_SF 0.32 0.02 0.33 -0.05
## First_Flr_SF 0.25 0.02 0.38 -0.10
## Second_Flr_SF -0.17 -0.06 0.41 0.61
## Gr_Liv_Area 0.05 -0.04 0.64 0.43
## Bsmt_Full_Bath 1.00 -0.15 -0.03 -0.05
## Bsmt_Half_Bath -0.15 1.00 -0.04 -0.06
## Full_Bath -0.03 -0.04 1.00 0.17
## Half_Bath -0.05 -0.06 0.17 1.00
## Bedroom_AbvGr -0.16 0.02 0.36 0.24
## Kitchen_AbvGr -0.03 -0.07 0.18 -0.06
## TotRms_AbvGrd -0.06 -0.05 0.53 0.34
## Fireplaces 0.16 0.04 0.25 0.20
## Garage_Cars 0.16 -0.03 0.47 0.24
## Garage_Area 0.18 -0.02 0.41 0.19
## Wood_Deck_SF 0.18 0.07 0.18 0.11
## Open_Porch_SF 0.09 -0.04 0.26 0.19
## Enclosed_Porch -0.06 -0.01 -0.11 -0.09
## Three_season_porch 0.02 0.04 0.02 -0.03
## Screen_Porch 0.04 0.05 -0.02 0.03
## Pool_Area 0.04 0.09 0.03 -0.02
## Misc_Val 0.01 0.05 0.01 0.05
## Mo_Sold 0.01 0.03 0.04 -0.01
## Year_Sold 0.04 -0.02 -0.01 0.00
## Longitude -0.11 0.06 -0.21 -0.13
## Latitude -0.02 -0.04 0.22 0.17
## Bedroom_AbvGr Kitchen_AbvGr TotRms_AbvGrd Fireplaces
## log_price 0.19 -0.13 0.49 0.50
## Lot_Frontage 0.12 0.02 0.20 0.06
## Lot_Area 0.14 -0.02 0.21 0.26
## Year_Built -0.06 -0.15 0.09 0.16
## Year_Remod_Add -0.02 -0.15 0.19 0.12
## Mas_Vnr_Area 0.09 -0.05 0.28 0.27
## BsmtFin_SF_1 0.10 0.10 0.10 -0.14
## BsmtFin_SF_2 -0.01 -0.05 -0.04 0.09
## Bsmt_Unf_SF 0.18 0.08 0.25 0.00
## Total_Bsmt_SF 0.06 -0.03 0.28 0.34
## First_Flr_SF 0.13 0.07 0.40 0.42
## Second_Flr_SF 0.50 0.09 0.59 0.17
## Gr_Liv_Area 0.53 0.13 0.81 0.46
## Bsmt_Full_Bath -0.16 -0.03 -0.06 0.16
## Bsmt_Half_Bath 0.02 -0.07 -0.05 0.04
## Full_Bath 0.36 0.18 0.53 0.25
## Half_Bath 0.24 -0.06 0.34 0.20
## Bedroom_AbvGr 1.00 0.26 0.68 0.09
## Kitchen_AbvGr 0.26 1.00 0.31 -0.11
## TotRms_AbvGrd 0.68 0.31 1.00 0.31
## Fireplaces 0.09 -0.11 0.31 1.00
## Garage_Cars 0.09 -0.04 0.35 0.33
## Garage_Area 0.08 -0.06 0.33 0.31
## Wood_Deck_SF 0.04 -0.10 0.15 0.22
## Open_Porch_SF 0.10 -0.06 0.24 0.17
## Enclosed_Porch 0.06 0.04 0.03 0.02
## Three_season_porch -0.04 -0.02 -0.02 0.03
## Screen_Porch 0.01 -0.06 0.02 0.17
## Pool_Area 0.04 -0.01 0.08 0.10
## Misc_Val 0.01 0.02 0.10 0.03
## Mo_Sold 0.04 0.03 0.03 0.03
## Year_Sold -0.02 0.05 -0.03 -0.02
## Longitude -0.03 0.07 -0.08 -0.04
## Latitude 0.03 -0.07 0.15 0.15
## Garage_Cars Garage_Area Wood_Deck_SF Open_Porch_SF
## log_price 0.68 0.66 0.33 0.31
## Lot_Frontage 0.13 0.17 0.01 0.09
## Lot_Area 0.17 0.20 0.17 0.09
## Year_Built 0.53 0.48 0.22 0.18
## Year_Remod_Add 0.42 0.38 0.20 0.23
## Mas_Vnr_Area 0.35 0.37 0.18 0.13
## BsmtFin_SF_1 -0.08 -0.10 -0.14 0.00
## BsmtFin_SF_2 -0.02 0.00 0.09 0.01
## Bsmt_Unf_SF 0.18 0.17 -0.03 0.11
## Total_Bsmt_SF 0.43 0.49 0.24 0.24
## First_Flr_SF 0.43 0.49 0.24 0.25
## Second_Flr_SF 0.19 0.15 0.08 0.19
## Gr_Liv_Area 0.49 0.49 0.25 0.35
## Bsmt_Full_Bath 0.16 0.18 0.18 0.09
## Bsmt_Half_Bath -0.03 -0.02 0.07 -0.04
## Full_Bath 0.47 0.41 0.18 0.26
## Half_Bath 0.24 0.19 0.11 0.19
## Bedroom_AbvGr 0.09 0.08 0.04 0.10
## Kitchen_AbvGr -0.04 -0.06 -0.10 -0.06
## TotRms_AbvGrd 0.35 0.33 0.15 0.24
## Fireplaces 0.33 0.31 0.22 0.17
## Garage_Cars 1.00 0.89 0.24 0.21
## Garage_Area 0.89 1.00 0.25 0.24
## Wood_Deck_SF 0.24 0.25 1.00 0.04
## Open_Porch_SF 0.21 0.24 0.04 1.00
## Enclosed_Porch -0.12 -0.10 -0.11 -0.05
## Three_season_porch 0.03 0.03 -0.01 -0.01
## Screen_Porch 0.03 0.05 -0.06 0.05
## Pool_Area 0.02 0.05 0.10 0.08
## Misc_Val 0.00 0.03 0.09 0.12
## Mo_Sold 0.04 0.03 0.04 0.02
## Year_Sold -0.01 0.00 0.00 -0.03
## Longitude -0.20 -0.21 -0.14 -0.09
## Latitude 0.28 0.22 0.01 0.09
## Enclosed_Porch Three_season_porch Screen_Porch Pool_Area
## log_price -0.13 0.05 0.09 0.03
## Lot_Frontage 0.03 0.00 0.04 0.11
## Lot_Area 0.02 0.01 0.03 0.10
## Year_Built -0.36 0.03 -0.04 -0.01
## Year_Remod_Add -0.21 0.04 -0.06 -0.03
## Mas_Vnr_Area -0.10 0.01 0.05 0.01
## BsmtFin_SF_1 0.09 -0.06 -0.05 -0.02
## BsmtFin_SF_2 0.05 -0.03 0.08 0.04
## Bsmt_Unf_SF 0.00 0.00 -0.05 -0.02
## Total_Bsmt_SF -0.07 0.05 0.07 0.07
## First_Flr_SF -0.05 0.05 0.09 0.11
## Second_Flr_SF 0.05 -0.04 -0.01 0.04
## Gr_Liv_Area 0.01 0.01 0.07 0.12
## Bsmt_Full_Bath -0.06 0.02 0.04 0.04
## Bsmt_Half_Bath -0.01 0.04 0.05 0.09
## Full_Bath -0.11 0.02 -0.02 0.03
## Half_Bath -0.09 -0.03 0.03 -0.02
## Bedroom_AbvGr 0.06 -0.04 0.01 0.04
## Kitchen_AbvGr 0.04 -0.02 -0.06 -0.01
## TotRms_AbvGrd 0.03 -0.02 0.02 0.08
## Fireplaces 0.02 0.03 0.17 0.10
## Garage_Cars -0.12 0.03 0.03 0.02
## Garage_Area -0.10 0.03 0.05 0.05
## Wood_Deck_SF -0.11 -0.01 -0.06 0.10
## Open_Porch_SF -0.05 -0.01 0.05 0.08
## Enclosed_Porch 1.00 -0.03 -0.07 0.12
## Three_season_porch -0.03 1.00 -0.03 -0.01
## Screen_Porch -0.07 -0.03 1.00 0.03
## Pool_Area 0.12 -0.01 0.03 1.00
## Misc_Val 0.02 -0.01 0.01 0.02
## Mo_Sold -0.04 0.02 0.02 -0.04
## Year_Sold -0.01 0.03 0.00 -0.05
## Longitude 0.12 0.01 0.06 0.00
## Latitude -0.10 0.01 0.02 -0.03
## Misc_Val Mo_Sold Year_Sold Longitude Latitude
## log_price 0.01 0.04 -0.03 -0.27 0.29
## Lot_Frontage 0.02 0.00 -0.02 -0.02 0.05
## Lot_Area 0.08 0.00 -0.03 -0.10 -0.05
## Year_Built 0.00 0.01 -0.01 -0.41 0.25
## Year_Remod_Add 0.00 0.02 0.03 -0.32 0.18
## Mas_Vnr_Area 0.07 0.00 -0.02 -0.08 0.22
## BsmtFin_SF_1 -0.05 0.01 -0.03 0.05 0.01
## BsmtFin_SF_2 0.00 -0.02 0.01 -0.03 -0.02
## Bsmt_Unf_SF -0.01 0.03 -0.03 -0.04 0.16
## Total_Bsmt_SF 0.12 0.03 -0.01 -0.14 0.16
## First_Flr_SF 0.14 0.05 -0.02 -0.11 0.12
## Second_Flr_SF 0.01 0.00 -0.02 -0.06 0.11
## Gr_Liv_Area 0.11 0.04 -0.03 -0.13 0.18
## Bsmt_Full_Bath 0.01 0.01 0.04 -0.11 -0.02
## Bsmt_Half_Bath 0.05 0.03 -0.02 0.06 -0.04
## Full_Bath 0.01 0.04 -0.01 -0.21 0.22
## Half_Bath 0.05 -0.01 0.00 -0.13 0.17
## Bedroom_AbvGr 0.01 0.04 -0.02 -0.03 0.03
## Kitchen_AbvGr 0.02 0.03 0.05 0.07 -0.07
## TotRms_AbvGrd 0.10 0.03 -0.03 -0.08 0.15
## Fireplaces 0.03 0.03 -0.02 -0.04 0.15
## Garage_Cars 0.00 0.04 -0.01 -0.20 0.28
## Garage_Area 0.03 0.03 0.00 -0.21 0.22
## Wood_Deck_SF 0.09 0.04 0.00 -0.14 0.01
## Open_Porch_SF 0.12 0.02 -0.03 -0.09 0.09
## Enclosed_Porch 0.02 -0.04 -0.01 0.12 -0.10
## Three_season_porch -0.01 0.02 0.03 0.01 0.01
## Screen_Porch 0.01 0.02 0.00 0.06 0.02
## Pool_Area 0.02 -0.04 -0.05 0.00 -0.03
## Misc_Val 1.00 0.02 0.02 -0.01 -0.02
## Mo_Sold 0.02 1.00 -0.17 0.04 0.05
## Year_Sold 0.02 -0.17 1.00 0.00 0.00
## Longitude -0.01 0.04 0.00 1.00 0.03
## Latitude -0.02 0.05 0.00 0.03 1.00
View(round(mat_korelasi, 2))
# Mengubah matriks korelasi menjadi format long
korelasi_long <- as.data.frame(
as.table(mat_korelasi)
)
# Visualisasi matriks korelasi
ggplot(
korelasi_long,
aes(x = Var1, y = Var2, fill = Freq)
) +
geom_tile(color = "white", linewidth = 0.3) +
scale_fill_gradient2(
low = "#2166AC",
mid = "white",
high = "#B2182B",
midpoint = 0,
limits = c(-1, 1),
name = "Korelasi"
) +
labs(
title = "Matriks Korelasi Variabel Numerik",
x = NULL,
y = NULL
) +
coord_fixed() +
theme_minimal() +
theme(
plot.title = element_text(
hjust = 0.5,
face = "bold",
size = 14
),
axis.text.x = element_text(
angle = 90,
hjust = 1,
vjust = 0.5,
size = 7
),
axis.text.y = element_text(size = 7),
panel.grid = element_blank(),
legend.position = "right"
)
# 4. Pemodelan Regresi Linear Berganda (OLS)
# Membentuk formula model
formula_ols <- as.formula(
paste("log_price ~", paste(prediktor, collapse = " + "))
)
# Membentuk model OLS
model_ols <- lm(formula_ols, data = latih)
# Ringkasan model
summary(model_ols)
##
## Call:
## lm(formula = formula_ols, data = latih)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.03444 -0.05053 0.00122 0.05487 0.56334
##
## Coefficients: (5 not defined because of singularities)
## Estimate Std. Error
## (Intercept) -1.714e+01 5.373e+01
## MS_SubClassOne_Story_1945_and_Older -2.411e-02 1.700e-02
## MS_SubClassOne_Story_with_Finished_Attic_All_Ages 2.922e-02 5.693e-02
## MS_SubClassOne_and_Half_Story_Unfinished_All_Ages -1.138e-02 6.345e-02
## MS_SubClassOne_and_Half_Story_Finished_All_Ages 3.135e-02 3.148e-02
## MS_SubClassTwo_Story_1946_and_Newer -5.302e-02 2.767e-02
## MS_SubClassTwo_Story_1945_and_Older 3.998e-02 3.056e-02
## MS_SubClassTwo_and_Half_Story_All_Ages 7.838e-02 5.449e-02
## MS_SubClassSplit_or_Multilevel -6.644e-02 5.865e-02
## MS_SubClassSplit_Foyer -1.024e-02 3.892e-02
## MS_SubClassDuplex_All_Styles_and_Ages -1.017e-01 2.809e-02
## MS_SubClassOne_Story_PUD_1946_and_Newer -8.720e-02 4.884e-02
## MS_SubClassOne_and_Half_Story_PUD_All_Ages -2.101e-01 1.352e-01
## MS_SubClassTwo_Story_PUD_1946_and_Newer -2.202e-01 5.799e-02
## MS_SubClassPUD_Multilevel_Split_Level_Foyer -1.756e-01 7.033e-02
## MS_SubClassTwo_Family_conversion_All_Styles_and_Ages -1.532e-02 7.907e-02
## MS_ZoningResidential_High_Density -9.482e-04 3.597e-02
## MS_ZoningResidential_Low_Density 3.532e-03 2.452e-02
## MS_ZoningResidential_Medium_Density -5.055e-02 2.827e-02
## MS_ZoningA_agr 1.830e-01 2.137e-01
## MS_ZoningC_all -2.505e-01 4.341e-02
## MS_ZoningI_all -2.144e-02 1.538e-01
## Lot_Frontage 2.066e-05 8.808e-05
## Lot_Area 2.030e-06 4.608e-07
## StreetPave 7.388e-02 5.649e-02
## AlleyNo_Alley_Access -6.942e-03 1.519e-02
## AlleyPaved 2.668e-02 2.277e-02
## Lot_ShapeSlightly_Irregular 1.577e-03 6.291e-03
## Lot_ShapeModerately_Irregular 1.511e-02 1.671e-02
## Lot_ShapeIrregular 7.224e-03 3.513e-02
## Land_ContourHLS 5.135e-02 1.903e-02
## Land_ContourLow -9.477e-03 2.627e-02
## Land_ContourLvl 2.790e-02 1.398e-02
## UtilitiesNoSeWa -1.647e-01 1.334e-01
## Lot_ConfigCulDSac -1.743e-03 1.243e-02
## Lot_ConfigFR2 -3.477e-02 1.606e-02
## Lot_ConfigFR3 -2.803e-02 3.543e-02
## Lot_ConfigInside -9.868e-03 6.747e-03
## Land_SlopeMod 1.084e-02 1.556e-02
## Land_SlopeSev -1.239e-01 5.091e-02
## NeighborhoodCollege_Creek 4.151e-02 4.637e-02
## NeighborhoodOld_Town -1.679e-02 2.164e-02
## NeighborhoodEdwards -4.647e-02 3.656e-02
## NeighborhoodSomerset 1.239e-01 2.681e-02
## NeighborhoodNorthridge_Heights 1.501e-01 2.608e-02
## NeighborhoodGilbert 7.991e-03 2.234e-02
## NeighborhoodSawyer 2.196e-02 3.341e-02
## NeighborhoodNorthwest_Ames 1.042e-03 1.645e-02
## NeighborhoodSawyer_West 1.320e-02 4.113e-02
## NeighborhoodMitchell 2.641e-02 4.242e-02
## NeighborhoodBrookside 4.783e-02 2.228e-02
## NeighborhoodCrawford 1.248e-01 3.238e-02
## NeighborhoodIowa_DOT_and_Rail_Road 2.587e-02 2.975e-02
## NeighborhoodTimberland 7.363e-02 4.828e-02
## NeighborhoodNorthridge 9.424e-02 2.721e-02
## NeighborhoodStone_Brook 2.097e-01 2.772e-02
## NeighborhoodSouth_and_West_of_Iowa_State_University 2.978e-02 3.794e-02
## NeighborhoodClear_Creek 8.448e-02 4.154e-02
## NeighborhoodMeadow_Village -6.077e-02 5.062e-02
## NeighborhoodBriardale 9.424e-02 3.737e-02
## NeighborhoodBloomington_Heights -6.876e-03 3.510e-02
## NeighborhoodVeenker 4.002e-02 3.535e-02
## NeighborhoodNorthpark_Villa 8.957e-02 5.005e-02
## NeighborhoodBlueste 1.915e-01 6.119e-02
## NeighborhoodGreens 2.256e-01 5.560e-02
## NeighborhoodGreen_Hills 5.801e-01 9.185e-02
## Condition_1Feedr -6.766e-04 1.897e-02
## Condition_1Norm 5.190e-02 1.582e-02
## Condition_1PosA 7.216e-02 3.342e-02
## Condition_1PosN 6.386e-02 2.753e-02
## Condition_1RRAe -2.224e-02 3.036e-02
## Condition_1RRAn 1.470e-02 2.600e-02
## Condition_1RRNe -1.313e-03 5.456e-02
## Condition_1RRNn 7.372e-02 5.148e-02
## Condition_2Feedr 5.269e-02 7.236e-02
## Condition_2Norm 1.422e-01 6.414e-02
## Condition_2PosA 3.484e-01 9.501e-02
## Condition_2PosN -3.594e-01 9.545e-02
## Condition_2RRAe -3.060e-01 2.140e-01
## Condition_2RRAn 8.682e-02 1.320e-01
## Condition_2RRNn 8.680e-03 1.310e-01
## Bldg_TypeTwoFmCon 2.657e-02 7.852e-02
## Bldg_TypeDuplex NA NA
## Bldg_TypeTwnhs -1.196e-03 5.199e-02
## Bldg_TypeTwnhsE 4.516e-02 4.868e-02
## House_StyleOne_and_Half_Unf 7.355e-02 6.036e-02
## House_StyleOne_Story -1.009e-02 3.178e-02
## House_StyleSFoyer 1.370e-02 4.254e-02
## House_StyleSLvl 5.902e-02 6.042e-02
## House_StyleTwo_and_Half_Fin -4.021e-02 6.662e-02
## House_StyleTwo_and_Half_Unf 1.777e-02 5.316e-02
## House_StyleTwo_Story 4.051e-02 2.778e-02
## Overall_CondPoor 1.779e-02 8.935e-02
## Overall_CondFair -2.141e-02 6.923e-02
## Overall_CondBelow_Average 9.248e-02 6.863e-02
## Overall_CondAverage 1.642e-01 6.797e-02
## Overall_CondAbove_Average 1.947e-01 6.817e-02
## Overall_CondGood 2.393e-01 6.837e-02
## Overall_CondVery_Good 2.698e-01 6.887e-02
## Overall_CondExcellent 3.431e-01 7.154e-02
## Year_Built 2.477e-03 2.938e-04
## Year_Remod_Add 9.084e-04 2.030e-04
## Roof_StyleGable 7.448e-02 6.076e-02
## Roof_StyleGambrel 3.492e-02 6.760e-02
## Roof_StyleHip 8.935e-02 6.118e-02
## Roof_StyleMansard 4.808e-02 7.423e-02
## Roof_StyleShed 3.940e-01 1.544e-01
## Roof_MatlCompShg 2.881e+00 1.974e-01
## Roof_MatlMembran 3.231e+00 2.430e-01
## Roof_MatlMetal 3.131e+00 2.427e-01
## Roof_MatlRoll 2.986e+00 2.290e-01
## Roof_MatlTar&Grv 2.956e+00 2.033e-01
## Roof_MatlWdShake 2.840e+00 2.035e-01
## Roof_MatlWdShngl 3.027e+00 2.012e-01
## Exterior_1stAsphShn 1.167e-02 1.276e-01
## Exterior_1stBrkComm 5.083e-02 7.819e-02
## Exterior_1stBrkFace 1.249e-01 5.036e-02
## Exterior_1stCBlock -2.737e-01 1.788e-01
## Exterior_1stCemntBd -4.068e-02 7.458e-02
## Exterior_1stHdBoard 1.908e-02 4.967e-02
## Exterior_1stImStucc 5.059e-02 1.266e-01
## Exterior_1stMetalSd 7.276e-02 5.450e-02
## Exterior_1stPlywood 2.605e-02 4.875e-02
## Exterior_1stStone 3.714e-02 1.060e-01
## Exterior_1stStucco 5.444e-02 5.375e-02
## Exterior_1stVinylSd 2.022e-02 5.248e-02
## Exterior_1stWd Sdng 1.879e-02 4.820e-02
## Exterior_1stWdShing 2.845e-02 5.115e-02
## Exterior_2ndAsphShn 7.345e-02 9.803e-02
## Exterior_2ndBrk Cmn 2.598e-02 7.052e-02
## Exterior_2ndBrkFace -3.353e-02 5.323e-02
## Exterior_2ndCBlock 1.825e-01 1.366e-01
## Exterior_2ndCmentBd 1.041e-01 7.511e-02
## Exterior_2ndHdBoard 1.318e-02 4.962e-02
## Exterior_2ndImStucc -2.792e-03 5.774e-02
## Exterior_2ndMetalSd -1.448e-02 5.436e-02
## Exterior_2ndPlywood 8.406e-03 4.794e-02
## Exterior_2ndStone -3.039e-02 8.363e-02
## Exterior_2ndStucco 3.103e-02 5.377e-02
## Exterior_2ndVinylSd 2.598e-02 5.216e-02
## Exterior_2ndWd Sdng 3.727e-02 4.833e-02
## Exterior_2ndWd Shng 4.717e-02 5.034e-02
## Mas_Vnr_TypeBrkFace 4.512e-02 2.746e-02
## Mas_Vnr_TypeCBlock -6.024e-01 1.892e-01
## Mas_Vnr_TypeNone 3.521e-02 2.732e-02
## Mas_Vnr_TypeStone 6.016e-02 2.870e-02
## Mas_Vnr_Area 2.026e-05 2.180e-05
## Exter_CondFair -4.246e-02 4.242e-02
## Exter_CondGood -2.812e-02 3.801e-02
## Exter_CondPoor -1.043e-01 1.111e-01
## Exter_CondTypical -4.592e-03 3.792e-02
## FoundationCBlock 4.370e-03 1.169e-02
## FoundationPConc 2.503e-02 1.273e-02
## FoundationSlab -9.672e-03 3.580e-02
## FoundationStone 6.917e-02 4.087e-02
## FoundationWood -5.849e-03 8.335e-02
## Bsmt_CondFair -1.584e-02 6.982e-02
## Bsmt_CondGood 7.705e-03 6.913e-02
## Bsmt_CondNo_Basement -2.513e-01 1.766e-01
## Bsmt_CondPoor -2.921e-03 9.286e-02
## Bsmt_CondTypical -1.009e-02 6.820e-02
## Bsmt_ExposureGd 3.863e-02 1.122e-02
## Bsmt_ExposureMn -2.243e-02 1.131e-02
## Bsmt_ExposureNo -2.480e-02 8.514e-03
## Bsmt_ExposureNo_Basement -5.240e-02 6.516e-02
## BsmtFin_Type_1BLQ -6.715e-02 3.779e-02
## BsmtFin_Type_1GLQ -9.308e-02 7.328e-02
## BsmtFin_Type_1LwQ -2.028e-01 1.096e-01
## BsmtFin_Type_1No_Basement NA NA
## BsmtFin_Type_1Rec -3.109e-01 1.820e-01
## BsmtFin_Type_1Unf -3.536e-01 2.184e-01
## BsmtFin_SF_1 5.861e-02 3.635e-02
## BsmtFin_Type_2BLQ -3.955e-02 2.421e-02
## BsmtFin_Type_2GLQ 5.544e-02 2.906e-02
## BsmtFin_Type_2LwQ -2.861e-02 2.312e-02
## BsmtFin_Type_2No_Basement NA NA
## BsmtFin_Type_2Rec -2.918e-02 2.267e-02
## BsmtFin_Type_2Unf -1.861e-02 2.294e-02
## BsmtFin_SF_2 -2.586e-05 2.744e-05
## Bsmt_Unf_SF -6.044e-05 1.121e-05
## Total_Bsmt_SF 1.475e-04 1.790e-05
## HeatingGasA 1.628e-01 1.186e-01
## HeatingGasW 2.391e-01 1.210e-01
## HeatingGrav 2.724e-02 1.275e-01
## HeatingOthW 1.862e-01 1.458e-01
## HeatingWall 2.258e-01 1.363e-01
## Heating_QCFair -3.893e-02 1.693e-02
## Heating_QCGood -1.620e-02 7.685e-03
## Heating_QCPoor -1.549e+00 3.138e-01
## Heating_QCTypical -3.703e-02 7.449e-03
## Central_AirY 3.399e-02 1.323e-02
## ElectricalFuseF -2.092e-02 2.172e-02
## ElectricalFuseP -1.169e-02 5.301e-02
## ElectricalMix 1.479e-01 1.591e-01
## ElectricalSBrkr -5.993e-03 1.113e-02
## ElectricalUnknown 3.859e-03 1.140e-01
## First_Flr_SF 1.326e-04 6.195e-05
## Second_Flr_SF 8.466e-05 5.887e-05
## Gr_Liv_Area 1.596e-04 6.066e-05
## Bsmt_Full_Bath 1.530e-02 7.225e-03
## Bsmt_Half_Bath -2.556e-03 1.074e-02
## Full_Bath 2.223e-02 7.991e-03
## Half_Bath 2.409e-02 7.693e-03
## Bedroom_AbvGr -6.755e-03 5.054e-03
## Kitchen_AbvGr -3.927e-02 2.389e-02
## TotRms_AbvGrd 8.582e-03 3.441e-03
## FunctionalMaj2 -1.940e-01 5.912e-02
## FunctionalMin1 7.257e-03 3.649e-02
## FunctionalMin2 4.754e-03 3.606e-02
## FunctionalMod 2.454e-03 4.011e-02
## FunctionalSal -3.588e-01 1.370e-01
## FunctionalSev -1.684e-01 1.341e-01
## FunctionalTyp 6.908e-02 3.237e-02
## Fireplaces 3.531e-02 5.002e-03
## Garage_TypeBasment -2.265e-02 2.612e-02
## Garage_TypeBuiltIn -9.890e-03 1.234e-02
## Garage_TypeCarPort -6.113e-02 4.558e-02
## Garage_TypeDetchd -1.728e-02 8.842e-03
## Garage_TypeMore_Than_Two_Types -5.785e-02 3.105e-02
## Garage_TypeNo_Garage -6.705e-02 9.632e-02
## Garage_FinishNo_Garage -3.469e-02 1.147e-01
## Garage_FinishRFn -1.329e-02 7.405e-03
## Garage_FinishUnf -6.193e-03 8.846e-03
## Garage_Cars 2.757e-02 8.597e-03
## Garage_Area 6.872e-05 2.914e-05
## Garage_CondFair -9.914e-02 6.812e-02
## Garage_CondGood -4.841e-02 7.377e-02
## Garage_CondNo_Garage NA NA
## Garage_CondPoor -7.921e-02 7.737e-02
## Garage_CondTypical -4.971e-02 6.594e-02
## Paved_DrivePartial_Pavement 1.134e-02 1.955e-02
## Paved_DrivePaved 2.382e-02 1.267e-02
## Wood_Deck_SF 4.835e-05 2.180e-05
## Open_Porch_SF 5.012e-05 4.153e-05
## Enclosed_Porch 1.329e-04 4.374e-05
## Three_season_porch 1.537e-04 9.595e-05
## Screen_Porch 2.358e-04 4.537e-05
## Pool_Area -7.885e-04 5.531e-04
## Pool_QCFair 2.106e+00 2.791e-01
## Pool_QCGood 3.506e-01 1.830e-01
## Pool_QCNo_Pool -3.448e-01 3.112e-01
## Pool_QCTypical 1.635e-02 1.528e-01
## FenceGood_Wood -8.811e-03 1.782e-02
## FenceMinimum_Privacy -7.055e-03 1.451e-02
## FenceMinimum_Wood_Wire -8.031e-03 3.733e-02
## FenceNo_Fence -4.106e-03 1.303e-02
## Misc_FeatureGar2 2.168e+00 1.820e-01
## Misc_FeatureNone 2.189e+00 2.334e-01
## Misc_FeatureOthr 2.262e+00 2.153e-01
## Misc_FeatureShed 2.182e+00 2.258e-01
## Misc_FeatureTenC NA NA
## Misc_Val 4.367e-06 1.152e-05
## Mo_Sold 2.537e-05 9.171e-04
## Year_Sold -3.397e-03 1.937e-03
## Sale_TypeCon 1.431e-01 6.133e-02
## Sale_TypeConLD -1.026e-02 3.141e-02
## Sale_TypeConLI -1.367e-03 4.344e-02
## Sale_TypeConLw 1.498e-02 4.698e-02
## Sale_TypeCWD 4.165e-02 4.085e-02
## Sale_TypeNew -2.388e-02 6.331e-02
## Sale_TypeOth -1.866e-02 4.839e-02
## Sale_TypeVWD -2.249e-02 1.164e-01
## Sale_TypeWD 6.330e-03 1.551e-02
## Sale_ConditionAdjLand 2.344e-01 4.038e-02
## Sale_ConditionAlloca 1.080e-01 3.436e-02
## Sale_ConditionFamily 1.925e-02 2.236e-02
## Sale_ConditionNormal 7.324e-02 1.133e-02
## Sale_ConditionPartial 1.416e-01 6.178e-02
## Longitude -4.487e-02 5.409e-01
## Latitude 4.452e-01 7.822e-01
## t value Pr(>|t|)
## (Intercept) -0.319 0.749746
## MS_SubClassOne_Story_1945_and_Older -1.418 0.156364
## MS_SubClassOne_Story_with_Finished_Attic_All_Ages 0.513 0.607824
## MS_SubClassOne_and_Half_Story_Unfinished_All_Ages -0.179 0.857725
## MS_SubClassOne_and_Half_Story_Finished_All_Ages 0.996 0.319471
## MS_SubClassTwo_Story_1946_and_Newer -1.916 0.055453 .
## MS_SubClassTwo_Story_1945_and_Older 1.308 0.190989
## MS_SubClassTwo_and_Half_Story_All_Ages 1.438 0.150456
## MS_SubClassSplit_or_Multilevel -1.133 0.257452
## MS_SubClassSplit_Foyer -0.263 0.792505
## MS_SubClassDuplex_All_Styles_and_Ages -3.621 0.000301 ***
## MS_SubClassOne_Story_PUD_1946_and_Newer -1.785 0.074358 .
## MS_SubClassOne_and_Half_Story_PUD_All_Ages -1.554 0.120316
## MS_SubClassTwo_Story_PUD_1946_and_Newer -3.798 0.000150 ***
## MS_SubClassPUD_Multilevel_Split_Level_Foyer -2.497 0.012602 *
## MS_SubClassTwo_Family_conversion_All_Styles_and_Ages -0.194 0.846418
## MS_ZoningResidential_High_Density -0.026 0.978971
## MS_ZoningResidential_Low_Density 0.144 0.885446
## MS_ZoningResidential_Medium_Density -1.788 0.073858 .
## MS_ZoningA_agr 0.856 0.391958
## MS_ZoningC_all -5.772 9.03e-09 ***
## MS_ZoningI_all -0.139 0.889170
## Lot_Frontage 0.235 0.814567
## Lot_Area 4.406 1.11e-05 ***
## StreetPave 1.308 0.191060
## AlleyNo_Alley_Access -0.457 0.647638
## AlleyPaved 1.172 0.241515
## Lot_ShapeSlightly_Irregular 0.251 0.802075
## Lot_ShapeModerately_Irregular 0.904 0.365925
## Lot_ShapeIrregular 0.206 0.837094
## Land_ContourHLS 2.698 0.007024 **
## Land_ContourLow -0.361 0.718277
## Land_ContourLvl 1.996 0.046108 *
## UtilitiesNoSeWa -1.235 0.217127
## Lot_ConfigCulDSac -0.140 0.888518
## Lot_ConfigFR2 -2.165 0.030508 *
## Lot_ConfigFR3 -0.791 0.428875
## Lot_ConfigInside -1.463 0.143755
## Land_SlopeMod 0.696 0.486208
## Land_SlopeSev -2.433 0.015053 *
## NeighborhoodCollege_Creek 0.895 0.370822
## NeighborhoodOld_Town -0.776 0.437998
## NeighborhoodEdwards -1.271 0.203867
## NeighborhoodSomerset 4.620 4.08e-06 ***
## NeighborhoodNorthridge_Heights 5.755 9.93e-09 ***
## NeighborhoodGilbert 0.358 0.720547
## NeighborhoodSawyer 0.657 0.511164
## NeighborhoodNorthwest_Ames 0.063 0.949523
## NeighborhoodSawyer_West 0.321 0.748403
## NeighborhoodMitchell 0.623 0.533513
## NeighborhoodBrookside 2.147 0.031937 *
## NeighborhoodCrawford 3.853 0.000120 ***
## NeighborhoodIowa_DOT_and_Rail_Road 0.870 0.384652
## NeighborhoodTimberland 1.525 0.127407
## NeighborhoodNorthridge 3.463 0.000545 ***
## NeighborhoodStone_Brook 7.564 5.85e-14 ***
## NeighborhoodSouth_and_West_of_Iowa_State_University 0.785 0.432542
## NeighborhoodClear_Creek 2.034 0.042080 *
## NeighborhoodMeadow_Village -1.201 0.230067
## NeighborhoodBriardale 2.522 0.011751 *
## NeighborhoodBloomington_Heights -0.196 0.844686
## NeighborhoodVeenker 1.132 0.257710
## NeighborhoodNorthpark_Villa 1.789 0.073681 .
## NeighborhoodBlueste 3.129 0.001777 **
## NeighborhoodGreens 4.057 5.15e-05 ***
## NeighborhoodGreen_Hills 6.315 3.29e-10 ***
## Condition_1Feedr -0.036 0.971551
## Condition_1Norm 3.280 0.001054 **
## Condition_1PosA 2.159 0.030953 *
## Condition_1PosN 2.319 0.020465 *
## Condition_1RRAe -0.732 0.464021
## Condition_1RRAn 0.566 0.571750
## Condition_1RRNe -0.024 0.980805
## Condition_1RRNn 1.432 0.152322
## Condition_2Feedr 0.728 0.466561
## Condition_2Norm 2.217 0.026739 *
## Condition_2PosA 3.667 0.000251 ***
## Condition_2PosN -3.765 0.000171 ***
## Condition_2RRAe -1.430 0.152894
## Condition_2RRAn 0.658 0.510686
## Condition_2RRNn 0.066 0.947173
## Bldg_TypeTwoFmCon 0.338 0.735137
## Bldg_TypeDuplex NA NA
## Bldg_TypeTwnhs -0.023 0.981651
## Bldg_TypeTwnhsE 0.928 0.353656
## House_StyleOne_and_Half_Unf 1.219 0.223105
## House_StyleOne_Story -0.318 0.750828
## House_StyleSFoyer 0.322 0.747387
## House_StyleSLvl 0.977 0.328766
## House_StyleTwo_and_Half_Fin -0.604 0.546173
## House_StyleTwo_and_Half_Unf 0.334 0.738208
## House_StyleTwo_Story 1.458 0.144927
## Overall_CondPoor 0.199 0.842170
## Overall_CondFair -0.309 0.757135
## Overall_CondBelow_Average 1.348 0.177917
## Overall_CondAverage 2.416 0.015788 *
## Overall_CondAbove_Average 2.856 0.004334 **
## Overall_CondGood 3.501 0.000473 ***
## Overall_CondVery_Good 3.918 9.20e-05 ***
## Overall_CondExcellent 4.797 1.73e-06 ***
## Year_Built 8.430 < 2e-16 ***
## Year_Remod_Add 4.476 8.02e-06 ***
## Roof_StyleGable 1.226 0.220443
## Roof_StyleGambrel 0.517 0.605540
## Roof_StyleHip 1.460 0.144329
## Roof_StyleMansard 0.648 0.517300
## Roof_StyleShed 2.551 0.010805 *
## Roof_MatlCompShg 14.592 < 2e-16 ***
## Roof_MatlMembran 13.293 < 2e-16 ***
## Roof_MatlMetal 12.901 < 2e-16 ***
## Roof_MatlRoll 13.040 < 2e-16 ***
## Roof_MatlTar&Grv 14.542 < 2e-16 ***
## Roof_MatlWdShake 13.955 < 2e-16 ***
## Roof_MatlWdShngl 15.049 < 2e-16 ***
## Exterior_1stAsphShn 0.091 0.927158
## Exterior_1stBrkComm 0.650 0.515710
## Exterior_1stBrkFace 2.480 0.013222 *
## Exterior_1stCBlock -1.531 0.125985
## Exterior_1stCemntBd -0.545 0.585490
## Exterior_1stHdBoard 0.384 0.700869
## Exterior_1stImStucc 0.399 0.689609
## Exterior_1stMetalSd 1.335 0.182007
## Exterior_1stPlywood 0.534 0.593106
## Exterior_1stStone 0.350 0.726068
## Exterior_1stStucco 1.013 0.311302
## Exterior_1stVinylSd 0.385 0.699995
## Exterior_1stWd Sdng 0.390 0.696634
## Exterior_1stWdShing 0.556 0.578140
## Exterior_2ndAsphShn 0.749 0.453772
## Exterior_2ndBrk Cmn 0.368 0.712636
## Exterior_2ndBrkFace -0.630 0.528820
## Exterior_2ndCBlock 1.336 0.181718
## Exterior_2ndCmentBd 1.386 0.165863
## Exterior_2ndHdBoard 0.266 0.790485
## Exterior_2ndImStucc -0.048 0.961434
## Exterior_2ndMetalSd -0.266 0.789959
## Exterior_2ndPlywood 0.175 0.860835
## Exterior_2ndStone -0.363 0.716385
## Exterior_2ndStucco 0.577 0.563946
## Exterior_2ndVinylSd 0.498 0.618519
## Exterior_2ndWd Sdng 0.771 0.440652
## Exterior_2ndWd Shng 0.937 0.348870
## Mas_Vnr_TypeBrkFace 1.643 0.100556
## Mas_Vnr_TypeCBlock -3.183 0.001479 **
## Mas_Vnr_TypeNone 1.289 0.197569
## Mas_Vnr_TypeStone 2.096 0.036207 *
## Mas_Vnr_Area 0.929 0.352760
## Exter_CondFair -1.001 0.316968
## Exter_CondGood -0.740 0.459565
## Exter_CondPoor -0.939 0.347975
## Exter_CondTypical -0.121 0.903614
## FoundationCBlock 0.374 0.708582
## FoundationPConc 1.966 0.049424 *
## FoundationSlab -0.270 0.787046
## FoundationStone 1.692 0.090723 .
## FoundationWood -0.070 0.944063
## Bsmt_CondFair -0.227 0.820528
## Bsmt_CondGood 0.111 0.911273
## Bsmt_CondNo_Basement -1.423 0.155007
## Bsmt_CondPoor -0.031 0.974909
## Bsmt_CondTypical -0.148 0.882445
## Bsmt_ExposureGd 3.443 0.000587 ***
## Bsmt_ExposureMn -1.984 0.047379 *
## Bsmt_ExposureNo -2.912 0.003625 **
## Bsmt_ExposureNo_Basement -0.804 0.421422
## BsmtFin_Type_1BLQ -1.777 0.075699 .
## BsmtFin_Type_1GLQ -1.270 0.204147
## BsmtFin_Type_1LwQ -1.851 0.064378 .
## BsmtFin_Type_1No_Basement NA NA
## BsmtFin_Type_1Rec -1.708 0.087802 .
## BsmtFin_Type_1Unf -1.619 0.105538
## BsmtFin_SF_1 1.612 0.107011
## BsmtFin_Type_2BLQ -1.634 0.102500
## BsmtFin_Type_2GLQ 1.908 0.056559 .
## BsmtFin_Type_2LwQ -1.238 0.215987
## BsmtFin_Type_2No_Basement NA NA
## BsmtFin_Type_2Rec -1.287 0.198188
## BsmtFin_Type_2Unf -0.811 0.417346
## BsmtFin_SF_2 -0.943 0.345996
## Bsmt_Unf_SF -5.391 7.80e-08 ***
## Total_Bsmt_SF 8.242 2.96e-16 ***
## HeatingGasA 1.373 0.170000
## HeatingGasW 1.976 0.048316 *
## HeatingGrav 0.214 0.830790
## HeatingOthW 1.277 0.201695
## HeatingWall 1.656 0.097773 .
## Heating_QCFair -2.299 0.021592 *
## Heating_QCGood -2.109 0.035094 *
## Heating_QCPoor -4.936 8.60e-07 ***
## Heating_QCTypical -4.970 7.23e-07 ***
## Central_AirY 2.569 0.010272 *
## ElectricalFuseF -0.963 0.335545
## ElectricalFuseP -0.221 0.825500
## ElectricalMix 0.930 0.352575
## ElectricalSBrkr -0.539 0.590178
## ElectricalUnknown 0.034 0.973010
## First_Flr_SF 2.141 0.032420 *
## Second_Flr_SF 1.438 0.150574
## Gr_Liv_Area 2.631 0.008574 **
## Bsmt_Full_Bath 2.117 0.034341 *
## Bsmt_Half_Bath -0.238 0.811818
## Full_Bath 2.782 0.005445 **
## Half_Bath 3.132 0.001763 **
## Bedroom_AbvGr -1.336 0.181567
## Kitchen_AbvGr -1.643 0.100465
## TotRms_AbvGrd 2.494 0.012715 *
## FunctionalMaj2 -3.282 0.001049 **
## FunctionalMin1 0.199 0.842359
## FunctionalMin2 0.132 0.895125
## FunctionalMod 0.061 0.951212
## FunctionalSal -2.618 0.008899 **
## FunctionalSev -1.256 0.209284
## FunctionalTyp 2.134 0.032978 *
## Fireplaces 7.059 2.28e-12 ***
## Garage_TypeBasment -0.867 0.385902
## Garage_TypeBuiltIn -0.801 0.422992
## Garage_TypeCarPort -1.341 0.180073
## Garage_TypeDetchd -1.955 0.050743 .
## Garage_TypeMore_Than_Two_Types -1.863 0.062614 .
## Garage_TypeNo_Garage -0.696 0.486405
## Garage_FinishNo_Garage -0.302 0.762410
## Garage_FinishRFn -1.795 0.072788 .
## Garage_FinishUnf -0.700 0.483893
## Garage_Cars 3.207 0.001360 **
## Garage_Area 2.358 0.018449 *
## Garage_CondFair -1.455 0.145728
## Garage_CondGood -0.656 0.511734
## Garage_CondNo_Garage NA NA
## Garage_CondPoor -1.024 0.306069
## Garage_CondTypical -0.754 0.451027
## Paved_DrivePartial_Pavement 0.580 0.561944
## Paved_DrivePaved 1.880 0.060184 .
## Wood_Deck_SF 2.217 0.026712 *
## Open_Porch_SF 1.207 0.227623
## Enclosed_Porch 3.038 0.002414 **
## Three_season_porch 1.602 0.109384
## Screen_Porch 5.198 2.21e-07 ***
## Pool_Area -1.426 0.154157
## Pool_QCFair 7.543 6.80e-14 ***
## Pool_QCGood 1.916 0.055473 .
## Pool_QCNo_Pool -1.108 0.267913
## Pool_QCTypical 0.107 0.914821
## FenceGood_Wood -0.495 0.620960
## FenceMinimum_Privacy -0.486 0.626812
## FenceMinimum_Wood_Wire -0.215 0.829697
## FenceNo_Fence -0.315 0.752641
## Misc_FeatureGar2 11.908 < 2e-16 ***
## Misc_FeatureNone 9.378 < 2e-16 ***
## Misc_FeatureOthr 10.506 < 2e-16 ***
## Misc_FeatureShed 9.663 < 2e-16 ***
## Misc_FeatureTenC NA NA
## Misc_Val 0.379 0.704607
## Mo_Sold 0.028 0.977934
## Year_Sold -1.754 0.079638 .
## Sale_TypeCon 2.333 0.019735 *
## Sale_TypeConLD -0.327 0.743993
## Sale_TypeConLI -0.031 0.974893
## Sale_TypeConLw 0.319 0.749805
## Sale_TypeCWD 1.020 0.308059
## Sale_TypeNew -0.377 0.705997
## Sale_TypeOth -0.386 0.699778
## Sale_TypeVWD -0.193 0.846738
## Sale_TypeWD 0.408 0.683168
## Sale_ConditionAdjLand 5.806 7.39e-09 ***
## Sale_ConditionAlloca 3.142 0.001699 **
## Sale_ConditionFamily 0.861 0.389244
## Sale_ConditionNormal 6.465 1.26e-10 ***
## Sale_ConditionPartial 2.292 0.022030 *
## Longitude -0.083 0.933897
## Latitude 0.569 0.569283
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.1104 on 2079 degrees of freedom
## Multiple R-squared: 0.934, Adjusted R-squared: 0.9256
## F-statistic: 111.5 on 264 and 2079 DF, p-value: < 2.2e-16
# Memeriksa koefisien yang teralias
alias_ols <- alias(model_ols)
# Menampilkan hasil alias
alias_ols$Complete
## (Intercept) MS_SubClassOne_Story_1945_and_Older
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## MS_SubClassOne_Story_with_Finished_Attic_All_Ages
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## MS_SubClassOne_and_Half_Story_Unfinished_All_Ages
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## MS_SubClassOne_and_Half_Story_Finished_All_Ages
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## MS_SubClassTwo_Story_1946_and_Newer
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## MS_SubClassTwo_Story_1945_and_Older
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## MS_SubClassTwo_and_Half_Story_All_Ages
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## MS_SubClassSplit_or_Multilevel MS_SubClassSplit_Foyer
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## MS_SubClassDuplex_All_Styles_and_Ages
## Bldg_TypeDuplex 1
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## MS_SubClassOne_Story_PUD_1946_and_Newer
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## MS_SubClassOne_and_Half_Story_PUD_All_Ages
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## MS_SubClassTwo_Story_PUD_1946_and_Newer
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## MS_SubClassPUD_Multilevel_Split_Level_Foyer
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## MS_SubClassTwo_Family_conversion_All_Styles_and_Ages
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## MS_ZoningResidential_High_Density
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## MS_ZoningResidential_Low_Density
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## MS_ZoningResidential_Medium_Density MS_ZoningA_agr
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## MS_ZoningC_all MS_ZoningI_all Lot_Frontage Lot_Area
## Bldg_TypeDuplex 0 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0 0
## Garage_CondNo_Garage 0 0 0 0
## Misc_FeatureTenC 0 0 0 0
## StreetPave AlleyNo_Alley_Access AlleyPaved
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Lot_ShapeSlightly_Irregular
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## Lot_ShapeModerately_Irregular Lot_ShapeIrregular
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Land_ContourHLS Land_ContourLow Land_ContourLvl
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## UtilitiesNoSeWa Lot_ConfigCulDSac Lot_ConfigFR2
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Lot_ConfigFR3 Lot_ConfigInside Land_SlopeMod
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Land_SlopeSev NeighborhoodCollege_Creek
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## NeighborhoodOld_Town NeighborhoodEdwards
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## NeighborhoodSomerset NeighborhoodNorthridge_Heights
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## NeighborhoodGilbert NeighborhoodSawyer
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## NeighborhoodNorthwest_Ames NeighborhoodSawyer_West
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## NeighborhoodMitchell NeighborhoodBrookside
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## NeighborhoodCrawford
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## NeighborhoodIowa_DOT_and_Rail_Road
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## NeighborhoodTimberland NeighborhoodNorthridge
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## NeighborhoodStone_Brook
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## NeighborhoodSouth_and_West_of_Iowa_State_University
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## NeighborhoodClear_Creek NeighborhoodMeadow_Village
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## NeighborhoodBriardale NeighborhoodBloomington_Heights
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## NeighborhoodVeenker NeighborhoodNorthpark_Villa
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## NeighborhoodBlueste NeighborhoodGreens
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## NeighborhoodGreen_Hills Condition_1Feedr
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Condition_1Norm Condition_1PosA Condition_1PosN
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Condition_1RRAe Condition_1RRAn Condition_1RRNe
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Condition_1RRNn Condition_2Feedr Condition_2Norm
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Condition_2PosA Condition_2PosN Condition_2RRAe
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Condition_2RRAn Condition_2RRNn Bldg_TypeTwoFmCon
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Bldg_TypeTwnhs Bldg_TypeTwnhsE
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## House_StyleOne_and_Half_Unf House_StyleOne_Story
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## House_StyleSFoyer House_StyleSLvl
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## House_StyleTwo_and_Half_Fin
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
## House_StyleTwo_and_Half_Unf House_StyleTwo_Story
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Overall_CondPoor Overall_CondFair
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Overall_CondBelow_Average Overall_CondAverage
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Overall_CondAbove_Average Overall_CondGood
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Overall_CondVery_Good Overall_CondExcellent
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Year_Built Year_Remod_Add Roof_StyleGable
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Roof_StyleGambrel Roof_StyleHip Roof_StyleMansard
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Roof_StyleShed Roof_MatlCompShg Roof_MatlMembran
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Roof_MatlMetal Roof_MatlRoll Roof_MatlTar&Grv
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Roof_MatlWdShake Roof_MatlWdShngl Exterior_1stAsphShn
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Exterior_1stBrkComm Exterior_1stBrkFace
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Exterior_1stCBlock Exterior_1stCemntBd
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Exterior_1stHdBoard Exterior_1stImStucc
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Exterior_1stMetalSd Exterior_1stPlywood
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Exterior_1stStone Exterior_1stStucco
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Exterior_1stVinylSd Exterior_1stWd Sdng
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Exterior_1stWdShing Exterior_2ndAsphShn
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Exterior_2ndBrk Cmn Exterior_2ndBrkFace
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Exterior_2ndCBlock Exterior_2ndCmentBd
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Exterior_2ndHdBoard Exterior_2ndImStucc
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Exterior_2ndMetalSd Exterior_2ndPlywood
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Exterior_2ndStone Exterior_2ndStucco
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Exterior_2ndVinylSd Exterior_2ndWd Sdng
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Exterior_2ndWd Shng Mas_Vnr_TypeBrkFace
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Mas_Vnr_TypeCBlock Mas_Vnr_TypeNone Mas_Vnr_TypeStone
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Mas_Vnr_Area Exter_CondFair Exter_CondGood
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Exter_CondPoor Exter_CondTypical FoundationCBlock
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## FoundationPConc FoundationSlab FoundationStone
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## FoundationWood Bsmt_CondFair Bsmt_CondGood
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Bsmt_CondNo_Basement Bsmt_CondPoor Bsmt_CondTypical
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 1 0 0
## BsmtFin_Type_2No_Basement 1 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Bsmt_ExposureGd Bsmt_ExposureMn Bsmt_ExposureNo
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Bsmt_ExposureNo_Basement BsmtFin_Type_1BLQ
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## BsmtFin_Type_1GLQ BsmtFin_Type_1LwQ BsmtFin_Type_1Rec
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## BsmtFin_Type_1Unf BsmtFin_SF_1 BsmtFin_Type_2BLQ
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## BsmtFin_Type_2GLQ BsmtFin_Type_2LwQ BsmtFin_Type_2Rec
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## BsmtFin_Type_2Unf BsmtFin_SF_2 Bsmt_Unf_SF
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Total_Bsmt_SF HeatingGasA HeatingGasW HeatingGrav
## Bldg_TypeDuplex 0 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0 0
## Garage_CondNo_Garage 0 0 0 0
## Misc_FeatureTenC 0 0 0 0
## HeatingOthW HeatingWall Heating_QCFair Heating_QCGood
## Bldg_TypeDuplex 0 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0 0
## Garage_CondNo_Garage 0 0 0 0
## Misc_FeatureTenC 0 0 0 0
## Heating_QCPoor Heating_QCTypical Central_AirY
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## ElectricalFuseF ElectricalFuseP ElectricalMix
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## ElectricalSBrkr ElectricalUnknown First_Flr_SF
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Second_Flr_SF Gr_Liv_Area Bsmt_Full_Bath
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Bsmt_Half_Bath Full_Bath Half_Bath Bedroom_AbvGr
## Bldg_TypeDuplex 0 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0 0
## Garage_CondNo_Garage 0 0 0 0
## Misc_FeatureTenC 0 0 0 0
## Kitchen_AbvGr TotRms_AbvGrd FunctionalMaj2
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## FunctionalMin1 FunctionalMin2 FunctionalMod
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## FunctionalSal FunctionalSev FunctionalTyp Fireplaces
## Bldg_TypeDuplex 0 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0 0
## Garage_CondNo_Garage 0 0 0 0
## Misc_FeatureTenC 0 0 0 0
## Garage_TypeBasment Garage_TypeBuiltIn
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Garage_TypeCarPort Garage_TypeDetchd
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Garage_TypeMore_Than_Two_Types Garage_TypeNo_Garage
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Garage_FinishNo_Garage Garage_FinishRFn
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 1 0
## Misc_FeatureTenC 0 0
## Garage_FinishUnf Garage_Cars Garage_Area
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Garage_CondFair Garage_CondGood Garage_CondPoor
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Garage_CondTypical Paved_DrivePartial_Pavement
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Paved_DrivePaved Wood_Deck_SF Open_Porch_SF
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Enclosed_Porch Three_season_porch Screen_Porch
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Pool_Area Pool_QCFair Pool_QCGood Pool_QCNo_Pool
## Bldg_TypeDuplex 0 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0 0
## Garage_CondNo_Garage 0 0 0 0
## Misc_FeatureTenC 0 1 0 0
## Pool_QCTypical FenceGood_Wood FenceMinimum_Privacy
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## FenceMinimum_Wood_Wire FenceNo_Fence Misc_FeatureGar2
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Misc_FeatureNone Misc_FeatureOthr Misc_FeatureShed
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Misc_Val Mo_Sold Year_Sold Sale_TypeCon
## Bldg_TypeDuplex 0 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0 0
## Garage_CondNo_Garage 0 0 0 0
## Misc_FeatureTenC 0 0 0 0
## Sale_TypeConLD Sale_TypeConLI Sale_TypeConLw
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Sale_TypeCWD Sale_TypeNew Sale_TypeOth Sale_TypeVWD
## Bldg_TypeDuplex 0 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0 0
## Garage_CondNo_Garage 0 0 0 0
## Misc_FeatureTenC 0 0 0 0
## Sale_TypeWD Sale_ConditionAdjLand
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Sale_ConditionAlloca Sale_ConditionFamily
## Bldg_TypeDuplex 0 0
## BsmtFin_Type_1No_Basement 0 0
## BsmtFin_Type_2No_Basement 0 0
## Garage_CondNo_Garage 0 0
## Misc_FeatureTenC 0 0
## Sale_ConditionNormal Sale_ConditionPartial Longitude
## Bldg_TypeDuplex 0 0 0
## BsmtFin_Type_1No_Basement 0 0 0
## BsmtFin_Type_2No_Basement 0 0 0
## Garage_CondNo_Garage 0 0 0
## Misc_FeatureTenC 0 0 0
## Latitude
## Bldg_TypeDuplex 0
## BsmtFin_Type_1No_Basement 0
## BsmtFin_Type_2No_Basement 0
## Garage_CondNo_Garage 0
## Misc_FeatureTenC 0
# Melihat koefisien yang bernilai NA
coef(model_ols)[is.na(coef(model_ols))]
## Bldg_TypeDuplex BsmtFin_Type_1No_Basement BsmtFin_Type_2No_Basement
## NA NA NA
## Garage_CondNo_Garage Misc_FeatureTenC
## NA NA
# Variabel yang memiliki koefisien teralias
variabel_alias <- c(
"Bldg_Type",
"BsmtFin_Type_1",
"BsmtFin_Type_2",
"Garage_Cond",
"Misc_Feature"
)
# Mengeluarkan variabel yang menyebabkan alias
prediktor_ols <- setdiff(prediktor, variabel_alias)
# Membentuk formula OLS yang baru
formula_ols <- as.formula(
paste("log_price ~", paste(prediktor_ols, collapse = " + "))
)
# Membentuk ulang model OLS
model_ols <- lm(formula_ols, data = latih)
# Ringkasan model
summary(model_ols)
##
## Call:
## lm(formula = formula_ols, data = latih)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.94350 -0.05344 0.00209 0.05599 0.76903
##
## Coefficients:
## Estimate Std. Error
## (Intercept) -8.727e+00 5.581e+01
## MS_SubClassOne_Story_1945_and_Older -2.557e-02 1.758e-02
## MS_SubClassOne_Story_with_Finished_Attic_All_Ages 4.038e-02 5.579e-02
## MS_SubClassOne_and_Half_Story_Unfinished_All_Ages -1.693e-02 6.575e-02
## MS_SubClassOne_and_Half_Story_Finished_All_Ages 4.489e-02 3.257e-02
## MS_SubClassTwo_Story_1946_and_Newer -5.254e-02 2.875e-02
## MS_SubClassTwo_Story_1945_and_Older 4.279e-02 3.172e-02
## MS_SubClassTwo_and_Half_Story_All_Ages 8.492e-02 5.619e-02
## MS_SubClassSplit_or_Multilevel -4.697e-02 6.087e-02
## MS_SubClassSplit_Foyer -1.323e-02 4.045e-02
## MS_SubClassDuplex_All_Styles_and_Ages -9.046e-02 2.906e-02
## MS_SubClassOne_Story_PUD_1946_and_Newer -4.684e-02 1.532e-02
## MS_SubClassOne_and_Half_Story_PUD_All_Ages -1.849e-01 1.288e-01
## MS_SubClassTwo_Story_PUD_1946_and_Newer -1.994e-01 3.553e-02
## MS_SubClassPUD_Multilevel_Split_Level_Foyer -1.482e-01 5.421e-02
## MS_SubClassTwo_Family_conversion_All_Styles_and_Ages 1.489e-02 2.919e-02
## MS_ZoningResidential_High_Density -4.512e-03 3.730e-02
## MS_ZoningResidential_Low_Density 5.367e-03 2.557e-02
## MS_ZoningResidential_Medium_Density -4.578e-02 2.947e-02
## MS_ZoningA_agr 6.009e-02 2.028e-01
## MS_ZoningC_all -2.464e-01 4.527e-02
## MS_ZoningI_all -6.879e-02 1.584e-01
## Lot_Frontage 1.675e-05 9.161e-05
## Lot_Area 1.914e-06 4.763e-07
## StreetPave 6.745e-02 5.863e-02
## AlleyNo_Alley_Access -7.579e-03 1.581e-02
## AlleyPaved 3.071e-02 2.354e-02
## Lot_ShapeSlightly_Irregular 2.670e-03 6.537e-03
## Lot_ShapeModerately_Irregular 2.783e-02 1.733e-02
## Lot_ShapeIrregular 1.493e-02 3.659e-02
## Land_ContourHLS 6.157e-02 1.971e-02
## Land_ContourLow -1.149e-02 2.710e-02
## Land_ContourLvl 3.899e-02 1.439e-02
## UtilitiesNoSeWa -1.104e-01 1.385e-01
## Lot_ConfigCulDSac -2.459e-03 1.291e-02
## Lot_ConfigFR2 -4.231e-02 1.672e-02
## Lot_ConfigFR3 -3.997e-02 3.624e-02
## Lot_ConfigInside -1.169e-02 7.012e-03
## Land_SlopeMod 1.385e-02 1.595e-02
## Land_SlopeSev -1.081e-01 5.295e-02
## NeighborhoodCollege_Creek 9.215e-02 4.795e-02
## NeighborhoodOld_Town -9.321e-03 2.243e-02
## NeighborhoodEdwards -1.867e-02 3.793e-02
## NeighborhoodSomerset 1.421e-01 2.791e-02
## NeighborhoodNorthridge_Heights 1.772e-01 2.699e-02
## NeighborhoodGilbert 1.706e-04 2.323e-02
## NeighborhoodSawyer 4.479e-02 3.460e-02
## NeighborhoodNorthwest_Ames 6.494e-03 1.711e-02
## NeighborhoodSawyer_West 5.564e-02 4.256e-02
## NeighborhoodMitchell 6.054e-02 4.392e-02
## NeighborhoodBrookside 6.011e-02 2.304e-02
## NeighborhoodCrawford 1.645e-01 3.355e-02
## NeighborhoodIowa_DOT_and_Rail_Road 4.391e-02 3.091e-02
## NeighborhoodTimberland 1.276e-01 5.002e-02
## NeighborhoodNorthridge 1.273e-01 2.814e-02
## NeighborhoodStone_Brook 2.233e-01 2.875e-02
## NeighborhoodSouth_and_West_of_Iowa_State_University 6.701e-02 3.931e-02
## NeighborhoodClear_Creek 1.133e-01 4.289e-02
## NeighborhoodMeadow_Village -3.416e-02 5.248e-02
## NeighborhoodBriardale 7.520e-02 3.784e-02
## NeighborhoodBloomington_Heights -8.134e-03 3.654e-02
## NeighborhoodVeenker 6.748e-02 3.650e-02
## NeighborhoodNorthpark_Villa 8.605e-02 5.207e-02
## NeighborhoodBlueste 2.209e-01 6.272e-02
## NeighborhoodGreens 2.339e-01 5.664e-02
## NeighborhoodGreen_Hills 6.521e-01 9.497e-02
## Condition_1Feedr -3.119e-03 1.975e-02
## Condition_1Norm 5.099e-02 1.649e-02
## Condition_1PosA 6.996e-02 3.484e-02
## Condition_1PosN 6.086e-02 2.866e-02
## Condition_1RRAe -2.196e-02 3.166e-02
## Condition_1RRAn 1.890e-02 2.705e-02
## Condition_1RRNe -2.704e-03 5.671e-02
## Condition_1RRNn 6.703e-02 5.365e-02
## Condition_2Feedr 6.149e-02 7.537e-02
## Condition_2Norm 1.452e-01 6.649e-02
## Condition_2PosA 3.678e-01 9.885e-02
## Condition_2PosN -2.889e-01 9.923e-02
## Condition_2RRAe 1.958e-01 2.097e-01
## Condition_2RRAn 1.091e-01 1.375e-01
## Condition_2RRNn 2.708e-02 1.364e-01
## House_StyleOne_and_Half_Unf 9.424e-02 6.230e-02
## House_StyleOne_Story 5.918e-03 3.301e-02
## House_StyleSFoyer 3.695e-02 4.416e-02
## House_StyleSLvl 5.211e-02 6.258e-02
## House_StyleTwo_and_Half_Fin -3.563e-02 6.929e-02
## House_StyleTwo_and_Half_Unf 3.254e-02 5.505e-02
## House_StyleTwo_Story 4.613e-02 2.886e-02
## Overall_CondPoor 3.107e-02 9.230e-02
## Overall_CondFair -9.955e-03 7.077e-02
## Overall_CondBelow_Average 1.038e-01 7.034e-02
## Overall_CondAverage 1.776e-01 6.986e-02
## Overall_CondAbove_Average 2.093e-01 7.000e-02
## Overall_CondGood 2.509e-01 7.017e-02
## Overall_CondVery_Good 2.853e-01 7.072e-02
## Overall_CondExcellent 3.586e-01 7.374e-02
## Year_Built 2.558e-03 3.025e-04
## Year_Remod_Add 1.046e-03 2.103e-04
## Roof_StyleGable 1.608e-01 6.101e-02
## Roof_StyleGambrel 1.184e-01 6.820e-02
## Roof_StyleHip 1.814e-01 6.147e-02
## Roof_StyleMansard 1.319e-01 7.553e-02
## Roof_StyleShed 4.950e-01 1.595e-01
## Roof_MatlCompShg 2.595e+00 2.041e-01
## Roof_MatlMembran 3.084e+00 2.507e-01
## Roof_MatlMetal 2.934e+00 2.514e-01
## Roof_MatlRoll 2.680e+00 2.364e-01
## Roof_MatlTar&Grv 2.762e+00 2.103e-01
## Roof_MatlWdShake 2.553e+00 2.104e-01
## Roof_MatlWdShngl 2.770e+00 2.082e-01
## Exterior_1stAsphShn 3.532e-02 1.328e-01
## Exterior_1stBrkComm 7.704e-02 8.142e-02
## Exterior_1stBrkFace 1.345e-01 5.242e-02
## Exterior_1stCBlock -1.188e-01 1.603e-01
## Exterior_1stCemntBd -4.006e-02 7.776e-02
## Exterior_1stHdBoard 3.471e-02 5.166e-02
## Exterior_1stImStucc 6.522e-02 1.322e-01
## Exterior_1stMetalSd 7.595e-02 5.631e-02
## Exterior_1stPlywood 4.254e-02 5.078e-02
## Exterior_1stStone 8.989e-02 1.100e-01
## Exterior_1stStucco 6.587e-02 5.589e-02
## Exterior_1stVinylSd 2.658e-02 5.455e-02
## Exterior_1stWd Sdng 3.347e-02 5.010e-02
## Exterior_1stWdShing 3.716e-02 5.323e-02
## Exterior_2ndAsphShn 6.191e-02 1.019e-01
## Exterior_2ndBrk Cmn -1.508e-03 7.325e-02
## Exterior_2ndBrkFace -3.449e-02 5.534e-02
## Exterior_2ndCBlock 2.046e-02 1.071e-01
## Exterior_2ndCmentBd 9.891e-02 7.828e-02
## Exterior_2ndHdBoard -2.471e-03 5.159e-02
## Exterior_2ndImStucc -1.529e-02 6.018e-02
## Exterior_2ndMetalSd -1.508e-02 5.624e-02
## Exterior_2ndPlywood -1.079e-02 4.990e-02
## Exterior_2ndStone -3.251e-02 8.677e-02
## Exterior_2ndStucco 1.777e-02 5.589e-02
## Exterior_2ndVinylSd 1.930e-02 5.424e-02
## Exterior_2ndWd Sdng 2.550e-02 5.027e-02
## Exterior_2ndWd Shng 3.645e-02 5.239e-02
## Mas_Vnr_TypeBrkFace 4.174e-02 2.861e-02
## Mas_Vnr_TypeCBlock -6.453e-01 1.954e-01
## Mas_Vnr_TypeNone 2.360e-02 2.844e-02
## Mas_Vnr_TypeStone 4.834e-02 2.988e-02
## Mas_Vnr_Area -4.923e-06 2.259e-05
## Exter_CondFair -4.702e-02 4.399e-02
## Exter_CondGood -2.473e-02 3.949e-02
## Exter_CondPoor -1.122e-01 1.145e-01
## Exter_CondTypical -3.418e-03 3.940e-02
## FoundationCBlock 3.233e-03 1.203e-02
## FoundationPConc 2.762e-02 1.321e-02
## FoundationSlab 6.612e-03 3.696e-02
## FoundationStone 9.582e-02 4.236e-02
## FoundationWood -3.058e-02 8.639e-02
## Bsmt_CondFair -2.322e-02 7.268e-02
## Bsmt_CondGood 7.255e-03 7.199e-02
## Bsmt_CondNo_Basement -1.063e-02 1.042e-01
## Bsmt_CondPoor -4.016e-03 9.681e-02
## Bsmt_CondTypical -1.138e-02 7.102e-02
## Bsmt_ExposureGd 4.012e-02 1.163e-02
## Bsmt_ExposureMn -2.558e-02 1.174e-02
## Bsmt_ExposureNo -2.925e-02 8.865e-03
## Bsmt_ExposureNo_Basement -6.907e-02 6.802e-02
## BsmtFin_SF_1 -2.380e-03 1.579e-03
## BsmtFin_SF_2 -3.062e-05 1.660e-05
## Bsmt_Unf_SF -5.165e-05 1.058e-05
## Total_Bsmt_SF 1.168e-04 1.805e-05
## HeatingGasA 2.009e-01 1.224e-01
## HeatingGasW 2.840e-01 1.250e-01
## HeatingGrav 8.377e-02 1.309e-01
## HeatingOthW 1.923e-01 1.514e-01
## HeatingWall 2.559e-01 1.410e-01
## Heating_QCFair -4.487e-02 1.761e-02
## Heating_QCGood -1.884e-02 7.996e-03
## Heating_QCPoor -1.419e+00 3.084e-01
## Heating_QCTypical -3.871e-02 7.711e-03
## Central_AirY 3.672e-02 1.370e-02
## ElectricalFuseF -2.554e-02 2.262e-02
## ElectricalFuseP -6.818e-03 5.516e-02
## ElectricalMix 1.664e-01 1.598e-01
## ElectricalSBrkr -5.365e-03 1.156e-02
## ElectricalUnknown -1.660e-02 1.191e-01
## First_Flr_SF 9.983e-05 6.438e-05
## Second_Flr_SF 6.332e-05 6.122e-05
## Gr_Liv_Area 1.807e-04 6.309e-05
## Bsmt_Full_Bath 2.458e-02 7.347e-03
## Bsmt_Half_Bath -9.718e-03 1.111e-02
## Full_Bath 2.899e-02 8.296e-03
## Half_Bath 2.477e-02 7.985e-03
## Bedroom_AbvGr -1.032e-03 5.218e-03
## Kitchen_AbvGr -3.761e-02 2.466e-02
## TotRms_AbvGrd 5.097e-03 3.572e-03
## FunctionalMaj2 -2.155e-01 6.148e-02
## FunctionalMin1 2.163e-03 3.779e-02
## FunctionalMin2 -2.813e-03 3.739e-02
## FunctionalMod -2.052e-03 4.160e-02
## FunctionalSal -3.787e-01 1.415e-01
## FunctionalSev -1.987e-01 1.388e-01
## FunctionalTyp 5.587e-02 3.360e-02
## Fireplaces 3.687e-02 5.202e-03
## Garage_TypeBasment -3.139e-02 2.703e-02
## Garage_TypeBuiltIn -1.856e-02 1.281e-02
## Garage_TypeCarPort -7.161e-02 4.756e-02
## Garage_TypeDetchd -2.828e-02 9.110e-03
## Garage_TypeMore_Than_Two_Types -6.496e-02 3.234e-02
## Garage_TypeNo_Garage -1.123e-01 9.254e-02
## Garage_FinishNo_Garage 6.197e-02 9.167e-02
## Garage_FinishRFn -1.644e-02 7.682e-03
## Garage_FinishUnf -1.038e-02 9.177e-03
## Garage_Cars 2.855e-02 8.874e-03
## Garage_Area 7.834e-05 2.996e-05
## Paved_DrivePartial_Pavement 1.222e-02 2.031e-02
## Paved_DrivePaved 2.558e-02 1.309e-02
## Wood_Deck_SF 5.542e-05 2.266e-05
## Open_Porch_SF 3.636e-05 4.317e-05
## Enclosed_Porch 1.353e-04 4.554e-05
## Three_season_porch 1.643e-04 1.000e-04
## Screen_Porch 2.411e-04 4.722e-05
## Pool_Area -5.825e-04 5.749e-04
## Pool_QCFair -1.322e-02 1.851e-01
## Pool_QCGood 2.835e-01 1.901e-01
## Pool_QCNo_Pool -2.707e-01 3.232e-01
## Pool_QCTypical -4.278e-03 1.584e-01
## FenceGood_Wood -1.588e-02 1.852e-02
## FenceMinimum_Privacy -9.533e-03 1.509e-02
## FenceMinimum_Wood_Wire -1.790e-02 3.875e-02
## FenceNo_Fence -7.874e-03 1.354e-02
## Misc_Val -5.398e-05 5.186e-06
## Mo_Sold -1.783e-04 9.512e-04
## Year_Sold -2.172e-03 2.012e-03
## Sale_TypeCon 1.489e-01 6.398e-02
## Sale_TypeConLD -1.241e-02 3.248e-02
## Sale_TypeConLI 5.129e-03 4.498e-02
## Sale_TypeConLw -1.558e-02 4.841e-02
## Sale_TypeCWD 3.086e-02 4.251e-02
## Sale_TypeNew -3.284e-02 6.591e-02
## Sale_TypeOth -2.535e-02 5.039e-02
## Sale_TypeVWD -4.184e-02 1.202e-01
## Sale_TypeWD 7.691e-03 1.614e-02
## Sale_ConditionAdjLand 2.576e-01 4.205e-02
## Sale_ConditionAlloca 8.841e-02 3.571e-02
## Sale_ConditionFamily 2.827e-02 2.316e-02
## Sale_ConditionNormal 7.385e-02 1.174e-02
## Sale_ConditionPartial 1.481e-01 6.431e-02
## Longitude 3.728e-01 5.606e-01
## Latitude 1.161e+00 8.112e-01
## t value Pr(>|t|)
## (Intercept) -0.156 0.875753
## MS_SubClassOne_Story_1945_and_Older -1.454 0.146081
## MS_SubClassOne_Story_with_Finished_Attic_All_Ages 0.724 0.469342
## MS_SubClassOne_and_Half_Story_Unfinished_All_Ages -0.257 0.796822
## MS_SubClassOne_and_Half_Story_Finished_All_Ages 1.378 0.168232
## MS_SubClassTwo_Story_1946_and_Newer -1.827 0.067794 .
## MS_SubClassTwo_Story_1945_and_Older 1.349 0.177461
## MS_SubClassTwo_and_Half_Story_All_Ages 1.511 0.130864
## MS_SubClassSplit_or_Multilevel -0.772 0.440359
## MS_SubClassSplit_Foyer -0.327 0.743598
## MS_SubClassDuplex_All_Styles_and_Ages -3.113 0.001876 **
## MS_SubClassOne_Story_PUD_1946_and_Newer -3.057 0.002264 **
## MS_SubClassOne_and_Half_Story_PUD_All_Ages -1.435 0.151346
## MS_SubClassTwo_Story_PUD_1946_and_Newer -5.612 2.26e-08 ***
## MS_SubClassPUD_Multilevel_Split_Level_Foyer -2.734 0.006301 **
## MS_SubClassTwo_Family_conversion_All_Styles_and_Ages 0.510 0.609949
## MS_ZoningResidential_High_Density -0.121 0.903731
## MS_ZoningResidential_Low_Density 0.210 0.833763
## MS_ZoningResidential_Medium_Density -1.553 0.120475
## MS_ZoningA_agr 0.296 0.766996
## MS_ZoningC_all -5.442 5.87e-08 ***
## MS_ZoningI_all -0.434 0.664165
## Lot_Frontage 0.183 0.854923
## Lot_Area 4.019 6.05e-05 ***
## StreetPave 1.150 0.250112
## AlleyNo_Alley_Access -0.479 0.631690
## AlleyPaved 1.305 0.192204
## Lot_ShapeSlightly_Irregular 0.408 0.682962
## Lot_ShapeModerately_Irregular 1.606 0.108530
## Lot_ShapeIrregular 0.408 0.683256
## Land_ContourHLS 3.123 0.001812 **
## Land_ContourLow -0.424 0.671775
## Land_ContourLvl 2.710 0.006782 **
## UtilitiesNoSeWa -0.797 0.425382
## Lot_ConfigCulDSac -0.190 0.848985
## Lot_ConfigFR2 -2.530 0.011486 *
## Lot_ConfigFR3 -1.103 0.270092
## Lot_ConfigInside -1.668 0.095497 .
## Land_SlopeMod 0.868 0.385338
## Land_SlopeSev -2.041 0.041332 *
## NeighborhoodCollege_Creek 1.922 0.054782 .
## NeighborhoodOld_Town -0.415 0.677840
## NeighborhoodEdwards -0.492 0.622584
## NeighborhoodSomerset 5.092 3.86e-07 ***
## NeighborhoodNorthridge_Heights 6.566 6.49e-11 ***
## NeighborhoodGilbert 0.007 0.994143
## NeighborhoodSawyer 1.295 0.195577
## NeighborhoodNorthwest_Ames 0.380 0.704263
## NeighborhoodSawyer_West 1.307 0.191244
## NeighborhoodMitchell 1.378 0.168197
## NeighborhoodBrookside 2.609 0.009152 **
## NeighborhoodCrawford 4.904 1.01e-06 ***
## NeighborhoodIowa_DOT_and_Rail_Road 1.420 0.155626
## NeighborhoodTimberland 2.551 0.010823 *
## NeighborhoodNorthridge 4.523 6.44e-06 ***
## NeighborhoodStone_Brook 7.767 1.25e-14 ***
## NeighborhoodSouth_and_West_of_Iowa_State_University 1.704 0.088458 .
## NeighborhoodClear_Creek 2.643 0.008282 **
## NeighborhoodMeadow_Village -0.651 0.515148
## NeighborhoodBriardale 1.987 0.047017 *
## NeighborhoodBloomington_Heights -0.223 0.823869
## NeighborhoodVeenker 1.849 0.064627 .
## NeighborhoodNorthpark_Villa 1.652 0.098587 .
## NeighborhoodBlueste 3.522 0.000438 ***
## NeighborhoodGreens 4.129 3.79e-05 ***
## NeighborhoodGreen_Hills 6.867 8.62e-12 ***
## Condition_1Feedr -0.158 0.874521
## Condition_1Norm 3.092 0.002013 **
## Condition_1PosA 2.008 0.044787 *
## Condition_1PosN 2.123 0.033850 *
## Condition_1RRAe -0.694 0.488003
## Condition_1RRAn 0.699 0.484838
## Condition_1RRNe -0.048 0.961980
## Condition_1RRNn 1.250 0.211616
## Condition_2Feedr 0.816 0.414741
## Condition_2Norm 2.183 0.029124 *
## Condition_2PosA 3.721 0.000203 ***
## Condition_2PosN -2.912 0.003632 **
## Condition_2RRAe 0.934 0.350642
## Condition_2RRAn 0.793 0.427810
## Condition_2RRNn 0.198 0.842691
## House_StyleOne_and_Half_Unf 1.513 0.130526
## House_StyleOne_Story 0.179 0.857753
## House_StyleSFoyer 0.837 0.402820
## House_StyleSLvl 0.833 0.405150
## House_StyleTwo_and_Half_Fin -0.514 0.607110
## House_StyleTwo_and_Half_Unf 0.591 0.554492
## House_StyleTwo_Story 1.598 0.110112
## Overall_CondPoor 0.337 0.736469
## Overall_CondFair -0.141 0.888149
## Overall_CondBelow_Average 1.476 0.140206
## Overall_CondAverage 2.542 0.011092 *
## Overall_CondAbove_Average 2.991 0.002816 **
## Overall_CondGood 3.576 0.000357 ***
## Overall_CondVery_Good 4.034 5.67e-05 ***
## Overall_CondExcellent 4.863 1.24e-06 ***
## Year_Built 8.458 < 2e-16 ***
## Year_Remod_Add 4.975 7.05e-07 ***
## Roof_StyleGable 2.636 0.008454 **
## Roof_StyleGambrel 1.736 0.082718 .
## Roof_StyleHip 2.950 0.003211 **
## Roof_StyleMansard 1.746 0.080928 .
## Roof_StyleShed 3.103 0.001941 **
## Roof_MatlCompShg 12.716 < 2e-16 ***
## Roof_MatlMembran 12.300 < 2e-16 ***
## Roof_MatlMetal 11.667 < 2e-16 ***
## Roof_MatlRoll 11.338 < 2e-16 ***
## Roof_MatlTar&Grv 13.133 < 2e-16 ***
## Roof_MatlWdShake 12.132 < 2e-16 ***
## Roof_MatlWdShngl 13.305 < 2e-16 ***
## Exterior_1stAsphShn 0.266 0.790362
## Exterior_1stBrkComm 0.946 0.344143
## Exterior_1stBrkFace 2.566 0.010369 *
## Exterior_1stCBlock -0.741 0.458642
## Exterior_1stCemntBd -0.515 0.606500
## Exterior_1stHdBoard 0.672 0.501713
## Exterior_1stImStucc 0.493 0.621953
## Exterior_1stMetalSd 1.349 0.177550
## Exterior_1stPlywood 0.838 0.402308
## Exterior_1stStone 0.817 0.413826
## Exterior_1stStucco 1.179 0.238728
## Exterior_1stVinylSd 0.487 0.626124
## Exterior_1stWd Sdng 0.668 0.504266
## Exterior_1stWdShing 0.698 0.485240
## Exterior_2ndAsphShn 0.607 0.543656
## Exterior_2ndBrk Cmn -0.021 0.983577
## Exterior_2ndBrkFace -0.623 0.533196
## Exterior_2ndCBlock 0.191 0.848476
## Exterior_2ndCmentBd 1.263 0.206566
## Exterior_2ndHdBoard -0.048 0.961797
## Exterior_2ndImStucc -0.254 0.799412
## Exterior_2ndMetalSd -0.268 0.788575
## Exterior_2ndPlywood -0.216 0.828757
## Exterior_2ndStone -0.375 0.707971
## Exterior_2ndStucco 0.318 0.750595
## Exterior_2ndVinylSd 0.356 0.721969
## Exterior_2ndWd Sdng 0.507 0.611970
## Exterior_2ndWd Shng 0.696 0.486678
## Mas_Vnr_TypeBrkFace 1.459 0.144798
## Mas_Vnr_TypeCBlock -3.302 0.000976 ***
## Mas_Vnr_TypeNone 0.830 0.406778
## Mas_Vnr_TypeStone 1.618 0.105917
## Mas_Vnr_Area -0.218 0.827556
## Exter_CondFair -1.069 0.285258
## Exter_CondGood -0.626 0.531277
## Exter_CondPoor -0.980 0.327033
## Exter_CondTypical -0.087 0.930877
## FoundationCBlock 0.269 0.788207
## FoundationPConc 2.091 0.036611 *
## FoundationSlab 0.179 0.858027
## FoundationStone 2.262 0.023783 *
## FoundationWood -0.354 0.723351
## Bsmt_CondFair -0.320 0.749376
## Bsmt_CondGood 0.101 0.919737
## Bsmt_CondNo_Basement -0.102 0.918758
## Bsmt_CondPoor -0.041 0.966916
## Bsmt_CondTypical -0.160 0.872736
## Bsmt_ExposureGd 3.448 0.000575 ***
## Bsmt_ExposureMn -2.179 0.029418 *
## Bsmt_ExposureNo -3.299 0.000986 ***
## Bsmt_ExposureNo_Basement -1.015 0.310019
## BsmtFin_SF_1 -1.508 0.131803
## BsmtFin_SF_2 -1.844 0.065302 .
## Bsmt_Unf_SF -4.880 1.14e-06 ***
## Total_Bsmt_SF 6.471 1.20e-10 ***
## HeatingGasA 1.641 0.100937
## HeatingGasW 2.272 0.023158 *
## HeatingGrav 0.640 0.522416
## HeatingOthW 1.270 0.204314
## HeatingWall 1.815 0.069709 .
## Heating_QCFair -2.548 0.010889 *
## Heating_QCGood -2.356 0.018557 *
## Heating_QCPoor -4.602 4.43e-06 ***
## Heating_QCTypical -5.020 5.60e-07 ***
## Central_AirY 2.680 0.007424 **
## ElectricalFuseF -1.129 0.258950
## ElectricalFuseP -0.124 0.901640
## ElectricalMix 1.041 0.297815
## ElectricalSBrkr -0.464 0.642707
## ElectricalUnknown -0.139 0.889165
## First_Flr_SF 1.551 0.121125
## Second_Flr_SF 1.034 0.301075
## Gr_Liv_Area 2.865 0.004218 **
## Bsmt_Full_Bath 3.345 0.000838 ***
## Bsmt_Half_Bath -0.874 0.381976
## Full_Bath 3.494 0.000485 ***
## Half_Bath 3.103 0.001943 **
## Bedroom_AbvGr -0.198 0.843187
## Kitchen_AbvGr -1.525 0.127496
## TotRms_AbvGrd 1.427 0.153696
## FunctionalMaj2 -3.505 0.000467 ***
## FunctionalMin1 0.057 0.954365
## FunctionalMin2 -0.075 0.940047
## FunctionalMod -0.049 0.960670
## FunctionalSal -2.677 0.007487 **
## FunctionalSev -1.431 0.152538
## FunctionalTyp 1.663 0.096523 .
## Fireplaces 7.088 1.85e-12 ***
## Garage_TypeBasment -1.161 0.245613
## Garage_TypeBuiltIn -1.449 0.147511
## Garage_TypeCarPort -1.506 0.132264
## Garage_TypeDetchd -3.104 0.001933 **
## Garage_TypeMore_Than_Two_Types -2.009 0.044689 *
## Garage_TypeNo_Garage -1.213 0.225081
## Garage_FinishNo_Garage 0.676 0.499134
## Garage_FinishRFn -2.140 0.032447 *
## Garage_FinishUnf -1.131 0.258327
## Garage_Cars 3.217 0.001315 **
## Garage_Area 2.615 0.008990 **
## Paved_DrivePartial_Pavement 0.602 0.547565
## Paved_DrivePaved 1.955 0.050702 .
## Wood_Deck_SF 2.445 0.014557 *
## Open_Porch_SF 0.842 0.399669
## Enclosed_Porch 2.970 0.003007 **
## Three_season_porch 1.643 0.100507
## Screen_Porch 5.105 3.60e-07 ***
## Pool_Area -1.013 0.311125
## Pool_QCFair -0.071 0.943054
## Pool_QCGood 1.491 0.136099
## Pool_QCNo_Pool -0.837 0.402445
## Pool_QCTypical -0.027 0.978457
## FenceGood_Wood -0.857 0.391391
## FenceMinimum_Privacy -0.632 0.527538
## FenceMinimum_Wood_Wire -0.462 0.644145
## FenceNo_Fence -0.582 0.560915
## Misc_Val -10.408 < 2e-16 ***
## Mo_Sold -0.187 0.851308
## Year_Sold -1.079 0.280508
## Sale_TypeCon 2.328 0.020029 *
## Sale_TypeConLD -0.382 0.702462
## Sale_TypeConLI 0.114 0.909215
## Sale_TypeConLw -0.322 0.747702
## Sale_TypeCWD 0.726 0.467987
## Sale_TypeNew -0.498 0.618350
## Sale_TypeOth -0.503 0.614971
## Sale_TypeVWD -0.348 0.727815
## Sale_TypeWD 0.476 0.633809
## Sale_ConditionAdjLand 6.126 1.07e-09 ***
## Sale_ConditionAlloca 2.476 0.013359 *
## Sale_ConditionFamily 1.221 0.222275
## Sale_ConditionNormal 6.289 3.87e-10 ***
## Sale_ConditionPartial 2.303 0.021378 *
## Longitude 0.665 0.506121
## Latitude 1.431 0.152541
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.1153 on 2100 degrees of freedom
## Multiple R-squared: 0.9272, Adjusted R-squared: 0.9188
## F-statistic: 110.1 on 243 and 2100 DF, p-value: < 2.2e-16
# Memeriksa apakah masih terdapat koefisien teralias
alias(model_ols)$Complete
## NULL
# Memeriksa koefisien NA
coef(model_ols)[is.na(coef(model_ols))]
## named numeric(0)
library(car)
## Warning: package 'car' was built under R version 4.5.3
## Loading required package: carData
## Warning: package 'carData' was built under R version 4.5.3
##
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
##
## recode
library(dplyr)
# Menghitung VIF
vif_ols <- vif(model_ols)
# Menampilkan hasil VIF
vif_ols
## GVIF Df GVIF^(1/(2*Df))
## MS_SubClass 2.720676e+08 15 1.910539
## MS_Zoning 6.404795e+02 6 1.713466
## Lot_Frontage 1.666345e+00 1 1.290870
## Lot_Area 2.753497e+00 1 1.659367
## Street 1.290073e+00 1 1.135814
## Alley 2.763700e+00 2 1.289356
## Lot_Shape 2.533686e+00 3 1.167595
## Land_Contour 4.642591e+00 3 1.291596
## Utilities 1.442356e+00 1 1.200981
## Lot_Config 2.424120e+00 4 1.117041
## Land_Slope 4.705334e+00 2 1.472813
## Neighborhood 4.723989e+08 26 1.468296
## Condition_1 6.163518e+00 8 1.120377
## Condition_2 9.394635e+00 7 1.173523
## House_Style 1.578287e+06 7 2.771581
## Overall_Cond 4.283401e+01 8 1.264698
## Year_Built 1.462878e+01 1 3.824759
## Year_Remod_Add 3.342543e+00 1 1.828262
## Roof_Style 5.983196e+01 5 1.505544
## Roof_Matl 4.085685e+01 7 1.303438
## Exterior_1st 6.951955e+08 14 2.069138
## Exterior_2nd 8.575994e+08 14 2.084711
## Mas_Vnr_Type 1.319717e+01 4 1.380575
## Mas_Vnr_Area 2.901133e+00 1 1.703271
## Exter_Cond 7.240848e+00 4 1.280777
## Foundation 3.683683e+01 5 1.434261
## Bsmt_Cond 7.206269e+01 5 1.533808
## Bsmt_Exposure 7.019224e+01 4 1.701320
## BsmtFin_SF_1 2.195986e+00 1 1.481886
## BsmtFin_SF_2 1.425475e+00 1 1.193933
## Bsmt_Unf_SF 3.789001e+00 1 1.946536
## Total_Bsmt_SF 1.119645e+01 1 3.346110
## Heating 4.929626e+00 5 1.172955
## Heating_QC 2.618623e+01 4 1.504039
## Central_Air 2.153743e+00 1 1.467564
## Electrical 5.077232e+00 5 1.176421
## First_Flr_SF 1.141876e+02 1 10.685859
## Second_Flr_SF 1.222426e+02 1 11.056339
## Gr_Liv_Area 1.871338e+02 1 13.679687
## Bsmt_Full_Bath 2.572451e+00 1 1.603886
## Bsmt_Half_Bath 1.402751e+00 1 1.184378
## Full_Bath 3.694545e+00 1 1.922120
## Half_Bath 2.835440e+00 1 1.683876
## Bedroom_AbvGr 3.275455e+00 1 1.809822
## Kitchen_AbvGr 5.046407e+00 1 2.246421
## TotRms_AbvGrd 5.711723e+00 1 2.389921
## Functional 1.776126e+01 7 1.228141
## Fireplaces 2.000994e+00 1 1.414565
## Garage_Type 8.471334e+02 6 1.753864
## Garage_Finish 2.590165e+02 3 2.524767
## Garage_Cars 8.073414e+00 1 2.841375
## Garage_Area 7.260293e+00 1 2.694493
## Paved_Drive 2.462082e+00 2 1.252638
## Wood_Deck_SF 1.458498e+00 1 1.207683
## Open_Porch_SF 1.533965e+00 1 1.238534
## Enclosed_Porch 1.531545e+00 1 1.237556
## Three_season_porch 1.147984e+00 1 1.071440
## Screen_Porch 1.252078e+00 1 1.118963
## Pool_Area 7.246768e+01 1 8.512795
## Pool_QC 1.654693e+02 4 1.893824
## Fence 1.978239e+00 4 1.089017
## Misc_Val 1.326132e+00 1 1.151578
## Mo_Sold 1.166455e+00 1 1.080025
## Year_Sold 1.232068e+00 1 1.109985
## Sale_Type 1.338963e+02 9 1.312665
## Sale_Condition 1.794622e+02 5 1.680341
## Longitude 3.689661e+01 1 6.074258
## Latitude 3.901511e+01 1 6.246208
# 5. Pemodelan Generalized Additive Model (GAM)
library(mgcv)
## Warning: package 'mgcv' was built under R version 4.5.3
## Loading required package: nlme
##
## Attaching package: 'nlme'
## The following object is masked from 'package:dplyr':
##
## collapse
## This is mgcv 1.9-4. For overview type '?mgcv'.
# Memisahkan prediktor numerik dan kategorik
num_gam <- prediktor_ols[
sapply(latih[prediktor_ols], is.numeric)
]
factor_gam <- prediktor_ols[
!sapply(latih[prediktor_ols], is.numeric)
]
# Mengeluarkan variabel bulan dan koordinat dari spline biasa
num_smooth <- setdiff(
num_gam,
c("Mo_Sold", "Longitude", "Latitude")
)
# Menentukan nilai k berdasarkan jumlah nilai unik (k dinaikkan untuk Gr_Liv_Area)
smooth_terms <- sapply(num_smooth, function(v) {
k_var <- ifelse(
v == "Gr_Liv_Area",
15,
min(10, length(unique(latih[[v]])) - 1)
)
paste0("s(", v, ", bs = 'cr', k = ", k_var, ")")
})
# Spline siklik untuk bulan penjualan
cyclic_term <- "s(Mo_Sold, bs = 'cc', k = 10)"
# Interaksi spasial (k dinaikkan untuk menangkap variasi lokasi lebih fleksibel)
spatial_term <- "te(Longitude, Latitude, k = c(10, 10))"
# Menggabungkan seluruh komponen model
formula_gam <- as.formula(
paste(
"log_price ~",
paste(
c(smooth_terms, cyclic_term, spatial_term, factor_gam),
collapse = " + "
)
)
)
# Membentuk model GAM
model_gam <- gam(
formula_gam,
data = latih,
method = "REML",
knots = list(Mo_Sold = c(0.5, 12.5))
)
## Warning in smooth.construct.cr.smooth.spec(object, dk$data, dk$knots): basis dimension, k, increased to minimum possible
## Warning in smooth.construct.cr.smooth.spec(object, dk$data, dk$knots): basis dimension, k, increased to minimum possible
# Ringkasan model
summary(model_gam)
##
## Family: gaussian
## Link function: identity
##
## Formula:
## log_price ~ s(Lot_Frontage, bs = "cr", k = 10) + s(Lot_Area,
## bs = "cr", k = 10) + s(Year_Built, bs = "cr", k = 10) + s(Year_Remod_Add,
## bs = "cr", k = 10) + s(Mas_Vnr_Area, bs = "cr", k = 10) +
## s(BsmtFin_SF_1, bs = "cr", k = 7) + s(BsmtFin_SF_2, bs = "cr",
## k = 10) + s(Bsmt_Unf_SF, bs = "cr", k = 10) + s(Total_Bsmt_SF,
## bs = "cr", k = 10) + s(First_Flr_SF, bs = "cr", k = 10) +
## s(Second_Flr_SF, bs = "cr", k = 10) + s(Gr_Liv_Area, bs = "cr",
## k = 15) + s(Bsmt_Full_Bath, bs = "cr", k = 3) + s(Bsmt_Half_Bath,
## bs = "cr", k = 2) + s(Full_Bath, bs = "cr", k = 4) + s(Half_Bath,
## bs = "cr", k = 2) + s(Bedroom_AbvGr, bs = "cr", k = 7) +
## s(Kitchen_AbvGr, bs = "cr", k = 3) + s(TotRms_AbvGrd, bs = "cr",
## k = 10) + s(Fireplaces, bs = "cr", k = 4) + s(Garage_Cars,
## bs = "cr", k = 5) + s(Garage_Area, bs = "cr", k = 10) + s(Wood_Deck_SF,
## bs = "cr", k = 10) + s(Open_Porch_SF, bs = "cr", k = 10) +
## s(Enclosed_Porch, bs = "cr", k = 10) + s(Three_season_porch,
## bs = "cr", k = 10) + s(Screen_Porch, bs = "cr", k = 10) +
## s(Pool_Area, bs = "cr", k = 9) + s(Misc_Val, bs = "cr", k = 10) +
## s(Year_Sold, bs = "cr", k = 4) + s(Mo_Sold, bs = "cc", k = 10) +
## te(Longitude, Latitude, k = c(10, 10)) + MS_SubClass + MS_Zoning +
## Street + Alley + Lot_Shape + Land_Contour + Utilities + Lot_Config +
## Land_Slope + Neighborhood + Condition_1 + Condition_2 + House_Style +
## Overall_Cond + Roof_Style + Roof_Matl + Exterior_1st + Exterior_2nd +
## Mas_Vnr_Type + Exter_Cond + Foundation + Bsmt_Cond + Bsmt_Exposure +
## Heating + Heating_QC + Central_Air + Electrical + Functional +
## Garage_Type + Garage_Finish + Paved_Drive + Pool_QC + Fence +
## Sale_Type + Sale_Condition
##
## Parametric coefficients:
## Estimate Std. Error
## (Intercept) 11.5618667 0.3999872
## MS_SubClassOne_Story_1945_and_Older -0.0170095 0.0173304
## MS_SubClassOne_Story_with_Finished_Attic_All_Ages -0.0084418 0.0500290
## MS_SubClassOne_and_Half_Story_Unfinished_All_Ages -0.0169873 0.0587040
## MS_SubClassOne_and_Half_Story_Finished_All_Ages 0.0075882 0.0296401
## MS_SubClassTwo_Story_1946_and_Newer -0.0563272 0.0266520
## MS_SubClassTwo_Story_1945_and_Older 0.0037074 0.0294285
## MS_SubClassTwo_and_Half_Story_All_Ages 0.0242054 0.0507853
## MS_SubClassSplit_or_Multilevel -0.0599361 0.0543420
## MS_SubClassSplit_Foyer -0.0233376 0.0363423
## MS_SubClassDuplex_All_Styles_and_Ages -0.0884998 0.0266424
## MS_SubClassOne_Story_PUD_1946_and_Newer 0.0178009 0.0160721
## MS_SubClassOne_and_Half_Story_PUD_All_Ages -0.0035560 0.1179411
## MS_SubClassTwo_Story_PUD_1946_and_Newer -0.1119941 0.0361231
## MS_SubClassPUD_Multilevel_Split_Level_Foyer -0.0301747 0.0516414
## MS_SubClassTwo_Family_conversion_All_Styles_and_Ages -0.0155775 0.0265218
## MS_ZoningResidential_High_Density 0.0074335 0.0354708
## MS_ZoningResidential_Low_Density 0.0185468 0.0253770
## MS_ZoningResidential_Medium_Density -0.0410564 0.0296342
## MS_ZoningA_agr 0.0034349 0.1814554
## MS_ZoningC_all -0.1955329 0.0509426
## MS_ZoningI_all 0.0418611 0.2210041
## StreetPave 0.0888353 0.0535053
## AlleyNo_Alley_Access 0.0160579 0.0146861
## AlleyPaved 0.0359631 0.0215038
## Lot_ShapeSlightly_Irregular -0.0037379 0.0059625
## Lot_ShapeModerately_Irregular -0.0003585 0.0157355
## Lot_ShapeIrregular -0.0002557 0.0325770
## Land_ContourHLS 0.0200020 0.0183346
## Land_ContourLow -0.0141597 0.0244146
## Land_ContourLvl 0.0172419 0.0129725
## UtilitiesNoSeWa -0.1733666 0.1255826
## Lot_ConfigCulDSac -0.0029553 0.0116549
## Lot_ConfigFR2 -0.0370836 0.0153382
## Lot_ConfigFR3 -0.0467614 0.0321508
## Lot_ConfigInside -0.0060750 0.0062909
## Land_SlopeMod 0.0137973 0.0147236
## Land_SlopeSev -0.0564451 0.0494842
## NeighborhoodCollege_Creek 0.0355554 0.0694443
## NeighborhoodOld_Town -0.0109717 0.0225867
## NeighborhoodEdwards -0.0597466 0.0663237
## NeighborhoodSomerset 0.1092045 0.0389777
## NeighborhoodNorthridge_Heights 0.0857774 0.0433543
## NeighborhoodGilbert 0.0465395 0.0338932
## NeighborhoodSawyer -0.0566873 0.0611147
## NeighborhoodNorthwest_Ames 0.0135412 0.0232787
## NeighborhoodSawyer_West -0.0567853 0.0661938
## NeighborhoodMitchell -0.0030420 0.1362039
## NeighborhoodBrookside 0.0263263 0.0252206
## NeighborhoodCrawford 0.0896367 0.0623629
## NeighborhoodIowa_DOT_and_Rail_Road -0.0532074 0.0415340
## NeighborhoodTimberland 0.1446065 0.0962606
## NeighborhoodNorthridge 0.0765732 0.0444828
## NeighborhoodStone_Brook 0.2085858 0.0364790
## NeighborhoodSouth_and_West_of_Iowa_State_University 0.0299847 0.0645455
## NeighborhoodClear_Creek 0.0237316 0.0645319
## NeighborhoodMeadow_Village -0.0168680 0.1406690
## NeighborhoodBriardale 0.1464890 0.0386451
## NeighborhoodBloomington_Heights 0.1167507 0.0467970
## NeighborhoodVeenker -0.0288085 0.0492753
## NeighborhoodNorthpark_Villa 0.0987743 0.0484842
## NeighborhoodBlueste 0.3056889 0.0871382
## NeighborhoodGreens 0.2237619 0.0616993
## NeighborhoodGreen_Hills 0.5964753 0.1150605
## Condition_1Feedr 0.0141754 0.0182573
## Condition_1Norm 0.0647686 0.0150016
## Condition_1PosA 0.0859378 0.0315255
## Condition_1PosN 0.0786102 0.0257947
## Condition_1RRAe -0.0186489 0.0298993
## Condition_1RRAn 0.0205837 0.0246706
## Condition_1RRNe 0.0247947 0.0506289
## Condition_1RRNn 0.0917895 0.0476406
## Condition_2Feedr 0.0878499 0.0670604
## Condition_2Norm 0.1596328 0.0593772
## Condition_2PosA 0.3720463 0.0887040
## Condition_2PosN -0.0418873 0.0918100
## Condition_2RRAe -0.1853742 0.1927382
## Condition_2RRAn 0.0986073 0.1218182
## Condition_2RRNn 0.1942597 0.1224520
## House_StyleOne_and_Half_Unf 0.0915947 0.0559612
## House_StyleOne_Story 0.0133387 0.0303482
## House_StyleSFoyer 0.0655947 0.0404524
## House_StyleSLvl 0.0707867 0.0556512
## House_StyleTwo_and_Half_Fin -0.0099200 0.0620092
## House_StyleTwo_and_Half_Unf 0.0338143 0.0494932
## House_StyleTwo_Story 0.0354161 0.0258734
## Overall_CondPoor 0.0452877 0.0835679
## Overall_CondFair 0.0583269 0.0646541
## Overall_CondBelow_Average 0.1536248 0.0640372
## Overall_CondAverage 0.2179089 0.0637292
## Overall_CondAbove_Average 0.2587699 0.0638306
## Overall_CondGood 0.3107595 0.0640877
## Overall_CondVery_Good 0.3470059 0.0645977
## Overall_CondExcellent 0.4350033 0.0672554
## Roof_StyleGable 0.0408558 0.0548082
## Roof_StyleGambrel -0.0038790 0.0612782
## Roof_StyleHip 0.0477914 0.0552882
## Roof_StyleMansard 0.0035423 0.0685793
## Roof_StyleShed 0.3135271 0.1442976
## Roof_MatlCompShg -0.4285536 0.3075416
## Roof_MatlMembran -0.1514591 0.3376612
## Roof_MatlMetal -0.2673606 0.3375838
## Roof_MatlRoll -0.4518225 0.3272576
## Roof_MatlTar&Grv -0.3670008 0.3138432
## Roof_MatlWdShake -0.4610242 0.3105484
## Roof_MatlWdShngl -0.1792173 0.3093505
## Exterior_1stAsphShn -0.0020914 0.1191872
## Exterior_1stBrkComm 0.0066765 0.0727315
## Exterior_1stBrkFace 0.1399330 0.0470021
## Exterior_1stCBlock -0.0304619 0.1422683
## Exterior_1stCemntBd -0.0445912 0.0693141
## Exterior_1stHdBoard 0.0293710 0.0463307
## Exterior_1stImStucc 0.0159156 0.1177525
## Exterior_1stMetalSd 0.0724492 0.0503683
## Exterior_1stPlywood 0.0340282 0.0455090
## Exterior_1stStone 0.1171196 0.0995257
## Exterior_1stStucco 0.0428799 0.0499934
## Exterior_1stVinylSd 0.0303000 0.0489091
## Exterior_1stWd Sdng 0.0201267 0.0449946
## Exterior_1stWdShing 0.0291242 0.0476102
## Exterior_2ndAsphShn 0.0709753 0.0912052
## Exterior_2ndBrk Cmn 0.0286978 0.0656556
## Exterior_2ndBrkFace -0.0384568 0.0496971
## Exterior_2ndCBlock -0.0310365 0.0955633
## Exterior_2ndCmentBd 0.0925975 0.0697601
## Exterior_2ndHdBoard -0.0017507 0.0461845
## Exterior_2ndImStucc -0.0230155 0.0536094
## Exterior_2ndMetalSd -0.0293065 0.0502794
## Exterior_2ndPlywood -0.0065045 0.0447324
## Exterior_2ndStone -0.0091611 0.0777160
## Exterior_2ndStucco 0.0379387 0.0500758
## Exterior_2ndVinylSd -0.0052205 0.0485710
## Exterior_2ndWd Sdng 0.0198762 0.0451371
## Exterior_2ndWd Shng 0.0363543 0.0469028
## Mas_Vnr_TypeBrkFace 0.0299398 0.0256290
## Mas_Vnr_TypeCBlock -0.6099147 0.1747631
## Mas_Vnr_TypeNone 0.0291033 0.0255524
## Mas_Vnr_TypeStone 0.0420636 0.0269031
## Exter_CondFair -0.0372794 0.0391390
## Exter_CondGood -0.0018171 0.0351185
## Exter_CondPoor -0.0262673 0.1028822
## Exter_CondTypical 0.0108443 0.0349866
## FoundationCBlock 0.0121993 0.0113226
## FoundationPConc 0.0149970 0.0120147
## FoundationSlab 0.0278663 0.0330273
## FoundationStone 0.0563615 0.0388358
## FoundationWood 0.0048901 0.0768741
## Bsmt_CondFair -0.0492190 0.0647125
## Bsmt_CondGood -0.0317874 0.0639908
## Bsmt_CondNo_Basement -0.0287907 0.0999999
## Bsmt_CondPoor -0.0707436 0.0877990
## Bsmt_CondTypical -0.0448432 0.0631612
## Bsmt_ExposureGd 0.0288975 0.0104342
## Bsmt_ExposureMn -0.0236347 0.0105238
## Bsmt_ExposureNo -0.0238252 0.0080570
## Bsmt_ExposureNo_Basement -0.0837969 0.0603624
## HeatingGasA 0.1224870 0.1085537
## HeatingGasW 0.1639266 0.1109127
## HeatingGrav -0.0019290 0.1163305
## HeatingOthW 0.0719511 0.1355417
## HeatingWall 0.1038151 0.1255695
## Heating_QCFair -0.0281921 0.0156587
## Heating_QCGood -0.0151601 0.0072345
## Heating_QCPoor -1.3268675 0.2755912
## Heating_QCTypical -0.0342306 0.0069674
## Central_AirY 0.0356728 0.0123393
## ElectricalFuseF -0.0175413 0.0201726
## ElectricalFuseP 0.0369603 0.0492072
## ElectricalMix 0.1315474 0.1437265
## ElectricalSBrkr -0.0028629 0.0102782
## ElectricalUnknown -0.0695322 0.1058795
## FunctionalMaj2 -0.1601619 0.0549775
## FunctionalMin1 0.0296997 0.0339796
## FunctionalMin2 0.0178562 0.0336859
## FunctionalMod 0.0067384 0.0373619
## FunctionalSal -0.3610298 0.1264143
## FunctionalSev -0.2140049 0.1232810
## FunctionalTyp 0.0844926 0.0302590
## Garage_TypeBasment -0.0174871 0.0243669
## Garage_TypeBuiltIn -0.0096663 0.0115295
## Garage_TypeCarPort -0.0504785 0.0421317
## Garage_TypeDetchd -0.0097443 0.0082907
## Garage_TypeMore_Than_Two_Types -0.0598885 0.0288925
## Garage_TypeNo_Garage -0.0178212 0.0839103
## Garage_FinishNo_Garage -0.0257548 0.0835170
## Garage_FinishRFn -0.0126655 0.0070138
## Garage_FinishUnf -0.0074036 0.0082693
## Paved_DrivePartial_Pavement 0.0067694 0.0182432
## Paved_DrivePaved 0.0230799 0.0118251
## Pool_QCFair -0.0827031 0.1663741
## Pool_QCGood 0.2491077 0.1720083
## Pool_QCNo_Pool -0.0813561 0.2978819
## Pool_QCTypical -0.0069320 0.1443956
## FenceGood_Wood -0.0120424 0.0165992
## FenceMinimum_Privacy -0.0099367 0.0135361
## FenceMinimum_Wood_Wire -0.0267228 0.0343522
## FenceNo_Fence -0.0071110 0.0121206
## Sale_TypeCon 0.0994343 0.0570612
## Sale_TypeConLD 0.0014228 0.0289381
## Sale_TypeConLI -0.0132458 0.0399318
## Sale_TypeConLw -0.0086213 0.0431942
## Sale_TypeCWD 0.0380843 0.0377161
## Sale_TypeNew -0.0233152 0.0586203
## Sale_TypeOth -0.0276655 0.0447219
## Sale_TypeVWD -0.0710773 0.1065345
## Sale_TypeWD 0.0036449 0.0143358
## Sale_ConditionAdjLand 0.2307106 0.0394359
## Sale_ConditionAlloca 0.0994074 0.0324774
## Sale_ConditionFamily 0.0196312 0.0205401
## Sale_ConditionNormal 0.0747501 0.0104342
## Sale_ConditionPartial 0.1232180 0.0571347
## t value Pr(>|t|)
## (Intercept) 28.906 < 2e-16 ***
## MS_SubClassOne_Story_1945_and_Older -0.981 0.326471
## MS_SubClassOne_Story_with_Finished_Attic_All_Ages -0.169 0.866020
## MS_SubClassOne_and_Half_Story_Unfinished_All_Ages -0.289 0.772327
## MS_SubClassOne_and_Half_Story_Finished_All_Ages 0.256 0.797967
## MS_SubClassTwo_Story_1946_and_Newer -2.113 0.034685 *
## MS_SubClassTwo_Story_1945_and_Older 0.126 0.899761
## MS_SubClassTwo_and_Half_Story_All_Ages 0.477 0.633683
## MS_SubClassSplit_or_Multilevel -1.103 0.270182
## MS_SubClassSplit_Foyer -0.642 0.520840
## MS_SubClassDuplex_All_Styles_and_Ages -3.322 0.000910 ***
## MS_SubClassOne_Story_PUD_1946_and_Newer 1.108 0.268179
## MS_SubClassOne_and_Half_Story_PUD_All_Ages -0.030 0.975950
## MS_SubClassTwo_Story_PUD_1946_and_Newer -3.100 0.001959 **
## MS_SubClassPUD_Multilevel_Split_Level_Foyer -0.584 0.559075
## MS_SubClassTwo_Family_conversion_All_Styles_and_Ages -0.587 0.557036
## MS_ZoningResidential_High_Density 0.210 0.834027
## MS_ZoningResidential_Low_Density 0.731 0.464953
## MS_ZoningResidential_Medium_Density -1.385 0.166070
## MS_ZoningA_agr 0.019 0.984899
## MS_ZoningC_all -3.838 0.000128 ***
## MS_ZoningI_all 0.189 0.849788
## StreetPave 1.660 0.097006 .
## AlleyNo_Alley_Access 1.093 0.274346
## AlleyPaved 1.672 0.094597 .
## Lot_ShapeSlightly_Irregular -0.627 0.530799
## Lot_ShapeModerately_Irregular -0.023 0.981824
## Lot_ShapeIrregular -0.008 0.993739
## Land_ContourHLS 1.091 0.275427
## Land_ContourLow -0.580 0.561998
## Land_ContourLvl 1.329 0.183959
## UtilitiesNoSeWa -1.380 0.167584
## Lot_ConfigCulDSac -0.254 0.799855
## Lot_ConfigFR2 -2.418 0.015705 *
## Lot_ConfigFR3 -1.454 0.145977
## Lot_ConfigInside -0.966 0.334319
## Land_SlopeMod 0.937 0.348822
## Land_SlopeSev -1.141 0.254141
## NeighborhoodCollege_Creek 0.512 0.608707
## NeighborhoodOld_Town -0.486 0.627189
## NeighborhoodEdwards -0.901 0.367784
## NeighborhoodSomerset 2.802 0.005131 **
## NeighborhoodNorthridge_Heights 1.979 0.048004 *
## NeighborhoodGilbert 1.373 0.169865
## NeighborhoodSawyer -0.928 0.353747
## NeighborhoodNorthwest_Ames 0.582 0.560835
## NeighborhoodSawyer_West -0.858 0.391068
## NeighborhoodMitchell -0.022 0.982183
## NeighborhoodBrookside 1.044 0.296682
## NeighborhoodCrawford 1.437 0.150774
## NeighborhoodIowa_DOT_and_Rail_Road -1.281 0.200319
## NeighborhoodTimberland 1.502 0.133189
## NeighborhoodNorthridge 1.721 0.085327 .
## NeighborhoodStone_Brook 5.718 1.24e-08 ***
## NeighborhoodSouth_and_West_of_Iowa_State_University 0.465 0.642302
## NeighborhoodClear_Creek 0.368 0.713097
## NeighborhoodMeadow_Village -0.120 0.904564
## NeighborhoodBriardale 3.791 0.000155 ***
## NeighborhoodBloomington_Heights 2.495 0.012680 *
## NeighborhoodVeenker -0.585 0.558851
## NeighborhoodNorthpark_Villa 2.037 0.041754 *
## NeighborhoodBlueste 3.508 0.000461 ***
## NeighborhoodGreens 3.627 0.000294 ***
## NeighborhoodGreen_Hills 5.184 2.39e-07 ***
## Condition_1Feedr 0.776 0.437588
## Condition_1Norm 4.317 1.65e-05 ***
## Condition_1PosA 2.726 0.006466 **
## Condition_1PosN 3.048 0.002337 **
## Condition_1RRAe -0.624 0.532878
## Condition_1RRAn 0.834 0.404185
## Condition_1RRNe 0.490 0.624375
## Condition_1RRNn 1.927 0.054154 .
## Condition_2Feedr 1.310 0.190339
## Condition_2Norm 2.688 0.007237 **
## Condition_2PosA 4.194 2.85e-05 ***
## Condition_2PosN -0.456 0.648267
## Condition_2RRAe -0.962 0.336268
## Condition_2RRAn 0.809 0.418343
## Condition_2RRNn 1.586 0.112800
## House_StyleOne_and_Half_Unf 1.637 0.101836
## House_StyleOne_Story 0.440 0.660331
## House_StyleSFoyer 1.622 0.105059
## House_StyleSLvl 1.272 0.203528
## House_StyleTwo_and_Half_Fin -0.160 0.872915
## House_StyleTwo_and_Half_Unf 0.683 0.494551
## House_StyleTwo_Story 1.369 0.171205
## Overall_CondPoor 0.542 0.587928
## Overall_CondFair 0.902 0.367090
## Overall_CondBelow_Average 2.399 0.016529 *
## Overall_CondAverage 3.419 0.000640 ***
## Overall_CondAbove_Average 4.054 5.22e-05 ***
## Overall_CondGood 4.849 1.33e-06 ***
## Overall_CondVery_Good 5.372 8.68e-08 ***
## Overall_CondExcellent 6.468 1.24e-10 ***
## Roof_StyleGable 0.745 0.456096
## Roof_StyleGambrel -0.063 0.949532
## Roof_StyleHip 0.864 0.387467
## Roof_StyleMansard 0.052 0.958810
## Roof_StyleShed 2.173 0.029911 *
## Roof_MatlCompShg -1.393 0.163626
## Roof_MatlMembran -0.449 0.653801
## Roof_MatlMetal -0.792 0.428462
## Roof_MatlRoll -1.381 0.167543
## Roof_MatlTar&Grv -1.169 0.242388
## Roof_MatlWdShake -1.485 0.137818
## Roof_MatlWdShngl -0.579 0.562427
## Exterior_1stAsphShn -0.018 0.986002
## Exterior_1stBrkComm 0.092 0.926869
## Exterior_1stBrkFace 2.977 0.002943 **
## Exterior_1stCBlock -0.214 0.830478
## Exterior_1stCemntBd -0.643 0.520089
## Exterior_1stHdBoard 0.634 0.526188
## Exterior_1stImStucc 0.135 0.892498
## Exterior_1stMetalSd 1.438 0.150476
## Exterior_1stPlywood 0.748 0.454712
## Exterior_1stStone 1.177 0.239421
## Exterior_1stStucco 0.858 0.391152
## Exterior_1stVinylSd 0.620 0.535645
## Exterior_1stWd Sdng 0.447 0.654695
## Exterior_1stWdShing 0.612 0.540790
## Exterior_2ndAsphShn 0.778 0.436545
## Exterior_2ndBrk Cmn 0.437 0.662088
## Exterior_2ndBrkFace -0.774 0.439125
## Exterior_2ndCBlock -0.325 0.745385
## Exterior_2ndCmentBd 1.327 0.184534
## Exterior_2ndHdBoard -0.038 0.969767
## Exterior_2ndImStucc -0.429 0.667737
## Exterior_2ndMetalSd -0.583 0.560044
## Exterior_2ndPlywood -0.145 0.884403
## Exterior_2ndStone -0.118 0.906175
## Exterior_2ndStucco 0.758 0.448762
## Exterior_2ndVinylSd -0.107 0.914417
## Exterior_2ndWd Sdng 0.440 0.659729
## Exterior_2ndWd Shng 0.775 0.438372
## Mas_Vnr_TypeBrkFace 1.168 0.242863
## Mas_Vnr_TypeCBlock -3.490 0.000493 ***
## Mas_Vnr_TypeNone 1.139 0.254851
## Mas_Vnr_TypeStone 1.564 0.118084
## Exter_CondFair -0.952 0.340963
## Exter_CondGood -0.052 0.958739
## Exter_CondPoor -0.255 0.798506
## Exter_CondTypical 0.310 0.756626
## FoundationCBlock 1.077 0.281419
## FoundationPConc 1.248 0.212095
## FoundationSlab 0.844 0.398915
## FoundationStone 1.451 0.146856
## FoundationWood 0.064 0.949285
## Bsmt_CondFair -0.761 0.446996
## Bsmt_CondGood -0.497 0.619419
## Bsmt_CondNo_Basement -0.288 0.773447
## Bsmt_CondPoor -0.806 0.420484
## Bsmt_CondTypical -0.710 0.477797
## Bsmt_ExposureGd 2.769 0.005665 **
## Bsmt_ExposureMn -2.246 0.024821 *
## Bsmt_ExposureNo -2.957 0.003141 **
## Bsmt_ExposureNo_Basement -1.388 0.165218
## HeatingGasA 1.128 0.259303
## HeatingGasW 1.478 0.139567
## HeatingGrav -0.017 0.986772
## HeatingOthW 0.531 0.595587
## HeatingWall 0.827 0.408473
## Heating_QCFair -1.800 0.071943 .
## Heating_QCGood -2.096 0.036246 *
## Heating_QCPoor -4.815 1.58e-06 ***
## Heating_QCTypical -4.913 9.68e-07 ***
## Central_AirY 2.891 0.003881 **
## ElectricalFuseF -0.870 0.384643
## ElectricalFuseP 0.751 0.452669
## ElectricalMix 0.915 0.360162
## ElectricalSBrkr -0.279 0.780627
## ElectricalUnknown -0.657 0.511441
## FunctionalMaj2 -2.913 0.003616 **
## FunctionalMin1 0.874 0.382195
## FunctionalMin2 0.530 0.596115
## FunctionalMod 0.180 0.856893
## FunctionalSal -2.856 0.004334 **
## FunctionalSev -1.736 0.082730 .
## FunctionalTyp 2.792 0.005282 **
## Garage_TypeBasment -0.718 0.473049
## Garage_TypeBuiltIn -0.838 0.401905
## Garage_TypeCarPort -1.198 0.231012
## Garage_TypeDetchd -1.175 0.240002
## Garage_TypeMore_Than_Two_Types -2.073 0.038315 *
## Garage_TypeNo_Garage -0.212 0.831829
## Garage_FinishNo_Garage -0.308 0.757826
## Garage_FinishRFn -1.806 0.071095 .
## Garage_FinishUnf -0.895 0.370729
## Paved_DrivePartial_Pavement 0.371 0.710628
## Paved_DrivePaved 1.952 0.051100 .
## Pool_QCFair -0.497 0.619178
## Pool_QCGood 1.448 0.147706
## Pool_QCNo_Pool -0.273 0.784792
## Pool_QCTypical -0.048 0.961715
## FenceGood_Wood -0.725 0.468240
## FenceMinimum_Privacy -0.734 0.462980
## FenceMinimum_Wood_Wire -0.778 0.436714
## FenceNo_Fence -0.587 0.557478
## Sale_TypeCon 1.743 0.081555 .
## Sale_TypeConLD 0.049 0.960790
## Sale_TypeConLI -0.332 0.740142
## Sale_TypeConLw -0.200 0.841818
## Sale_TypeCWD 1.010 0.312728
## Sale_TypeNew -0.398 0.690869
## Sale_TypeOth -0.619 0.536240
## Sale_TypeVWD -0.667 0.504735
## Sale_TypeWD 0.254 0.799327
## Sale_ConditionAdjLand 5.850 5.70e-09 ***
## Sale_ConditionAlloca 3.061 0.002236 **
## Sale_ConditionFamily 0.956 0.339312
## Sale_ConditionNormal 7.164 1.09e-12 ***
## Sale_ConditionPartial 2.157 0.031151 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Approximate significance of smooth terms:
## edf Ref.df F p-value
## s(Lot_Frontage) 1.00007 1.000 0.176 0.675330
## s(Lot_Area) 4.38586 5.101 17.777 < 2e-16 ***
## s(Year_Built) 4.78276 5.950 23.654 < 2e-16 ***
## s(Year_Remod_Add) 1.00036 1.001 12.443 0.000427 ***
## s(Mas_Vnr_Area) 1.00010 1.000 6.105 0.013552 *
## s(BsmtFin_SF_1) 1.00006 1.000 3.326 0.068342 .
## s(BsmtFin_SF_2) 1.56360 1.931 2.623 0.106269
## s(Bsmt_Unf_SF) 1.00008 1.000 46.835 < 2e-16 ***
## s(Total_Bsmt_SF) 5.19881 6.192 12.901 < 2e-16 ***
## s(First_Flr_SF) 4.33932 5.235 2.122 0.075833 .
## s(Second_Flr_SF) 1.00014 1.000 2.197 0.138382
## s(Gr_Liv_Area) 7.98092 9.422 9.653 < 2e-16 ***
## s(Bsmt_Full_Bath) 1.00002 1.000 8.745 0.003140 **
## s(Bsmt_Half_Bath) 1.75159 1.936 1.397 0.225680
## s(Full_Bath) 1.00003 1.000 12.060 0.000526 ***
## s(Half_Bath) 1.76433 1.942 6.200 0.005229 **
## s(Bedroom_AbvGr) 1.00003 1.000 3.232 0.072337 .
## s(Kitchen_AbvGr) 1.00002 1.000 4.330 0.037570 *
## s(TotRms_AbvGrd) 1.00008 1.000 1.046 0.306646
## s(Fireplaces) 1.00003 1.000 46.451 < 2e-16 ***
## s(Garage_Cars) 1.00003 1.000 11.472 0.000720 ***
## s(Garage_Area) 4.09247 5.052 4.003 0.001250 **
## s(Wood_Deck_SF) 1.00013 1.000 5.172 0.023052 *
## s(Open_Porch_SF) 2.38154 3.000 2.282 0.077005 .
## s(Enclosed_Porch) 2.36839 2.904 4.890 0.002943 **
## s(Three_season_porch) 1.00016 1.000 1.533 0.215682
## s(Screen_Porch) 1.00009 1.000 27.539 3.3e-07 ***
## s(Pool_Area) 1.00003 1.000 0.268 0.604905
## s(Misc_Val) 1.00010 1.000 1.442 0.229955
## s(Year_Sold) 1.69268 2.055 2.629 0.067802 .
## s(Mo_Sold) 0.06074 8.000 0.008 0.352013
## te(Longitude,Latitude) 26.89203 35.446 2.145 0.000127 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## R-sq.(adj) = 0.937 Deviance explained = 94.5%
## -REML = -1430 Scale est. = 0.010238 n = 2344
# Memeriksa kecukupan basis (k-index) dengan seed tetap agar p-value tidak berubah-ubah
set.seed(1)
tabel_k <- k.check(model_gam)
print(round(tabel_k, 4))
## k' edf k-index p-value
## s(Lot_Frontage) 9 1.0001 0.9889 0.2950
## s(Lot_Area) 9 4.3859 0.9800 0.1225
## s(Year_Built) 9 4.7828 1.0026 0.5275
## s(Year_Remod_Add) 9 1.0004 1.0018 0.5525
## s(Mas_Vnr_Area) 9 1.0001 1.0186 0.8275
## s(BsmtFin_SF_1) 6 1.0001 1.0212 0.8500
## s(BsmtFin_SF_2) 9 1.5636 1.0170 0.7900
## s(Bsmt_Unf_SF) 9 1.0001 1.0212 0.8300
## s(Total_Bsmt_SF) 9 5.1988 0.9820 0.1550
## s(First_Flr_SF) 9 4.3393 0.9714 0.0875
## s(Second_Flr_SF) 9 1.0001 0.9849 0.1900
## s(Gr_Liv_Area) 14 7.9809 0.9534 0.0025
## s(Bsmt_Full_Bath) 2 1.0000 1.0033 0.5800
## s(Bsmt_Half_Bath) 2 1.7516 1.0208 0.8175
## s(Full_Bath) 3 1.0000 1.0419 0.9800
## s(Half_Bath) 2 1.7643 1.0462 0.9950
## s(Bedroom_AbvGr) 6 1.0000 1.0138 0.7650
## s(Kitchen_AbvGr) 2 1.0000 1.0166 0.7275
## s(TotRms_AbvGrd) 9 1.0001 1.0044 0.5625
## s(Fireplaces) 3 1.0000 1.0488 0.9900
## s(Garage_Cars) 4 1.0000 0.9986 0.4350
## s(Garage_Area) 9 4.0925 0.9835 0.1975
## s(Wood_Deck_SF) 9 1.0001 1.0251 0.9050
## s(Open_Porch_SF) 9 2.3815 1.0047 0.5500
## s(Enclosed_Porch) 9 2.3684 1.0223 0.8700
## s(Three_season_porch) 9 1.0002 1.0279 0.9225
## s(Screen_Porch) 9 1.0001 1.0460 0.9850
## s(Pool_Area) 8 1.0000 1.0323 0.9475
## s(Misc_Val) 9 1.0001 1.0188 0.8050
## s(Year_Sold) 3 1.6927 1.0197 0.8125
## s(Mo_Sold) 8 0.0607 1.0239 0.8625
## te(Longitude,Latitude) 99 26.8920 0.9442 0.0050
# Atau lewat gam.check lengkap (menampilkan 4 plot diagnostik + tabel k-index)
set.seed(1)
gam.check(model_gam)
##
## Method: REML Optimizer: outer newton
## full convergence after 11 iterations.
## Gradient range [-3.719963e-05,0.0003661082]
## (score -1429.968 & scale 0.01023753).
## Hessian positive definite, eigenvalue range [8.112937e-06,1050.096].
## Model rank = 535 / 535
##
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
##
## k' edf k-index p-value
## s(Lot_Frontage) 9.0000 1.0001 0.99 0.310
## s(Lot_Area) 9.0000 4.3859 0.98 0.145
## s(Year_Built) 9.0000 4.7828 1.00 0.505
## s(Year_Remod_Add) 9.0000 1.0004 1.00 0.520
## s(Mas_Vnr_Area) 9.0000 1.0001 1.02 0.825
## s(BsmtFin_SF_1) 6.0000 1.0001 1.02 0.810
## s(BsmtFin_SF_2) 9.0000 1.5636 1.02 0.770
## s(Bsmt_Unf_SF) 9.0000 1.0001 1.02 0.875
## s(Total_Bsmt_SF) 9.0000 5.1988 0.98 0.195
## s(First_Flr_SF) 9.0000 4.3393 0.97 0.040 *
## s(Second_Flr_SF) 9.0000 1.0001 0.98 0.210
## s(Gr_Liv_Area) 14.0000 7.9809 0.95 0.005 **
## s(Bsmt_Full_Bath) 2.0000 1.0000 1.00 0.485
## s(Bsmt_Half_Bath) 2.0000 1.7516 1.02 0.845
## s(Full_Bath) 3.0000 1.0000 1.04 0.955
## s(Half_Bath) 2.0000 1.7643 1.05 0.995
## s(Bedroom_AbvGr) 6.0000 1.0000 1.01 0.690
## s(Kitchen_AbvGr) 2.0000 1.0000 1.02 0.770
## s(TotRms_AbvGrd) 9.0000 1.0001 1.00 0.555
## s(Fireplaces) 3.0000 1.0000 1.05 0.990
## s(Garage_Cars) 4.0000 1.0000 1.00 0.510
## s(Garage_Area) 9.0000 4.0925 0.98 0.150
## s(Wood_Deck_SF) 9.0000 1.0001 1.03 0.895
## s(Open_Porch_SF) 9.0000 2.3815 1.00 0.585
## s(Enclosed_Porch) 9.0000 2.3684 1.02 0.865
## s(Three_season_porch) 9.0000 1.0002 1.03 0.960
## s(Screen_Porch) 9.0000 1.0001 1.05 0.975
## s(Pool_Area) 8.0000 1.0000 1.03 0.925
## s(Misc_Val) 9.0000 1.0001 1.02 0.820
## s(Year_Sold) 3.0000 1.6927 1.02 0.795
## s(Mo_Sold) 8.0000 0.0607 1.02 0.860
## te(Longitude,Latitude) 99.0000 26.8920 0.94 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# ==================================================
# UJI DIAGNOSTIK MODEL GAM
# ==================================================
library(mgcv)
# 1. Uji diagnostik model GAM
set.seed(1)
gam.check(model_gam)
##
## Method: REML Optimizer: outer newton
## full convergence after 11 iterations.
## Gradient range [-3.719963e-05,0.0003661082]
## (score -1429.968 & scale 0.01023753).
## Hessian positive definite, eigenvalue range [8.112937e-06,1050.096].
## Model rank = 535 / 535
##
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
##
## k' edf k-index p-value
## s(Lot_Frontage) 9.0000 1.0001 0.99 0.310
## s(Lot_Area) 9.0000 4.3859 0.98 0.145
## s(Year_Built) 9.0000 4.7828 1.00 0.505
## s(Year_Remod_Add) 9.0000 1.0004 1.00 0.520
## s(Mas_Vnr_Area) 9.0000 1.0001 1.02 0.825
## s(BsmtFin_SF_1) 6.0000 1.0001 1.02 0.810
## s(BsmtFin_SF_2) 9.0000 1.5636 1.02 0.770
## s(Bsmt_Unf_SF) 9.0000 1.0001 1.02 0.875
## s(Total_Bsmt_SF) 9.0000 5.1988 0.98 0.195
## s(First_Flr_SF) 9.0000 4.3393 0.97 0.040 *
## s(Second_Flr_SF) 9.0000 1.0001 0.98 0.210
## s(Gr_Liv_Area) 14.0000 7.9809 0.95 0.005 **
## s(Bsmt_Full_Bath) 2.0000 1.0000 1.00 0.485
## s(Bsmt_Half_Bath) 2.0000 1.7516 1.02 0.845
## s(Full_Bath) 3.0000 1.0000 1.04 0.955
## s(Half_Bath) 2.0000 1.7643 1.05 0.995
## s(Bedroom_AbvGr) 6.0000 1.0000 1.01 0.690
## s(Kitchen_AbvGr) 2.0000 1.0000 1.02 0.770
## s(TotRms_AbvGrd) 9.0000 1.0001 1.00 0.555
## s(Fireplaces) 3.0000 1.0000 1.05 0.990
## s(Garage_Cars) 4.0000 1.0000 1.00 0.510
## s(Garage_Area) 9.0000 4.0925 0.98 0.150
## s(Wood_Deck_SF) 9.0000 1.0001 1.03 0.895
## s(Open_Porch_SF) 9.0000 2.3815 1.00 0.585
## s(Enclosed_Porch) 9.0000 2.3684 1.02 0.865
## s(Three_season_porch) 9.0000 1.0002 1.03 0.960
## s(Screen_Porch) 9.0000 1.0001 1.05 0.975
## s(Pool_Area) 8.0000 1.0000 1.03 0.925
## s(Misc_Val) 9.0000 1.0001 1.02 0.820
## s(Year_Sold) 3.0000 1.6927 1.02 0.795
## s(Mo_Sold) 8.0000 0.0607 1.02 0.860
## te(Longitude,Latitude) 99.0000 26.8920 0.94 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# 2. Uji Concurvity
hasil_concurvity <- concurvity(model_gam, full = TRUE)
cat("\nHasil Uji Concurvity:\n")
##
## Hasil Uji Concurvity:
print(round(hasil_concurvity, 3))
## para s(Lot_Frontage) s(Lot_Area) s(Year_Built) s(Year_Remod_Add)
## worst 1 0.807 0.927 0.972 0.844
## observed 1 0.518 0.874 0.968 0.771
## estimate 1 0.525 0.636 0.811 0.651
## s(Mas_Vnr_Area) s(BsmtFin_SF_1) s(BsmtFin_SF_2) s(Bsmt_Unf_SF)
## worst 0.979 0.917 0.536 0.828
## observed 0.743 0.644 0.507 0.821
## estimate 0.414 0.541 0.315 0.436
## s(Total_Bsmt_SF) s(First_Flr_SF) s(Second_Flr_SF) s(Gr_Liv_Area)
## worst 0.986 0.994 0.994 0.997
## observed 0.939 0.978 0.993 0.981
## estimate 0.780 0.814 0.571 0.628
## s(Bsmt_Full_Bath) s(Bsmt_Half_Bath) s(Full_Bath) s(Half_Bath)
## worst 0.701 0.732 0.826 0.749
## observed 0.697 0.673 0.817 0.738
## estimate 0.677 0.428 0.813 0.739
## s(Bedroom_AbvGr) s(Kitchen_AbvGr) s(TotRms_AbvGrd) s(Fireplaces)
## worst 0.837 0.863 0.969 0.772
## observed 0.780 0.858 0.868 0.628
## estimate 0.627 0.825 0.568 0.578
## s(Garage_Cars) s(Garage_Area) s(Wood_Deck_SF) s(Open_Porch_SF)
## worst 0.996 0.991 0.480 0.575
## observed 0.917 0.758 0.440 0.515
## estimate 0.896 0.537 0.359 0.386
## s(Enclosed_Porch) s(Three_season_porch) s(Screen_Porch) s(Pool_Area)
## worst 0.982 0.583 0.413 1.000
## observed 0.795 0.252 0.347 0.991
## estimate 0.400 0.304 0.314 0.808
## s(Misc_Val) s(Year_Sold) s(Mo_Sold) te(Longitude,Latitude)
## worst 0.929 0.357 0.342 1.020
## observed 0.665 0.349 0.222 0.893
## estimate 0.349 0.309 0.252 0.655
# 3. Ringkasan kecocokan model
cat("\nAdjusted R-squared:\n")
##
## Adjusted R-squared:
print(summary(model_gam)$r.sq)
## [1] 0.9374928
cat("\nDeviance Explained:\n")
##
## Deviance Explained:
print(summary(model_gam)$dev.expl)
## [1] 0.9454231
cat("\nNilai REML:\n")
##
## Nilai REML:
print(model_gam$gcv.ubre)
## REML
## -1429.968
## attr(,"Dp")
## [1] 1050
## attr(,"ml.pen")
## [1] 762.915
# ==================================================
# 6. PEMODELAN RIDGE DAN LASSO (glmnet)
# ==================================================
library(glmnet)
## Warning: package 'glmnet' was built under R version 4.5.3
## Loading required package: Matrix
##
## Attaching package: 'Matrix'
## The following objects are masked from 'package:tidyr':
##
## expand, pack, unpack
## Loaded glmnet 5.2
# Membentuk matriks desain X dari ames agar semua level faktor tercatat utuh
X_semua <- model.matrix(formula_ols, data = ames)[, -1]
X_latih_raw <- X_semua[id_latih, ]
X_uji_raw <- X_semua[-id_latih, ]
# Buang kolom dummy yang tidak pernah muncul di data latih (varians/sd == 0)
# Ini mencegah NaN saat standardisasi/SVD dan menjaga konsistensi kolom
kolom_valid <- apply(X_latih_raw, 2, sd) > 0
X_latih <- X_latih_raw[, kolom_valid, drop = FALSE]
X_uji <- X_uji_raw[, kolom_valid, drop = FALSE]
y_latih <- latih$log_price
y_uji <- uji$log_price
# --- A. Regresi Ridge (alpha = 0) ---
ridge <- glmnet(X_latih, y_latih, alpha = 0)
plot(ridge, xvar = "lambda", main = "Ridge Trace (Jalur Koefisien)")
set.seed(2026)
cv_r <- cv.glmnet(X_latih, y_latih, alpha = 0, nfolds = 10)
plot(cv_r)
title("10-Fold CV: Ridge", line = 2.5)
c(lambda_min_ridge = cv_r$lambda.min, lambda_1se_ridge = cv_r$lambda.1se)
## lambda_min_ridge lambda_1se_ridge
## 0.1025167 0.4542126
# --- B. Regresi LASSO (alpha = 1) ---
lasso <- glmnet(X_latih, y_latih, alpha = 1)
plot(lasso, xvar = "lambda", label = FALSE, main = "Coefficient Path: LASSO")
set.seed(2026)
cv_l <- cv.glmnet(X_latih, y_latih, alpha = 1, nfolds = 10)
plot(cv_l)
title("10-Fold CV: LASSO", line = 2.5)
c(lambda_min_lasso = cv_l$lambda.min, lambda_1se_lasso = cv_l$lambda.1se)
## lambda_min_lasso lambda_1se_lasso
## 0.002660333 0.011786926
# Mengekstrak variabel/dummy aktif vs dibuang oleh LASSO
b_min <- coef(cv_l, s = "lambda.min")
b_1se <- coef(cv_l, s = "lambda.1se")
aktif_min <- rownames(b_min)[b_min[, 1] != 0][-1]
aktif_1se <- rownames(b_1se)[b_1se[, 1] != 0][-1]
dibuang_1se <- rownames(b_1se)[b_1se[, 1] == 0]
cat("Jumlah koefisien aktif LASSO (lambda.min):", length(aktif_min), "dari", ncol(X_latih), "\n")
## Jumlah koefisien aktif LASSO (lambda.min): 132 dari 243
cat("Jumlah koefisien aktif LASSO (lambda.1se):", length(aktif_1se), "dari", ncol(X_latih), "\n")
## Jumlah koefisien aktif LASSO (lambda.1se): 55 dari 243
cat("Jumlah koefisien dibuang LASSO (lambda.1se):", length(dibuang_1se), "\n")
## Jumlah koefisien dibuang LASSO (lambda.1se): 188
# Tabel efek persentase perubahan harga jual per 1 unit & per 1 SD (lambda.1se)
b_aktif <- b_1se[b_1se[, 1] != 0, ][-1]
sd_X <- apply(X_latih[, names(b_aktif), drop = FALSE], 2, sd)
efek_lasso <- data.frame(
Prediktor = names(b_aktif),
Beta_1se = round(b_aktif, 5),
Persen_per_1_Unit = round(100 * (exp(b_aktif) - 1), 3),
Persen_per_1_SD = round(100 * (exp(b_aktif * sd_X) - 1), 2)
)
print(head(efek_lasso[order(-abs(efek_lasso$Persen_per_1_SD)), ], 15))
## Prediktor
## Gr_Liv_Area Gr_Liv_Area
## Year_Remod_Add Year_Remod_Add
## Total_Bsmt_SF Total_Bsmt_SF
## Garage_Cars Garage_Cars
## Year_Built Year_Built
## Fireplaces Fireplaces
## NeighborhoodNorthridge_Heights NeighborhoodNorthridge_Heights
## Overall_CondFair Overall_CondFair
## Heating_QCPoor Heating_QCPoor
## NeighborhoodCrawford NeighborhoodCrawford
## MS_ZoningResidential_Medium_Density MS_ZoningResidential_Medium_Density
## Kitchen_AbvGr Kitchen_AbvGr
## Bsmt_ExposureGd Bsmt_ExposureGd
## Bsmt_Full_Bath Bsmt_Full_Bath
## Garage_Area Garage_Area
## Beta_1se Persen_per_1_Unit Persen_per_1_SD
## Gr_Liv_Area 0.00026 0.026 14.34
## Year_Remod_Add 0.00251 0.251 5.33
## Total_Bsmt_SF 0.00011 0.011 4.88
## Garage_Cars 0.06012 6.197 4.69
## Year_Built 0.00149 0.149 4.60
## Fireplaces 0.06308 6.511 4.17
## NeighborhoodNorthridge_Heights 0.10476 11.044 2.38
## Overall_CondFair -0.16880 -15.532 -2.19
## Heating_QCPoor -0.81891 -55.909 -1.68
## NeighborhoodCrawford 0.08737 9.130 1.66
## MS_ZoningResidential_Medium_Density -0.04457 -4.359 -1.59
## Kitchen_AbvGr -0.07314 -7.053 -1.57
## Bsmt_ExposureGd 0.05173 5.309 1.55
## Bsmt_Full_Bath 0.02880 2.922 1.51
## Garage_Area 0.00007 0.007 1.48
# ==================================================
# 7A. PERBANDINGAN AKURASI DI DATA UJI & KOMPLEKSITAS
# ==================================================
# 1. Prediksi OLS menggunakan perkalian matriks
koef_ols <- coef(model_ols)
nama_kolom_ols <- names(koef_ols)[-1]
p_ols <- as.numeric(koef_ols[1] + X_uji[, nama_kolom_ols, drop = FALSE] %*% koef_ols[-1])
# 2. Prediksi GAM (menyamakan levels faktor uji persis dengan model_gam$xlevels)
uji_gam <- uji
for (v in names(model_gam$xlevels)) {
uji_gam[[v]] <- factor(uji_gam[[v]], levels = model_gam$xlevels[[v]])
}
p_gam <- as.numeric(predict(model_gam, newdata = uji_gam))
# 3. Prediksi Ridge & LASSO
p_ridge_min <- as.numeric(predict(cv_r, newx = X_uji, s = "lambda.min"))
p_ridge_1se <- as.numeric(predict(cv_r, newx = X_uji, s = "lambda.1se"))
p_lasso_min <- as.numeric(predict(cv_l, newx = X_uji, s = "lambda.min"))
p_lasso_1se <- as.numeric(predict(cv_l, newx = X_uji, s = "lambda.1se"))
# Evaluasi pada baris data uji yang valid di seluruh model (adil di baris uji yang sama)
baris_valid <- !is.na(p_gam)
rmse <- function(y_asli, y_pred) sqrt(mean((y_asli[baris_valid] - y_pred[baris_valid])^2))
mae <- function(y_asli, y_pred) mean(abs(y_asli[baris_valid] - y_pred[baris_valid]))
# Menghitung Effective Degrees of Freedom (EDF) Ridge lewat nilai singular (SVD)
d_svd <- svd(scale(X_latih))$d
df_ridge_min <- sum(d_svd^2 / (d_svd^2 + cv_r$lambda.min)) + 1
df_ridge_1se <- sum(d_svd^2 / (d_svd^2 + cv_r$lambda.1se)) + 1
# Tabel Perbandingan Lengkap
tabel_perbandingan <- data.frame(
Model = c(
"OLS (Baseline)",
"GAM (REML)",
"Ridge (lambda.min)",
"Ridge (lambda.1se)",
"LASSO (lambda.min)",
"LASSO (lambda.1se)"
),
RMSE_Uji = round(c(
rmse(y_uji, p_ols),
rmse(y_uji, p_gam),
rmse(y_uji, p_ridge_min),
rmse(y_uji, p_ridge_1se),
rmse(y_uji, p_lasso_min),
rmse(y_uji, p_lasso_1se)
), 4),
MAE_Uji = round(c(
mae(y_uji, p_ols),
mae(y_uji, p_gam),
mae(y_uji, p_ridge_min),
mae(y_uji, p_ridge_1se),
mae(y_uji, p_lasso_min),
mae(y_uji, p_lasso_1se)
), 4),
Variabel_Aktif = c(
paste0(length(prediktor_ols), " var"),
paste0(length(prediktor_ols), " var"),
paste0(length(prediktor_ols), " var"),
paste0(length(prediktor_ols), " var"),
paste0(length(aktif_min), " dummy aktif"),
paste0(length(aktif_1se), " dummy aktif")
),
EDF = round(c(
length(coef(model_ols)),
sum(model_gam$edf),
df_ridge_min,
df_ridge_1se,
length(aktif_min) + 1,
length(aktif_1se) + 1
), 1)
)
print(tabel_perbandingan)
## Model RMSE_Uji MAE_Uji Variabel_Aktif EDF
## 1 OLS (Baseline) 0.1524 0.0870 68 var 244.0
## 2 GAM (REML) 0.1446 0.0789 68 var 298.3
## 3 Ridge (lambda.min) 0.1428 0.0896 68 var 243.8
## 4 Ridge (lambda.1se) 0.1554 0.0983 68 var 243.3
## 5 LASSO (lambda.min) 0.1429 0.0858 132 dummy aktif 133.0
## 6 LASSO (lambda.1se) 0.1557 0.0967 55 dummy aktif 56.0
# ==================================================
# 7B. PEMERIKSAAN ASUMSI RESIDUAL MODEL TERPILIH
# ==================================================
res_terpilih <- residuals(model_gam)
fit_terpilih <- fitted(model_gam)
par(mfrow = c(2, 2))
# 1. Residual vs Prediksi (Homoskedastisitas & Linearitas sisa)
plot(fit_terpilih, res_terpilih,
pch = 20, col = rgb(0, 0, 0, 0.3),
xlab = "Fitted log(Sale_Price)", ylab = "Residual",
main = "Residual vs Fitted")
lines(lowess(fit_terpilih, res_terpilih), col = "orange", lwd = 2)
abline(h = 0, lty = 2)
# 2. Normal Q-Q Plot
qqnorm(res_terpilih, pch = 20, col = rgb(0, 0, 0, 0.3), main = "Normal Q-Q Plot")
qqline(res_terpilih, col = "orange", lwd = 2)
# 3. Residual vs Prediktor Utama (Gr_Liv_Area)
plot(latih$Gr_Liv_Area, res_terpilih,
pch = 20, col = rgb(0, 0, 0, 0.3),
xlab = "Gr_Liv_Area", ylab = "Residual",
main = "Residual vs Gr_Liv_Area")
lines(lowess(latih$Gr_Liv_Area, res_terpilih), col = "orange", lwd = 2)
abline(h = 0, lty = 2)
# 4. Varians Residual per Kelompok (Overall_Cond)
boxplot(res_terpilih ~ latih$Overall_Cond,
las = 2, col = "grey90",
xlab = "", ylab = "Residual",
main = "Residual per Overall_Cond")
abline(h = 0, lty = 2)
par(mfrow = c(1, 1))
# 5. Pemeriksaan Autokorelasi Spasial pada Koordinat Longitude & Latitude
ggplot(
data.frame(Longitude = latih$Longitude, Latitude = latih$Latitude, Residual = res_terpilih),
aes(x = Longitude, y = Latitude, color = Residual)
) +
geom_point(alpha = 0.65, size = 1.6) +
scale_color_gradient2(low = "#2166AC", mid = "grey90", high = "#B2182B", midpoint = 0) +
theme_minimal() +
labs(title = "Sebaran Spasial Residual Model Terpilih")