d <- read.csv('https://stats.dip.jp/01_ds/data/real_estate_price.csv')[,-1]
library(DT)
datatable(d)
library(psych)
pairs.panels(d)

library(ggcorrplot)
## 要求されたパッケージ ggplot2 をロード中です
## 
## 次のパッケージを付け加えます: 'ggplot2'
## 以下のオブジェクトは 'package:psych' からマスクされています:
## 
##     %+%, alpha
library(plotly)
## 
## 次のパッケージを付け加えます: 'plotly'
## 以下のオブジェクトは 'package:ggplot2' からマスクされています:
## 
##     last_plot
## 以下のオブジェクトは 'package:stats' からマスクされています:
## 
##     filter
## 以下のオブジェクトは 'package:graphics' からマスクされています:
## 
##     layout
cor(d) |> ggcorrplot(lab = T, hc.order = T, outline.color ='lightgreen', p.mat = cor_pmat(d)) |> ggplotly() |>
layout(font  = list(size = 11, color = rainbow(10), family = 'UD Digi Kyokasho NK-R'),
       title = 'real-estate-price',
       xaxis = list(title = 'x軸カテゴリラベル'),
       yaxis = list(title = 'y軸カテゴリラベル'))
fit <- lm(price ~ lat+yrs_old+yr+m_sta+nstores+lon, data = d)
library(sjPlot)
## Install package "strengejacke" from GitHub (`devtools::install_github("strengejacke/strengejacke")`) to load all sj-packages at once!
tab_model(fit, show.stat = T, show.aic = T)
  price
Predictors Estimates CI Statistic p
(Intercept) -9859.50 -22341.02 – 2622.02 -1.55 0.121
lat 234.47 147.00 – 321.94 5.27 <0.001
yrs old -0.27 -0.35 – -0.20 -7.11 <0.001
yr 2.94 1.07 – 4.81 3.09 0.002
m sta -0.00 -0.01 – -0.00 -6.10 <0.001
nstores 1.16 0.79 – 1.53 6.17 <0.001
lon -15.34 -111.08 – 80.40 -0.31 0.753
Observations 414
R2 / R2 adjusted 0.581 / 0.575
AIC 2991.283
plot_model(fit, show.values = T, show.intercept = T, width = 0.1)

plot(fit)