开始使用免费开始使用

可视化适配度检验

卡方适配度检验用于将分类变量各水平的样本比例与假设值进行比较。在运行检验之前,先将样本分布与假设分布进行可视化对比会很有帮助。

回想 late_shipments 数据集中的供应商国际贸易术语(incoterms)。我们来假设在全部发货中,四种取值的频率如下。

  • EXW:0.75
  • CIP:0.05
  • DDP:0.1
  • FCA:0.1

已提供 late_shipments,并已加载 tibbledplyrggplot2infer

本练习是课程的一部分

R 中的假设检验

查看课程

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Using late_shipments, count the vendor incoterms
vendor_inco_term_counts <- ___


# Get the number of rows in the whole sample
n_total <- ___

hypothesized <- tribble(
  ~ vendor_inco_term, ~ prop,
  "EXW", 0.75,
  "CIP", 0.05,
  "DDP", 0.1,
  "FCA", 0.1
) %>%
  # Add a column of hypothesized counts for the incoterms
  ___

# See the results
hypothesized
编辑并运行代码