開始使用免費開始

卡方檢定輸出

在第 3 章中,你已經對 sexagecat 進行過 chisq.test()。在這個練習中,你會再次執行檢定,將輸出儲存為 cssexage,然後顯示輸出清單物件中的指定元素。

已為你載入 abaloneKeep 資料集與 dplyr 套件。

本練習屬於課程

給 SAS 使用者的 R

檢視課程

練習說明

  • abaloneKeep 中依年齡類別分組的性別雙向次數表,用 table() 產生並儲存為 tablesexage
  • tablesexage 執行 chisq.test(),並將輸出儲存為 cssexage
  • 顯示 cssexage 輸出中的 expected 值與 p.value

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Create frequency table of sex by agecat
tablesexage <- ___ %>% 
  with(___)

# Chi-square test using tablesexage
cssexage <- ___

# Display expected values and p.value from cssexage
___
___
編輯並執行程式碼