반응형

 Doing Data Science 책을 공부하기에 통계학에 대한 지식이 부족함을 느껴 통계학 공부를 시작하고자 합니다.

(같이 공부할 수 있는 분이 있으면 좋으련만 스터디를 찾기가 쉽지가 않네요..혼자 공부하는 것 정말 쉽지 않은데 ㅠㅠㅠ)

일단 첫번째로 공부하고자 하는 것은 Coursera의 Introductions to Probability and Data라는 강의입니다.

 

 사용 교재로는 Openintro의 Statistics 책입니다. (무료이며 아래 링크에서 다운받을 수 있습니다.)

 

https://www.openintro.org/stat/textbook.php?stat_book=os

 

OpenIntro

 

www.openintro.org

책을 읽으면서 영어공부도 할 겸, 긴 공부가 될 것 같습니다.(1주일에 4시간 기준 7개월이네요..) 

 

1. Data Basics

Variables : 데이터를 구성하는 변수

1) Numerical : 숫자형 데이터

  1.1) Continuous : 연속형

  1.2) Discrete : 불연속형

2) Categorical : 범주형 데이터

  2.1) Regular Categorical : Ordinal이 아닌 경우

  2.2) Ordinal : 범주들 사이에 서열/순서가 존재하는 경우

 

2. Observational studies & Experiments

Studies

1. Observational : collect data in a way that does not directly interfere with how the data arise("observe")

  1.1) retrospective : uses past data

  1.2) prospective : data are collected throughout the study

2. Experiment : randomly assign subjects to treatments

 

Obsevational vs Experiment : 

 

  [꾸준히 공부를 하는 것]과 [성적]간의 관계를 파악하는 실험을 계획한다고 합시다. 

 

1) Observational : [꾸준히 공부를 하는 그룹] 과 [꾸준히 공부를 하지 않는 그룹] 을 선별하여 관찰한 뒤, 성적과의 관계를 관찰합니다. 이 결과는 다른 변수들을 고려하지 않기 때문에 [꾸준히 공부를 하는 것] 과 [성적] 간의 직접적인 관계를 설명하는데 적절하지 않을 수 있습니다.

 

2) Experiment : Random Sampling을 통해 적절한 크기의 표본을 선출합니다.(ex: 100명의 Random한 사람, 인구/연령/성별 고려 x) 이 표본을 [꾸준히 공부하는 그룹]과 [꾸준히 공부를 하지 않는 그룹] 두 영역으로 나눈 뒤, [성적]과의 관계를 관찰합니다. 이 경우에는 다른 변수들을 적절히 섞어주었기 때문에, [꾸준히 공부를 하는 것]과 [성적]관의 관계를 파악해볼 수 있습니다. 

 

=> Observational Study는 상관관계만을 파악할 수 있는 반면, Experiment는 인과관계를 파악할 수 있습니다.

 

3. Sampling & Sources of bias

1. 전수조사(census) :

전수조사가 좋지 않은 이유: 

1.1) 전수조사에 걸리지 않는 사람들이 있을 수 있습니다.(Illegal Immegrants)

1.2) 인구는 언제나 변하므로 완벽한 전수조사란 있을 수 없습니다.

2) 표본조사(sampling) : representitive sample

 

2. a few sources of sampling bias(편향) : 

1) Convenience sample : 쉽게 접근이 가능하여 특정 집단이 표본에 포함될 가능성이 높은 경우 

ex) 동네 사람들

2) Non - response : 모수의 특정 집단만이 표본에 포함되는 경우

ex) 가난한 사람들은 설문에 접근, 응답할 확률이 매우 낮다.

3) Voluntary response : 특정 집단이 자발적으로 설문에 참여하는 경우

ex) CNN 사이트에서 하는 기습 서베이 : CNN에 특정 시간에 접속하는 사람들은 대상으로 하므로 전체 모수에 대한 유의미한 결과를 내포하기 어렵다.

 

