Relative Risk for Poisson Regression
Target(\(y\))이 이산형(Discrete)로 셀 수 있는 Count Data일 때 사용
관심있는 모수(Parameter) : \(y\)의 평균 \(\lambda_{i}=E(y_{i})\) \[\begin{align*} y_{i} &\thicksim Poisson(\lambda_{i}), \;\; \lambda_{i} = E(y_{i})\\ \eta_{i} &= \log{\lambda_{i}} = \beta_{0}+ \sum_{j} \beta_{j}x_{ji}\\ \beta_{j} &\thicksim Normal \end{align*}\]
\(\exp(\beta_{0})\)
\(\exp(\beta_{j})\)
실제로 \(y\)의 평균 보다 "Rate"
or "Relative Risk"
에 더 관심있으며, Poisson Regression의 목적은 Relative Risk을 추정하는 것
이다. 왜냐하면 단순히 “수”로는 어느 게 크고 작은지 또는 높고 낮은지 정확하게 판단할 수 있는 기준이 없기 때문이다.
\[\begin{align*} y_{i} &\thicksim Poisson(\lambda_{i}), \;\; \lambda_{i} = E_{i}\rho_{i}\\ \eta_{i} &= \log{\rho_{i}}= \log{\frac{\lambda_{i}}{E_{i}}} = \beta_{0}+ \sum_{j} \beta_{j}x_{ji}\\ \beta_{j} &\thicksim Normal \end{align*}\]
"Rate"
or "Relative Risk"
"Rate"
or "Relative Risk"
의 변화"Rate"
or "Relative Risk"
의 변화pacman::p_load("maptools", # For readShapePoly
"spdep", # For poly2nb
"dplyr",
"ggplot2",
"RColorBrewer", # For brewer.pal
"INLA")
dat.2019 <- read.csv("2019_crime.csv",header=T)
# Convert rows in the order of ESPI_PK
dat.2019 <- dat.2019[order(dat.2019$ESRI_PK),]
head(dat.2019)
ESRI_PK year district rape pop_total pop_femal sec_fac
10 0 2019 도봉구 90 335631 171670 10
12 1 2019 은평구 194 484546 251186 22
6 2 2019 동대문구 168 363023 184533 21
20 3 2019 동작구 251 408912 211206 18
18 4 2019 금천구 153 251820 122866 13
17 5 2019 구로구 226 439371 219769 17
safe_return_use
10 12602
12 10145
6 20776
20 18766
18 17946
17 15233
seoul.map <- maptools::readShapePoly("./TL_SCCO_SIG_W_SHP/TL_SCCO_SIG_W.shp") # Call .shp file
seoul.nb <- poly2nb(seoul.map) # Builds a neighbours list based on regions with contiguous boundaries
seoul.listw <- nb2listw(seoul.nb) # Supplements a neighbours list with spatial weights for the chosen coding scheme
seoul.mat <- nb2mat(seoul.nb) # Generates a weights matrix for a neighbours list with spatial weights for the chosen coding scheme
# Object of class "nb"
\[\begin{align*} \hat{\rho} = \frac{y_{i}}{E_{i}} = \frac{y_{i}/n_{i}}{\sum y_{i}/ \sum n_{i}} \end{align*}\]
Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".