1. Soal no 1 (Incidence Rate)
# Variabel
kasus_baru <- 8
total_person_time <- 1000

# Perhitungan
incidence_rate <- (kasus_baru / total_person_time) * 1000
cat("Incidence Rate Penyakit X adalah:", incidence_rate, "per 1.000 person-years.")
## Incidence Rate Penyakit X adalah: 8 per 1.000 person-years.
  1. Soal no 2 (Cumulative Incidence)
# Variabel
kasus_baru_hipertensi <- 25
populasi_awal <- 500

# Perhitungan
cumulative_incidence <- kasus_baru_hipertensi / populasi_awal
cat("Cumulative Incidence (Risiko) Hipertensi adalah:", cumulative_incidence)
## Cumulative Incidence (Risiko) Hipertensi adalah: 0.05
  1. Soal no 3 (Prevalensi)
# Variabel
penderita_diabetes <- 400
total_populasi <- 20000

# Perhitungan
prevalensi_diabetes <- penderita_diabetes / total_populasi
cat("Prevalensi Diabetes di kota tersebut adalah:", prevalensi_diabetes, "atau", prevalensi_diabetes * 100, "%")
## Prevalensi Diabetes di kota tersebut adalah: 0.02 atau 2 %
  1. Soal no 4 (CI, RR, AR)
# Data
perokok_sakit <- 40
perokok_sehat <- 260
bukan_perokok_sakit <- 15
bukan_perokok_sehat <- 285

total_perokok <- perokok_sakit + perokok_sehat
total_bukan_perokok <- bukan_perokok_sakit + bukan_perokok_sehat

# Perhitungan CI
ci_perokok <- perokok_sakit / total_perokok
ci_bukan_perokok <- bukan_perokok_sakit / total_bukan_perokok

# Perhitungan RR
relative_risk <- ci_perokok / ci_bukan_perokok

# Perhitungan AR
attributable_risk <- ci_perokok - ci_bukan_perokok

cat("Relative Risk (RR):", relative_risk, "\n")
## Relative Risk (RR): 2.666667
cat("Attributable Risk (AR):", attributable_risk)
## Attributable Risk (AR): 0.08333333
  1. Soal no 5 (Odds Ratio)
# Data
a <- 45
b <- 30
c <- 20
d <- 55

# Perhitungan
odds_ratio <- (a * d) / (b * c)
cat("Odds Ratio (OR) adalah:", odds_ratio)
## Odds Ratio (OR) adalah: 4.125
  1. Soal no 6 (CFR)
# Variabel
jumlah_kematian <- 10
total_kasus <- 250

# Perhitungan
cfr <- (jumlah_kematian / total_kasus) * 100
cat("Case Fatality Rate (CFR) adalah:", cfr, "%")
## Case Fatality Rate (CFR) adalah: 4 %