BaşlayınÜcretsiz Başlayın

Sonuçları görüntüleme

Bir model oluşturmanın son ve muhtemelen en önemli adımı, sonuçları paylaşmaktır.

Bu egzersizde, ilçe düzeyindeki tahminleri çıkaracak ve ggplot2 ile görselleştireceksin. Her ilçe için eğim tahminlerini elde etmek için, ilçe düzeyi rassal etki eğimlerini sabit etki eğimlerine eklemen gerekir.

Buna ek olarak, veriyi net görmek için kodda ilçeler suç oranına (eğim tahminleri) göre sıralanır.

Daha önce uyarladığın glmer_out modeli senin için yüklendi.

Bu egzersiz

R'da Hiyerarşik ve Karma Etkili Modeller

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Extract out the fixed-effect slope for Year2
Year2_slope <- fixef(___)['Year2']

# Extract out the random-effect slopes for county
county_slope <- ranef(___)$County

# Create a new column for the slope
county_slope$slope <- county_slope$Year2 + Year2_slope

# Use the row names to create a county name column
county_slope$county <- rownames(county_slope)

# Create an ordered county-level factor based upon slope values
county_slope$county_plot <- factor(county_slope$county, 
                                   levels = county_slope$county[order(county_slope$slope)])
Kodu Düzenle ve Çalıştır