Bu haftaki konumuz “Lojistik Regresyon”
Bu derse ilişkin yapılacak görevler bu hafta içerisinde yetiştirilememiştir. En kısa zamanda Rpubs’ı güncelleyerek ekleyeceğim hocam. Şimdiden anlayışınız için teşekkür ederim.
library(readr)
heart_transplant <- read_csv("heart_transplant.csv")
## Rows: 103 Columns: 8
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): survived, prior, transplant
## dbl (5): id, acceptyear, age, survtime, wait
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
View(heart_transplant)
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.5.3
ggplot(data = heart_transplant, aes(x = age, y = survived)) +
geom_jitter(width = 0, height = 0.05, alpha = 0.5)
glm(formula = survived=="alive" ~ age, family = binomial, data = heart_transplant)
##
## Call: glm(formula = survived == "alive" ~ age, family = binomial, data = heart_transplant)
##
## Coefficients:
## (Intercept) age
## 1.56438 -0.05847
##
## Degrees of Freedom: 102 Total (i.e. Null); 101 Residual
## Null Deviance: 120.5
## Residual Deviance: 113.7 AIC: 117.7
cheney <- data.frame(age=71, transplant="treatment")
cheney
## age transplant
## 1 71 treatment
library(“broom”) augment(mod, newdata=cheney, type.predict=“response”)
library(pscl) pR2(mod)