Certificate/data analytics-Google

[Sampling] population, representative sampling, process, simple, stratified, cluster, systematic, convenience, voluntary response, snowball, purposive, sampling distribution, bias, central limit theorem, standard error, proportion

Olivia-BlackCherry 2023. 7. 18. 09:29

목차

    모집단과 표본

    Population 모집단 

     

     Sampling 표본

    The process of selecting a subset of data from a population.

    출처: 구글

    1) 장점

    - 시간, 돈을 줄이고 실용적이다.

    ex) 만약 대한민국의 가정에서 몇프로의 컴퓨터가 있는지 구하고자한다면, 대한민국 전체 인구를 검사하는 것보다 일부만 샘플을 추출하여 통계를 내는 것이 시간, 돈을 줄일 수 있다.

     

    2) Representative sample

    Accurately reflects the characteristics of a population.

    샘플은 대표성을 띄어야 한다. 그 말은 즉, 추출된 샘플이 전체 모집단의 특징을 가지고 있어야 한다는 의미이다.

    좋은 샘플을 뽑지 못한다면, 데이터분석 자체가 신뢰도가 떨어진다. 

    ex) 대한민국 평균 키를 구하는 경우 추출된 표본이 운동선수에 한정되어 있다면, 그것은 모집단의 성질을 모두 반영하지 못하므로 대표성이 없다. 

     

     

    3) The sampling process

    1. Identify the target population 

    Target population is the complete set of elements that you're interested in knowing more about.

    대상 모집단은 내가 알고 싶어하는 정보가 담겨있는 요소의 전체 집단이다.

    이것은 general하다.

     

    2. select the sampling frame

    sample frame is A list of all the items in yout target population.

    샘플링 프레임은 타겟 모집단에서 취할 수 있는 아이템의 목록이다. 

    이것은 specific하다.

    sampling frame은 언제나 target population와 완전히 매치되지는 않는다.

     

    3. choose the sampling method

    probability vs non probability 중에 고른다. 

     

    4. determine the sample size

    The number of individuals or itmes chosen for a study or experiment.

    샘플 사이즈가 클 수록 확률이 정확해진다.

     

    5. Collect the sample data

     

     

     

    Sampling method

    1. probability sampling

    uses random selection to generate a sample

    1) Simple random sampling

    Every member of a population is selected ranomly and has an equal chance of being chosen

    단순 임의 추출

    + representative

    + avoid bias

     

    2) Stratified random sampling = strata 층화표집

    Divide population into groups and randomly select some members from each group to be in the sample.

     우선 그룹으로 나누고, 각 그룹에서 random하게 추출한다.

    ex) 1~10세 11~20세, 21~30세, 31~40세, 41~50세, 51~60세, 61~70세 등의 계층으로 나눔

    + members from each group are included

    - 데이터에 대한 사전 이해가 없다면 의미있는 그룹으로 나누는 것 자체가 어렵다. 

     

    3) Cluster random sampling 군집표집

    Divide a population into clusters, ranomly select certain clusters, and include all members from the chosen clusters in the sample.

     군집 안에 다양한 요소가 포함시켜, 여러 개의 군집으로 나누고 이 군집을 추출한다. 

    ex) 맥도날드가 고객 만족도 설문조사를 한다고 하면, 무작위로 4개의 지점만 클러스터로 선택하여 샘플링한다.

    +helpful when dealing with large and diverse populations that have clearly defined subgroups.

     

    4) Systematic random sampling 계통표집

    Put every member of a population into an ordered sequence. Then you choose a random starting point in the sequence and select members for your sample at regular intervals.

     순서를 정하고, n번째마다 샘플을 추출하는 것이다. 

    ex) 100명의 학생 중, 교문 앞을 나오는 학생들 중 4번째 학생부터 매번 14, 24, 34번째 학생을 샘플링한다.

    + Representative

    + Quick and convenient

     

     

    2. non-probability sampling

    Based on convenience or personal preference.

    Do not use random selection.

    1) Convenience sampling

    Choose members of a population that are easy to contact or reach.

     접근하기 쉬운 사람들을 샘플링한다. 

    ex) 나와 가까이 있는 길거리에 있는 사람들을 대상으로 한다.

    -----> Undercoverage bias를 유발함

    (When some members of a poopulation are inadequately represented in the sample)

     

    2) Voluntary response sampling

    Consists of members of a population who volunteer to participate in a study.

     자발적인 지원에 의한 샘플링이다.

    ex) 식당 방문 후, 자발적으로 온라인 평점을 매긴다.

    --------> Nonresponse bias를 유발함

    (When certain groups of people are less likely to provide response)

     

     

    3) Snowball sampling

    Researchers recruit initial participants to be in a study and then ask them to recruit other people to participate in the study.

     섭외에 섭외~

    ex) 만약 인근의 원자력 발전소에 다니는 전문가를 섭외한 후, 그 분에게 다른 지인을 섭외해달라하고, 그 다른 지인은 또 다른 사람을 섭외하는 식으로 표본을 모으는 방식

     

     

    4) Purposive sampling

    Researchers select participants based on the purpose of their study

    목적에 맞는 표본을 직접 구한다.

    ex) 학생 성장과 성격 발달에 관한 조사를 할 때, 관련 표본을 학교에서 근무한 중등교사로만 한정하는 것이다.

     

     

    Sampling Bias

    When a sample is not representative of the population as a whole

    샘플에 대표성이 없는 경우

     

     

    Statistic vs Parameter

     statistic: 표본의 성질

    ex) 추출된 100개의 나무의 평균키 

     parameter: 모집단의 성질

    ex) 전체 모집단 나무의 평균키

     

     

    Point estimate 점추정

    Uses a single value to estimate a population parameter

    하나의 값으로 전체 모집단의 값을 추정하는 것

     

     

    Sampling distributions 표본 분포

    A probability distribution of a sample statistic

     표본의 어떤 성질에 대한 확률 분포

    ex)mean에 관한 확률분포

    - Means

    - Proportions

     

     

    Sampling variabiliy

    How much an estimate varies between samples.

    ex) 팽귄 10000마리의 펭귄의 무게를 구한다. 

    10마리의 펭귄을 추출해보았더니 1번째 집단은 3kg, 2번째는 2.5kg, 3번째는 3.4kg였다.

    전체 10000마리의 평균 무게는 3인 걸 보면, 매 추출된 집단의 몸무게가 같지는 않고 다르다.  

     

     

    Standard Error

     sample variability가 다양할 수록, sample statistic은 모집단의 parameter와 덜 유사해진다. 

     샘플의 표본이 모집단의 값과 얼마나 차이가 있는지를 구하기 위해서 standard deviation 개념을 가져온다. 

     각각의 샘플 값이 더 많이 떨어져있을 수록, standard deviation은 크다. 

      표본 통계학에서는 이것을 standard error, 표준오차라고 부른다. 

    - Larger standard error= sample means are more spread out

    - Smaller standard error= sample means are closer together

     

    - As sample size gets larger, standard error gets smaller.

     

     

     

    Central Limit Theorem 중심극한이론

    The sampling distribution of the mean approaches a normal distribution as the sample size increases.

     표본의 개수를 늘리면, 모집단의 성질과 가까워진다. 

     표본의 평균의 분포가 표본의 개수가 많아지면, 종 모양을 그리는 정규분포와 가까워진다. 

      개수는?

    30개 이상이면 충분하다고 본다.

    - 어떤 분포의 모집단이라도 그 수가 30개 이상을 넘어가면, 정규분포와 가까워진다. 

    - 원래 모집단의 분포가 대략 종모양에 가까웠다면 조금만 샘플링 해도 샘플표본분포도 종모양에 가깝다.

     

     

    하루 동안 한 사람이 마시는 커피의 양을 구하고 싶음
    출처: 구글

     

     

     

    Population proportion

    The Percentage of individuals or elements in a population that share a certain characteristic.

    모집단에서 특정 성질에 대한 비율

     

     

    Sample distribution of the proportion 

     비율의 표본추출 분포

    ex) 10000명의 부산 학생이 있다. 

    여기서 100명의 학생씩 표본을 추출해서, 캔버스를 좋아하는 학생 비율을 구할 것이다. 

    실제 만명의 모집단에서는 10%의 학생이 좋아했다.

     

    A 샘플은 12% 

    B 샘플은 10%

    C 샘플은 12%

    D 샘플은 7%

    E 샘플은 9%

    F 샘플은 10%

    등등

    ---> 샘플의 개수가 많아질 수록 정규분포 곡선을 그린다. 

    ----> The more variability in your sample data, the less likely it is that the sample proportion is an accurate estimate of the population proportion. 

    -----> As sample size gets larger, standard error gets smaller.

     

     

    Python 

    - Scipy stats와 관련된 설명은 다음 시간에!!!