MulaiMulai sekarang secara gratis

Using t.test()

Manually calculating test statistics and transforming them with a CDF to get a p-value is a lot of effort to do every time you need to compare two sample means. The comparison of two sample means is called a t-test, and R has a t.test() function to accomplish it. This function provides some flexibility in how you perform the test.

As in the previous exercise, you'll explore the difference between the proportion of county-level votes for the Democratic candidate in 2012 and 2016.

sample_dem_data is available, and has columns diff, dem_percent_12, and dem_percent_16.

Latihan ini adalah bagian dari kursus

Hypothesis Testing in R

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Conduct a t-test on diff
test_results <- ___

# See the results
test_results
Edit dan Jalankan Kode