시계열 데이터 전처리에 있어 핵심적인 역할을 하는데, 시계열 데이터 분석은 시간의 흐름에 따른 패턴을 찾는 과정이기 때문에, 날짜와 시간을 다루는 것은 필수적입니다.
datetime 모듈은 다음과 같은 주요 클래스를 제공합니다.
datetime.datetime:
날짜와 시간을 모두 포함하는 클래스입니다. 특정 날짜와 시간을 생성하고, 두 datetime 객체 간의 차이를 계산하거나, 날짜와 시간을 포맷팅하는데 사용됩니다.
datetime.date:
날짜만을 포함하는 클래스입니다. 연도, 월, 일 정보를 다루며, 날짜 간의 차이를 계산할 수 있습니다.
datetime.time:
시간만을 포함하는 클래스입니다. 시, 분, 초, 마이크로초 정보를 다룹니다.
datetime.timedelta:
두 datetime 객체 간의 차이를 나타내는 클래스입니다. 시간 간격을 계산하고, 날짜와 시간에 간격을 더하거나 뺄 수 있습니다.
문자열을 datetime 객체로 변환: 데이터셋에서 날짜와 시간이 문자열로 저장된 경우, 이를 datetime 객체로 변환하여 다양한 시간 연산을 수행할 수 있습니다.
시간 간격 계산: 두 사건 사이의 시간 간격을 계산하여 분석에 활용할 수 있습니다.
날짜/시간 정규화: 날짜와 시간을 표준 형식으로 변환하여 일관된 데이터 처리를 할 수 있습니다.
특정 시점 추출: 월말, 분기말 등의 특정 시점을 추출하여 분석할 수 있습니다.
시간 기반 특성 생성: 요일, 월, 분기 등의 시간 기반 특성을 생성하여 모델링에 활용할 수 있습니다.
적용
현재 날짜와 시간 가져오기
now = datetime.now()
time delta 클래스를 이용한 날짜 연산
future_date = now + timedelta(days=100)
timedelta 클래스는 기간을 표현하며, 날짜나 시간에 더하거나 빼는 연산에 사용됩니다. 예를 들어, 100일 후의 날짜를 계산하려면 timedelta(days = 100)를 현재 날짜에 더해주면 됩니다.
날짜만 추출
future_data_only = future_date.date()
경우에 따라 시간 부분을 제외하고 날짜만 필요할 수 있습니다. 이때는 datetime객체의 .date() 메서드를 사용하여 날짜 부분만 추출할 수 있습니다.
시간 차이 측정
from datetime import datetime, timedelta
# 현재 날짜와 시간
now = datetime.now()
# 100일 뒤의 날짜 계산
n_days = 100
future_date = now + timedelta(days = n_days)
# 두 날짜 사이의 차이 계산
time_diff = future_date - now
print(f"{n_days}일 뒤까지의 시간 차이: {time_diff}")
# 시간 단위로 변환
hours_diff = time_diff.total_seconds() / 3600
print(f"시간 차이 (시간 단위로): {hours_diff:.2f} 시간")
# 과거 날짜 계산 (예: 어제)
yesterday = now - timedelta(days = 1)
print(f"어제 날짜와 시간: {yesterday}")
timedelta객체를 사용하여 미래 날짜를 계산하려면, 현재 날짜에timedelta(days=n_days)를 더해줍니다.
두 날짜의 차이를 계산할 때는datetime객체끼리의 뺄셈을 사용합니다. 이로 인해 또 다른timedelta객체가 생성됩니다.
timedelta객체의 전체 초(second)를 계산하려면total_seconds()메서드를 사용하고, 이를 시간 단위로 변환하려면 3600으로 나눕니다. total_seconds(): 전체 시간을 초 단위로 반환
과거 날짜를 계산하려면 현재 날짜에서timedelta(days=1)을 빼줍니다. days: 일 단위 차이 seconds: 초 단위 차이(일 단위를 제외한 초) microseconds: 마이크로초 단위 차이(초 단위를 제외한 마이크로초)
datetime의 date 클래스 생성과 날짜 비교
from datetime import date
# 오늘 날짜 가져오기
today = date.today()
print(f"오늘 날짜: {today}")
# 특정 날짜 설정
special_day = date(2024, 12, 25)
print(f"특별한 날: {special_day}")
# 날짜 비교
if today < special_day:
print("특별한 날이 아직 오지 않았습니다.")
elif today == special_day:
print("오늘은 특별한 날입니다!")
else:
print("특별한 날이 지났습니다.")
특정 날짜를 설정할 때date(연도, 월, 일)형태로 작성합니다. 예를 들어,special_day = date(2024, 12, 25)와 같이 설정합니다.
datetime의 time 클래스 생성과 시간 비교
from datetime import datetime, time
# 현재 시간 가져오기
now = datetime.now()
current_time = now.time()
print(f"현재 시간: {current_time}")
# 특정 시간 설정
start_time = time(9, 0)
end_time = time(17, 0)
print(f"업무 시작 시간: {start_time}, 종료 시간: {end_time}")
# 시간 비교
if start_time <= current_time <= end_time:
print("현재는 업무 시간입니다.")
else:
print("현재는 업무 시간이 아닙니다.")
특정 시간을 설정하려면time(시, 분)형태로 작성합니다. 예를 들어,start_time = time(9, 0)과end_time = time(17, 0)를 설정합니다.
datetime의 date와 time 결합하여 datetime 생성
from datetime import datetime, date, time
# 특정 날짜와 시간 설정
meeting_date = date(2024, 1, 15)
meeting_time = time(14, 30)
# 날짜와 시간을 결합하여 datetime 객체 생성
meeting_datetime = datetime.combine(meeting_date, meeting_time)
print(f"회의 일시: {meeting_datetime}")
datetime 객체를 생성하기 위해 datetime.combine() 메서드를 사용합니다. 이 메서드는 특정 날짜(date 객체)와 시간(time 객체)를 결합하여 datetime 객체를 만듭니다.
날짜 포맷팅: strftime을 활용한 날짜 및 시간 형식 지정
from datetime import datetime
# 현재 시간 얻기
now = datetime.now()
# 기본 포맷으로 출력 (예시: 2024-08-07 05:40:28)
basic_format = now.strftime('%Y-%m-%d %H:%M:%S')
print(f"기본 포맷: {basic_format}")
# 한글 포맷으로 출력 (예시: 2024년 08월 07일 05시 40분 28초)
korean_format = now.strftime('%Y년 %m월 %d일 %H시 %M분 %S초')
print(f"한글 포맷: {korean_format}")
# 날짜만 출력 (예시: 2024/08/07)
date_only_format = now.strftime('%Y/%m/%d')
print(f"날짜만: {date_only_format}")
# 12시간제 시간만 출력 (예시: 05:40 AM)
time_12h_format = now.strftime('%I:%M %p')
print(f"12시간제 시간만: {time_12h_format}")
# 요일과 월 이름 포함 포맷 (예시: Wednesday, 07 August 2024)
weekday_month_format = now.strftime('%A, %d %B %Y')
print(f"요일과 월 이름 포함 포맷: {weekday_month_format}")
# ISO 8601 표준 포맷 (예시: 2024-08-07T05:40:28)
iso_format_basic = now.strftime('%Y-%m-%dT%H:%M:%S')
print(f"ISO 8601 표준 포맷 (기본): {iso_format_basic}")
# ISO 8601 표준 포맷 (예시: 2024-08-07T05:40:28+0900)
# 시간대 포함
iso_format_with_timezone = now.strftime('%Y-%m-%dT%H:%M:%S%z')
print(f"ISO 8601 표준 포맷 (시간대 포함): {iso_format_with_timezone}")
strftime 메서드는 datetime 객체를 특정 형식의 문자열로 변환하는 강력한 도구입니다. 이 메서드를 사용하면 날짜와 시간을 다양한 형식으로 포맷팅할 수 있어, 보고서 작성, 데이터 시각화, 로그 기록 등에서 유용하게 활용할 수 있습니다.
input이 만약에 여러 개면 Mutiple linear regression이라고 하는데 이 부분은 다음 포스팅 때 다뤄보도록 하겠습니다.
단순선형회귀는 독립변수 하나와 종속변수의 관계를 관측할 수 있게 해주는 설명력이 높은 통계적 방법입니다.
회귀분석의 첫 단추를 끼우는 만큼 단순선형회귀에 대해 제가 배운 내용을 바탕으로 설명을 해보겠습니다.
Simple linear regression model
The response variable $Y$ 와 the predictor variable $X$ 는 $$ Y = \beta_0 + \beta_1X + \epsilon $$, where $\epsilon$ is a random error with $E(\epsilon) = 0$. (Population 수준의 모델)
Simple regression model with the observed data
Observation Number
Response Variable $Y$
Predictor $X$
1
$y_1$
$x_1$
2
$y_2$
$x_2$
. . . .
. . . .
. . . .
n
$y_n$
$x_n$
The regression model for the observed data is $$ y_i = \beta_0 +\beta_1x_i + \epsilon_i, i = 1, 2, ...., n$$, where $\epsilon_i$ represents the error in $y_i$.
Parameter estimation
To estimate the unknown regression coefficients, $\beta_0$ and $\beta_1$, the ordinary least squares(OLS) method is commonly used.
From the regression model, we can write $$\epsilon_i = y_i - \beta_0 - \beta_1x_i, i = 1, 2,.... , n.$$
We estimate $\beta_0$ and $\beta_1$ by minimizing $$ S(\beta_0, \beta_1) = \displaystyle\sum_{i=1}^{n}{(y_i - \beta_0 - \beta_1x_1)^2}$$ >> 가장 오른쪽에 있는 식은 Convex function이어서 미분 최솟값 구하면 됩니다.
우리가 parameter 값을 구하고 싶은데, 현실은 observed data의 X와 Y값 만을 알고 있는 상태입니다.
그렇기 때문에 우리는 parameter 값을 추정하는 겁니다. 실제 X값과 Y값을 통해 구할 수 있는데,
추정은 다음과 같은 식을 통해 구할 수 있습니다.
OLS estimate
It can be shown that the estimates of \beta_0 and \beta_1 that minimize $S(\beta_0, \beta_1)$ are given by $$\hat{\beta_1} = \frac{\sum_{i = 1}^{n}{(y_i - \overline{y})(x_i - \overline{x})}}{\sum_{i = 1}^{n}{(x_i - \overline{x})^2}}$$ and $$ \hat{\beta_0} = \overline{y} - \hat{\beta_1}\overline{x}$$
이렇게 하여 $\hat{\beta_0}$ 과 $\hat{\beta_1}$을 구할 수 있는데,
여기서 $\hat{}$ 을 취한 이유는 True 값(추정치가 아닌 값)을 모르고 추정치만 알고 있어서 $\hat{}$을 취했습니다.
Fitted values
The OLS regression line is obtained as $$ \hat{Y} = \hat{\beta_0} + \hat{\beta_1}X $$.
The $i$-th fitted value is given by $$ \hat{y_i} = \hat{\beta_0} + \hat{\beta_1}x_i, i = 1, 2, ..., n$$.
Example.
이렇게 fitted 했다면 해석은 어떻게 해야 하는지 궁금할 수 있을 것 같은데요...
그런데 그 전에 $ Y = \beta_0 + \beta_1X + \epsilon $ 이 식 양변에 평균을 취하게 되면 다음과 같이 나옵니다.
$$ E(Y) = \beta_0 + \beta_1X$$.
왜 이렇게 나오냐면 $E(\beta_0 + \beta_1X + \epsilon)$ 에서 $ \beta_0 + \beta_1X $는 이미 값을 알고 있고 그렇기 때문에 상수로 처리됩니다. 그러면 자연스럽게 $ \beta_0 + \beta_1X + E(\epsilon)$ 이 되고, 회귀분석에서는 $E(\epsilon) = 0$이라고 하는 아주 중요한 가정이 있기에 자연스럽게 $E(Y) = \beta_0 + \beta_1X$ 이 식이 유도가 됩니다.
Interpertation of coefficients
Recall that $$ E(Y) = \beta_0 + \beta_1X$$. - $\beta_0$ is the expected value of $Y$ when $X = 0$. - $\beta_1$ is the amount of increase in the expected value of $Y$ for every one-unit increase inn $X$.
For example E(minutes) = 4.162 + 15.509 $\times$ Units. - The average length of calls is the 4.162 minutes when no component needs to be repaired. - The average length of calls increases by 15.509 minutes for each additional component that has to be repaired.
Test of hypothesis
In the simple linear regression analysis, the usefulness of the predictor(= X) can be tested by using the following hypothesis test: $H_0: \beta_1 = 0 versus H_1: \beta_1 \neq 0$. (X와 Y의 linear relationship을 $\beta_1$을 체크하여 확인할 수 있습니다.) (주의할 점: $\hat{\beta_1}$을 이용해서 가설검정을 하는 것이 아닙니다.)
To this end, we need to further assume that
이렇게 간단한 식에 4가지의 가정이 들어가있습니다. 중요하기에 반드시 알아두는게 좋다고 합니다.
1. $E(\epsilon_i) = 0$
2. $Var(\epsilon_i) = \sigma^2$
3. $\epsilon_i$ ~ Normal
4. $\epsilon_1, ..... \epsilon_n$ are independent.
T-test
Under $H_0$ : $\beta_1 = 0$, it can be shown that $$ T = \frac{\hat{\beta_1}}{s.e.(\hat{\beta_1})}$$ follows a Student's t distribution with n - 2 degrees of freedom, where $$ s.e.(\hat{\beta_1}) = \sqrt{\frac{\sum_{i=1}^{n}{(y_i - \hat{y_i})^2/(n-2)}}{\sum_{i=1}^{n}{(x_i - \overline{x})^2}}}$$.
Using t-distribution, we can compute the p-value. At significant level $\alpha = 0.05$, we reject $H_0$ if the p-value $\leq$ 0.05. Otherwise, we fail to reject $H_0$.
보통은 모델이 유용하기를 바라기 때문에 귀무가설을 기각하기를 원합니다.
앞서말한 계수들 뿐만 아니라 $\sigma^2$를 추정하는 것도 중요한데요
바로 error의 변동성을 설명하기 위함입니다.
Estimation of $\sigma^2$
Define $$ e_i = y_i - \hat{y_i}, i = 1, 2, .... , n $$ which are called the residuals. 이렇게 하는 이유는 $\epsilon_i = y_i - \beta_0 - \beta_1x_i$를
We can estimate $\sigma^2$ by using $$ \hat{\sigma^2} = \frac{\sum_{i=1}^{n}{e_i^2}}{n - 2} = \frac{\sum_{i=1}{n}{(y_i - \hat{y_i})^2}}{n-2} \equiv $$ MSE, where $\sum_{i=1}{n}{(y_i - \hat{y_i})^2}$ is referred to as SSE (Sum of Squares of Errors) and n -2 is called the df(degrees of freedom). 여기서 n은 전체 데이터이고 2는 추정치의 개수입니다. 추정치는 $\beta_0, \beta_1$으로 2개가 존재했습니다. 그렇기에 2를 빼주는 것입니다.
SAS라는 통계 프로그램을 통해서 MSE를 관측할 수 있는데 밑에 그림의 빨간색 부분이 MSE입니다.
MSE in SAS
Confidence intervals
The (1 - $\alpha$) $\times$ 100% confidence intervals (or limits) for $\beta_0 and \beta_1$ are given by $$ \hat{\beta_0} \pm t_{n-2,\alpha/2} \times s.e.(\hat{\beta_1})$$, where $t_{n-2, \alpha/2}$ is the (1 - $\alpha$ / 2) percentile of a t - distribution with n - 2 df
Construting Cls for coefficients in SAS
이렇게 신뢰구간도 설정하고 회귀모델을 fitting 했으면 이제 예측을 해봅시다
(예측은 크게 설명력과 예측력으로 구분할 수 있습니다.)
Prediction
There are two types of predictions: 1. Prediction of the value of Y given X, i.e., $Y = \beta_0 + \beta_1X + \epsilon$. 2. Prediction of the mean of Y given X, i.e., $E(Y) = \beta_0 + \beta_1X$.
여기서 하나 알아갈 수 있는 점은 confidence interval은 prediction of the value of Y given X가 넓을 수 밖에 없습니다. 왜냐하면 $\epsilon$, 즉, error가 포함되어 있기 때문입니다.
Given $X = x_0$, - in the first case, the predicted value is $\hat{y_0} = \hat{\beta_0} + \hat{\beta_1}x_0$. - in the second case, the mean response is $\hat{\mu_0} = \hat{\beta_0} + \hat{\beta_1}x_0$.
Prediction intervals
The (1 - $\alpha$) $\times$ 1000% prediction limits are given by $$\hat{\mu_0} \pm t_{n-2,\alpha/2} \times s.e.(\hat{\mu_0})$$ and $$\hat{y_0} \pm t_{n-2, \alpha/2} \times s.e.(\hat{y_0})$$, where $$s.e.(\hat{\mu_0}) = \hat{\sigma}\sqrt{\frac{1}{n} + \frac{(x_0 - \overline{x})^2}{\sum_{i=1}^{n}{(x_i -\overline{x})^2}}}$$ and $$ s.e.(\hat{y_0}) = \hat{\sigma}\sqrt{1+ \frac{1}{n} + \frac{(x_0 - \overline{x})^2}{\sum_{i=1}^{n}{(x_i -\overline{x})^2}}} $$
(여기서 보면 Expected value와 value 값의 interval을 측정할 때 차이점이 보입니다. 바로 1이 더해졌냐 안 더해졌냐인데요. value값은 아까 Prediction 파트에서 value값의 confidence interval이 넓을 수 밖에 없다고 한 것과 비슷한 매락의 이야기입니다. $\sigma^2$은 $\epsilon$의 분산이고 $\epsilon$만큼 더해진 것을 확인할 수 있습니다. 그렇기에 더 넓은 confidence interval을 가질 수 밖에 없다고 설명한 것입니다.)
Role of $\sigma^2$
분산이 크다는 것은 값들이 선에 비교적 가깝지 않고, 분산이 작다는 것은 선에 비교적 선에 가깝다는 얘기입니다.
그러나 분산 즉, $\sigma$의 분산만을 가지고는 선형성을 추론하기에 어려움이 있습니다. 가령, 범위가 다를 때는 $\sigma$의 분산으로 선형성을 추론하면 오류가 발생할 수 있습니다.
그래서 이 상황에서 고안된 것이
Measuring the strength of the linear relationship
To remedy the limitation of $\sigma^2$, we can propose to use $$\frac{\sigma^2}{Var(Y)}$$, since it decreases if $\sigma^2$ decreases or $Var(Y)$ increases.
우리는 $\sigma^2$의 값을 모르기 때문에 $\sigma^2$의 추정치인 MSE를 사용할 것입니다. 복습을 하자면 $$MSE = \frac{\sum_{i=1}^{n}{(y_i-\hat{y_i})^2}}{n-2}$$ 이고 $Var(Y)$도 모르기 때문에 추정치인 $\hat{Var}(Y)$을 사용할 것입니다. 이것도 다시 remind 하자면 $$ \hat{Var}(Y) = \frac{\sum_{i=1}^{n}{(y_i-\overline{y})^2}}{n-1} $$ 입니다.
여기서 선형성인 것을 나타내주는 지표인 결정계수가 나옵니다.
$R^2$
To measure the strength of the linear relationship, we define the so-called $R^2$ as follows: $$R^2 = 1 - \frac{\sum_{i=1}{n}{(y_i - \hat{y_i})^2}}{\sum_{i=1}{n}{(y_i-\overline{y})^2}} = 1 - \frac{SSE}{SST}$$ where SST stands for the total sum of squared deviation in $Y$ from its mean.
Property of $R^2$
It can be shown that $$\displaystyle\sum_{i=1}^{n}{(y_i - \overline{y})^2} = \displaystyle\sum_{i=1}^{n}{(\hat{y_i}-\overline{y})^2} + \displaystyle\sum_{i=1}^{n}{(y_i - \hat{y_i})^2}$$ where 왼쪽 식에서 첫 번째 식은 SSR(the sum of squares due to regression)으로 불린다. That is, $$SST = SSR + SSE$$.
This implies that $$0 \leq R^2 \leq 1$$ (그 이유는 $R^2 = SSR/SST$ and $0 \leq SSR \leq SST$).
주변 사람들은 저를 바쁘다고 생각하겠지만(안 할 수도 있지만) 실상은 노는거 좋아하고 롤하는거 좋아하고 농구만 하면서 인생을 즐기고 싶은 한 청년일 뿐입니다..
그렇다면 요즘 뭐하고 있냐 하면은
프로젝트 2개에 머신러닝 공부, 통계학 공부, 수학 공부 하고 있습니다
프로젝트는 데이터 분석 프로젝트인데 가끔 재능이 없는건가 싶을 때 한 번씩 있는데
그럴 때마다 교수님이나 데이콘 관계자 분들이 이메일로 잘하고 있고 좋은 태도로 임하고 있다고 해서 도움이 많이 됐던 것 같네요
통계학이랑 수학은 푸는 건 정말 재밌고 혼자 공부하면 알아가는 맛은 있는데 교수님 수업은 왜이렇게 힘든지 모르겠네요 아 물론 회귀분석은 진짜 재밌습니다! 정리해서 글 올려야하는데 계속 미루네요.. 조만간 올리겠습니답
요즘 좋아하는건 롤이랑 농구인데
진짜 저 2개 하고 있을 때는 체력적으로 지친 적이 별로 없는 거 같아요 롤은 4-5시간을 해도 다른 애들 허리 아프다고 할 때 저 혼자 더 남아서 할 때도 있고 농구는 경기 끝나면 슛을 좀 더 하고 싶어서 계속 던지고 있고 참 이거 2개로 먹고 살 수만 있다면 참 좋을텐디
그런데 그게 안되니깐 조금 아쉽네요 하핫
이런 와중에 저한테 꿈이 하나 생겼습니다
원하는 대학원과 기업이 생겼는데요
말은 못하겠지만 우리나라에서 가장 좋거나 다섯 손가락 안에 드는 곳이라고 생각합니다
그래서 이제 겉으로만 열심히 살아보이는 게 아닌 나 자신한테도 떳떳하게 열심히 산다고 생각하고
주변에 제가 이 정도로 열심히 산다고 말하는 사람이 아닌 주변에서 먼저 열심히 산다고 말해주는 그런 인물이 되겠습니다
앞으로의 길이 험난해지기 전에 미래에 제가 잘 할 수 있도록 용기를 줄 수 있는 말을 지금 해주고 싶었네요 하핫
말이 너무 길었고 근황토크도 아니긴 했는데 넵 뭐 옙 제 블로그이고 잘 됐을 때 제가 어떤 심정을 가지고 있었는지 보고 싶어서 글을 남기는 거니깐 너무 이상하게 보지는 말아주세여 ㅎㅎ
The probability that $C_2$ occurs given that event $C_1$ has occurred is called the conditional probability of $C_2$ given $C_1$ and is defined by
그림으로 표현하자면 아래와 같다.
Conditional probability is a probability?
조건부확률이 확률의 정의를 만족하는지 살펴보자.
Properites of Conditional Probability
Ex. Four cards are to be dealt successively, at random and without replacement, from an ordinary deck of playing cards. The probability of receving a spade, a heart, a diamond, and a club, in that order is..
$C_1$ : 1st - 13 / 52
$C_2$ : 2nd - 13 / 51
$C_3$ : 3rd - 13 / 50
$C_4$ : 4th - 13 / 49
(카드 놀이에서 4번을 뽑는데 각각 다른 걸 뽑을 확률을 나타낸 것)
- Prior probability vs. posterior probability
- Let $C_1, ... C_k$ : k causes of an event.
- P($C_i$) indicates the chance of $i$th cause.
If known, it is obtained from the past investigation >>>> prior probability
(쉽게 말해 알려진 확률을 prior probability)
- P($C_i | C$) indicates the chance of $i$th cause when the event $C$ happened.
It updates the past information >>>> posterior probability
Independence
Statistically / stochastically independent means independent in a probability sense.
Two events A and B are independent if and only if $P(A|B) = P(A|B^c) = P(A)$ or $P(B|A) =P(B|A^c) = P(B)$. Otherwise, they are independent.
Events $C_1, C_2, C_3$ are pairwise independents if and only if $P(C_1 \cap C_2) = P(C_1)P(C_2)$, $P(C_1 \cap C_3) = P(C_1)P(C_3)$, $P(C2 \cap C_3) = P(C_2)P(C_3)$.
Mutual Independence (모든 경우가 독립이면)
ex. Pairwise independence does not imply mutual independence
1,2,3,4가 적혀있는 spinner를 2번 돌렸다.
$C_1$은 두 번 돌린 spinner의 숫자의 합이 5가 되는 사건이고, $C_2$는 첫 번째 돌렸을 때 1이 나오면 되는 사건이고, $C_3$는 두 번째 돌렸을 때 4가 나오면 되는 사건이다.
표를 통해서 모든 경우의 수를 생각해보면
1st \ 2nd
1
2
3
4
1
(1, 1)
(1, 2)
(1, 3)
(1, 4)
2
(2, 1)
(2, 2)
(2, 3)
(2, 4)
3
(3, 1)
(3, 2)
(3, 3)
(3, 4)
4
(4, 1)
(4, 2)
(4, 3)
(4, 4)
$C_1$ > 빨간색
$C_2$ > 파란색
$C_3$ > 민트색
Then $P(C_i) = 1/4, i = 1, 2, 3$, and for $i \neq j$, $P(C_i \cap C_j) = 1/16$.
Thus, C_1, C_2, C_3 are pairwise independent.
But, $C_1 \cap C_2 \cap C_3$ is the event that (1, 4) is spun and its probability is 1/16.
1. Find the smallest $\sigma$-field of subsets of $C$(체) = {1, 2, 3}.
2. Find the largest $\sigma$-field of subsets of $C$(체) = {1, 2, 3}.
Probability Space
Theorems
Remark
Thm 3.6. Continuity Property
위의 특징을 시각화하면 아래의 그림과 같다.
반드시 increasing sequence라는 조건이 있어야 한다.
증명을 해보면
파란색 별 모양이 의미하는 것이 $C_n$이 increasing sequence 중에서 가장 마지막에 나오는 집합이기에 앞서 나온 집합들을 다 포함할 수 있다는 것이다. 그러고 난 다음에 우리는 donut 모양으로 집합을 생각할 것인데 이것은 mutually exclusive의 성질을 사용하여 집합의 덧셈으로 표현하기 위함이다. 아래와 같이 표현할 수있다.
그러면 mutually exclusive 하기에 다음과 같이 표현이 가능하다.
decreasing sequence의 경우에도 같은 방향으로 살펴볼 수 있다. 그런데 이 때는 여집합을 사용해서 mutually exclusive한 성질을 사용하고자 한다.