Statistics with Python 统计学理论

目录

    • 前言
    • Probability sampling
    • Non-probability sampling:
    • 使数据有效的方法
    • 样本分布

前言

本文帮你梳理了高中数学统计的进阶版知识(真的只是稍难一点),帮你了解python处理数据时,部分方法背后的原理。

Probability sampling

1.Inferential statistics 推论
从总体中抽取样本数据,对总体进行预测。

  • Hypothesis Testing: This involves formulating a hypothesis about a population parameter and using sample data to assess the validity of the hypothesis. Common methods include t-tests, chi-square tests, and ANOVA.
  • Confidence Intervals: Provide a range of values within which a population parameter is likely to fall.
  • Regression Analysis: Regression analysis explores the relationship between one or more independent variables and a dependent variable.
  • Analysis of Variance (ANOVA): ANOVA is a statistical method used to analyze the differences among group means in a sample. It is often employed to compare means across multiple groups.
    Probability Distributions: Probability distributions, such as the normal distribution, play a crucial role in inferential statistics.
    -**Sampling Distributions:The Central Limit Theorem is a key concept related to sampling distributions.

2.随机抽样 Select random Samples
all possible samples are equally likely
Larger complex samples.
key features:

  • 分层:Population divided into different strata, and part of sample is allocated to each stratum; -, ensures sample representation from each stratum, and reduces variance of survey estimates (stratification)
  • 聚类:Clusters of population units (e-g., counties) are randomly sampled first (with known probability) within strata, to save costs of data collection (collect data from cases close to each other geographically)(如果你想调查各国人,你可以直接去移民国家比如美国,这样省事儿)
  • 简单随机样本是概率样本的一种形式。其中每个个体被选中的概率相等。只要出现random select就都是probability。
  • 样本大小不会影响为什么简单随机抽样可能无法代表整个美国成年人的观点。

Non-probability sampling:

samples are not based on a known probability. (Challenging or impractical).
(1)预判在前;(2)看运气调查。

  • Convenience Sampling: In convenience sampling, individuals or elements are selected based on their == easy accessibility or availability == . (lead to a biased sample)
  • Purposive Sampling: Selecting individuals or elements based on == specific characteristics or qualities == that are relevant to the research objectives.
  • Snowball Sampling: Snowball sampling starts with an initial set of participants, and then those participants refer or introduce the researcher to additional potential participants. This method is often used when the population is hard to reach. 别人介绍
  • Quota(配额) Sampling: Quota sampling involves dividing the population into subgroups (strata) based on certain characteristics and then setting quotas for each subgroup. Participants are then conveniently selected to meet these quotas.
  • Judgmental Sampling: the researcher uses their judgment or expertise to select individuals who are believed to be representative of the population. This method relies heavily on the researcher’s ==subjective == judgment.

使数据有效的方法

1.Pseudo-Randomization 伪随机化
在实验或研究中模拟随机分配的方法,而实际上并没有真正的随机性。这种方法通常是通过某种规则或算法来分配研究对象到不同的处理组,而不是使用真正的随机过程。

  • 举例:
    • 系统随机化。在系统随机化中,研究对象根据某些事先确定的规则或系统性方法进行分组,而不是通过纯随机的过程。例如,按照入组时间的先后顺序或按照某种特定的特征进行分组。
    • 利用计算机算法生成伪随机数进行分组。虽然计算机生成的随机数实际上是确定性的,但在某些情况下,可以通过使用良好设计的伪随机数生成器来达到类似随机的效果。

2.Calibration 校准
通常是指调整样本或抽样方法,使其更准确地反映总体。
(1) 配额抽样(Quota Sampling):

  • 说明: 配额抽样是一种非概率抽样方法,其中样本的特定属性按照总体中的预定比例进行配额。
  • 校准: 如果样本的某些属性未能正确反映总体的分布,研究者可以通过调整配额来校准样本,以更好地代表总体。

(2) 初始抽样后的重新加权(Re-weighting After Initial Sampling):

  • 说明: 在非概率抽样中,初始样本可能并不完全代表总体,但可以通过重新加权样本来进行校准。
  • 校准: 研究者可以为样本中的个体分配权重,以调整其在分析中的影响,使其更符合总体的特征。

(3) 改进抽样框架(Improving the Sampling Frame):

  • 说明: 抽样框架是指用于选择样本的总体列表。在非概率抽样中,如果抽样框架不完整或有偏差,可以通过改进框架来校准样本。
  • 校准: 更新或修正抽样框架,以更全面地反映总体,并提高样本的代表性。

3. 限制:

  • 如果权重因子与研究中关心的变量无关,那么该方法可能无法减轻潜在的抽样偏差。

样本分布

1.Sampling Theory (抽样理论)

  • 定义: 抽样理论是研究如何从总体中选择样本以便对总体进行统计推断的理论。它关注的是从大的总体中选取部分个体(样本)以获取有关总体特征的信息。
  • 目的: 确保样本的选择是具有代表性的,从而使得通过对样本的研究能够推断关于整个总体的性质。

2.Sampling Distributions (抽样分布)

  • 定义: 抽样分布是统计量(如均值、方差等)在多次重复抽样中可能取得的所有可能值的分布。它关注的是统计量在多个样本中的变异性。
  • 目的: 允许我们在进行统计推断时考虑抽样误差。
  1. Simpson’s Paradox(辛普森悖论)
  • 在不同子群体中观察到的趋势与观察总体时的趋势相反。这种悖论的出现通常与变量之间的相互影响和不平衡的子群体大小有关。
  • 举例:入学考试的性别歧视。在某个大学招生中,男生和女生的整体录取率可能呈现出性别歧视的趋势,但如果按照各专业细分进行分析,可能发现在每个专业中,男生和女生的录取率可能是相对平等甚至相反的。这是因为专业之间的录取标准或申请人的特征可能存在较大差异,从而导致整体趋势与各专业趋势相矛盾。