편향의 예 : 1936년도 미국 대선을 앞두고 한 매체에서 대대적인 설문조사를 벌였다. 표본은 240만명의 사람들이었으며, 공화당 대표가 승리할 것으로 예측하였다. 하지만 실제 투표에서는 민주당 후보가 62%의 득표율을 기록하며 승리하였고, 현재 이 설문조사는 편향된 표본의 대표적인 예로 인용되고 있다. 실제로 이 조사의 대상은 대부분 상류층(전화 소지자, 차량 소지자)였고, 이 시기가 대공황이었다는 점이 간과되었다. 이 매체는 이후 폐간되었다고 한다.

 

3. Sampling Methods

3.1) Simple random sample(단순임의추출법) : each case is equally likely to be selected

3.2) Cluster Sample(군집추출법) : divide the population clusters, randomly sample a few clusters, then sample all observations within these clusters

3.3) Stratified sample(층화추출법) : divide the population into homogenous strata, then randomly sample from within each stratum

3.4) multistage sample : divide the population clusters, randomly sample a few clusters, then randomly sample within these clusters.(Cluster Sample + Simple Random Sample)

 

4. Experimental Design

1. Principles of Experimental Design

1.1) Control : compare treatment of interest to a control group

1.2) randomly assign subjects to treatments

1.3) replicate : collect a sufficiently large sample, or replicate the entire study

1.4) block : block for variables known or suspected to affect the outcome

 

explanatory variables(factors) : conditions we can impose on experimental units

blocking variables : characteristics that the experimental units come with, that we would like to control for

respose variable : outcome   

 

* placebo : fake treatment

* blinding : experimental units don't know which group they're in

* double-blind : both the experimental units and the researchers don't know the group assignment

 

5. Random Sample Assignment

1. Random Sampling : Each subject in the population is equally likely to be selected, and the resulting sample is likely representative of the population. Subjects are selected for a study.

2. Random Assignment : occurs only in experimental settings, where subjucts are being assigned to various treatments. samples exhibit slightly different characteristics from one another. Through random assginment, we ensure that these different characteristics are represented equally in the treatment and control groups. 

=> Random assignment allows us to make causal conclusions based on the study.

 

*Confounding Variable(Confounder) : 설명 변수 외에 실험에 영향을 미칠 수 있는 변수들, sample assignment에서는 해당 변수들을 적절하게 배분한다.

1. Random Assignment + Random Sampling : 실험을 통해 인과관계를 파악할 수 있고 결과를 일반화할 수 있다. 하지만 완벽한 실험은 설계 및 시행이 매우 어렵다.(특히 대상이 인간이라면)

2. Random Assignment + No Random Sampling : 위의 실험 방법이 실현가능성이 매우 낮으므로, 대학이나 연구기관에서 설문조사 대상을 모집하는 것이다. 이 방법은 Random sampling은 아니지만, Random Assignment를 실행한 경우이다. 이 경우에는 실험을 통해 인과관계를 파악할 수 있지만, 이 인과관계는 설문조사한 집단에만 적용이 가능하며, 일반화될 수 없다.

3. No Random Assignment + Random Sampling : 우리가 일반적으로 수행하는 Observational Study이다. 변수간의 상관관계를 파악할 수 있고, 일반화될 수 있다.

4. No Random Assignment + No Random Sampling : Unideal Observational Study로, 실험을 통해 알아낸 변수들의 상관관계가 일반화될 수 없다. (샘플 집단에만 적용 가능)

 

6. R Assignment

*piping(%>%) : Operator의 한 종류합니다.

?(function name) :  함수에 대한 정보를 Display합니다.

 

* Error

  R Studio에서 devtools 패키지를 설치하는 과정에서 오류가 발생했습니다. callr과 관련된 업데이트 메시지였는데요, 구글링을 통해 여러가지 방법을 시험해본 결과 Rtools를 업데이트 하면 해결되는 것을 확인했습니다. 아래 사이트에서 recommended 버전(Rtools35)를 다운받아 설치하시면 됩니다.

반응형

+ Recent posts