Etkileşimlerle tahminleri elle hesaplama
predict() fonksiyonunun nasıl çalıştığını anlamak için tahminleri yine elle hesaplama zamanı. Bu modelde hesaplanacak üç ayrı doğru var ve her birinde tahmin, bir sabit terim (intercept) artı sayısal açıklayıcı değerin bir katsayıyla (slope) çarpımından oluşuyor. Zor olan kısım, her durum için doğru sabit terimi ve doğru eğimi seçmek.
mdl_price_vs_both_inter ve explanatory_data hazır; dplyr ve tidyr yüklü.
Bu egzersiz
R'de Orta Düzey Regresyon
kursunun bir parçasıdırUygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
# Get the coefficients from mdl_price_vs_both_inter
coeffs <- ___
# Get the intercept for 0 to 15 year age group
intercept_0_15 <- ___
# Get the intercept for 15 to 30 year age group
intercept_15_30 <- ___
# Get the intercept for 30 to 45 year age group
intercept_30_45 <- ___
# Get the slope for 0 to 15 year age group
slope_0_15 <- ___
# Get the slope for 15 to 30 year age group
slope_15_30 <- ___
# Get the slope for 30 to 45 year age group
slope_30_45 <- ___