드디어 개강이 내일입니다. 눈물이ㅠㅠ

개강준비는 마땅히 할 게 없어요. 그저 마음 비우기? 정도가 되겠어요.

 

예전엔 이어폰으로 음악 참 많이 듣곤했었는데, 최근들어서는 음악을 안 들으려고 해요. 귀가 아파서요ㅠㅠ  

그래도 너무 집중이 안된다 싶을때 제가 자주가는 사이트 두 곳이 있는데요. 

이미 많은분들이 잘 알고 있는 사이트라서 새로울게 없지만 그래도 올려봅니다.  

 

[1] http://songza.com/  

다양한 음악을 선택할 수 있어서 좋은것 같아요. 보통 working (No lyrics)에서 선택하기도 하지만, 다양한 음악을 시도해서 들을 수 있는점이 좋은것 같아요. 앱도 있지만 전 보통 랩탑을 학교에 가지고 다니는지라 인터넷으로 접속해요. 그리고 폰은 책가방에 넣어두는거죠. 그러면 공부에 더 집중할 수 있진 않고 컴퓨터로 딴짓합니다-_ㅠ

 

 

 

[2] http://soundrown.com/ 

백색소음이 집중력 향상에 좋다고 해서 커피숍 소음 켜놓고 공부했더니 커피숍에서 공부하는 느낌이 들더라고요. 

이 사이트는 간단하게 선택할 수 있게 되어서 좋은것 같아요. 오히려 옵션이 많으면 뭐 들을지 고민만 하다가 시간 흐릅니다. 도서관이 답답하다 싶으면 rain과 coffee shop 버전 눌러서 공부하곤 해요. 추우면 fire도 틀어놓고요. 

 

 

 

이밖에도 구굴에 coffee shop sound 혹은 white noise 등 검색하면 다양한 사이트가 나올꺼예요. 유튜브에도 검색하면 더 많이 나오고요. 하지만 전 금새 다른 가수들을 검색할 뿐이고, 그러다 도서관에서 노래만 실컷 듣다가 나올 뿐이고...ㅠㅠ

 

괜찮은 사이트 있으면 추천해주세요ㅎㅎ

반응형

휴대폰으로 접속하실때 수학기호가 안보일 수 있어요. 

아래 사이트로 접속하시면 보실 수 있습니다.  

http://statnmath.blogspot.ca/2014/07/bernoullip-distribution-mle.html 

 

[1] 베르누이 개념 (Bernoulli Trial, Bernoulli Distribution)

우선 베르누이 시행(Bernoulli Trial)은 두 가지 결과값 나올때를 말합니다. 예를들어, 남자 vs. 여자, 성공 vs. 실패, 1 vs. 0, 동전의 앞면 vs. 뒷면 등등 이처럼 두가지 결과값 이외엔 없는거죠. 

 

이렇게 베르누이 시행을따른 분포를 가지는게 베르누이분포(Bernoulli Distribution)라고 합니다.   

* 두 개 결과값만 가지기에, 만약 한가지 결과가 나올 확률이 p라고 한다면, 다른 한가지 결과값이 나올 확률은 1-p가 되겠죠. 확률값은 언제나 0과 1사이에 있으니까요.

독립시행이어야 합니다. 이번에 나온 결과가 다음에 나올 결과에 영향을 미치지 않습니다.

 

 

[2] 베르누이 분포 확률식 (Bernoulli Distribution)

$\bigstar$ $f(x)=p^x(1-p)^{1-x}$ 

예를 들면서 이 식에 대해 설명해볼게요. 베르누이 시행에서 가장 대표적인 예는 바로 동면던지기예요. 동전 던지면 앞면 vs 뒷면 딱 두가지 결과값만 나오니까요. 여기서 앞면이 나올 확률이 p라고 한다면, 뒷면이 나올 확률은 1-p 이겠죠. 이때 p는~ 0$\leq$ p$\leq$ 1 (확률 p는 언제나 0과 1 사이에 있으니까요

 

식을 보니까 p x (1-p) 이라고 되어있는데요. 이처럼 두개 확률의 곱으로 이뤄졌어요. 그런데 결과값은 둘 중 하나만 나오니까 동전을 던져서 p의 확률값으로 앞면이 나왔다면, 뒷면이 나올 확률 (1-p)는 결국엔 1로 만들어줘야 합니다. 결과값 두개중에 하나의 결과값의 확률만 관심이 있기에, 나머지 결과값은 1로 만들어줘야 둘이 곱해도 우리가 원하는 값을 알 수 있으니까요. 그래서 여기에서 x는 0 혹은 1의 값만 가지게 됩니다.

 

다시 식을 살펴볼게요!! 동전의 앞면이 나올 확률이 궁금해요. 앞면이 나올경우를 1이라고 하고, 그 나올 확률이 p라고 해요. 동전을 던졌더니 뒷면이 나왔어요. 그렇다면 x값은 0이겠네요.

식에 대입해보면 다음과 같아요. $f(0)=p^0 \cdot (1-p)^{1-0}=1 \cdot(1-p)^1=1-p$

 

 

================================================================

아래 내용은 조금 더 심화과정인데요. 궁금한점 있으시면 댓글 달아주세요 :D

================================================================

 

[3] (MLE를 이용한) 베르누이 분포 평균 및 분산 증명

$\bigstar$ E(X)=p, Var(x)=p(1-p)=pq (where q=1-p) 

 Proof

$f(1|p)=p^1(1-p)^{1-1}=p$ (probability of being 1)

$f(0|p)=p^0(1-p)^1=1-p$  (probability of being 0)


만약 n개의 샘플을 가지고 있다면, joint distribution을 이용해 likelihood를 구할 수 있습니다.  

$\Rightarrow$ $P(X_{1}=x_{1},X_{2}=x_{2},...,X_{n}=x_{n})=L=\prod_{i=1}^{n}p^{x_{i}}(1-p)^{1-x_{i}}$


최댓값을 구하려면, joint distribution 식에서 parameter로 미분해서 0일때 값을 구하면 됩니다. 

(MLE에 관한 포스팅: http://statnmath.tistory.com/33)

$\Rightarrow$ $P=\frac{dL}{dP}=0$ $\Rightarrow \hat{p}_{MLE}$  (미분의 연쇄법칙이 필요합니다) 

$\Rightarrow log L=l=log(\prod_{i=1}^{n}p^{x_{i}}(1-p)^{1-x_{i}}=\sum_{i=1}^{n} log(p^{X_i}(1-p)^{1-X_{i}})$

   $=\sum_{i=1}^{n}[{x_{i}\cdot logp+(1-X_{i}})\cdot log(1-p) ]$ 

   $= logp \sum_{i=1}^{n}X_{i}+log(1-p)\sum_{i=1}^{n}(1-X_{i})$ 

   $= n\bar{X}\cdot log\hat{p}+n(1-\bar{X})\cdot log(1-\hat{p})$ 

   $\because \sum_{i=1}^{n}X_{i}=n\bar{X}\Rightarrow \bar{X}=\frac{1}{n}\sum_{i=1}^{n}X_{i}$ 

$\Rightarrow \frac{dl}{d\hat{p}}=\frac{n\bar{X}}{\hat{p}} - \frac{n(1-\bar{X})}{1-\hat{p}} = 0$ (for maximizing) $= \frac{n\bar{X}}{\hat{p}}=\frac {n(1-\bar{X})}{1-\hat{p}}=\bar{X}\cdot \hat{p}\bar{X}=\hat{p}-\hat{p}\bar{X}$ $\Rightarrow$  $\hat{p}_{MLE}=\bar{X}$

 

 

[4] 베르누이 분포가 충분통계량을 가지는지 증명해보시오.
$\bigstar$ Show that $T=\sum_{i=1}^{n}X_{i}$ is a sufficient statistic. 

Proof

By independence, the joint distribution of the random sample is

$\prod_{i}^{n}p^{x_{i}}(1-p)^{1-x_{i}}=p^{\sum X_{i}}(1-p)^{n-\sum X_{i}} \cdot 1$ ,

where $p^{\sum X_{i}}(1-p)^{n-\sum X_{i}} = g(\sum x_{i},p)$ , and 1= $h(X_{1},...,X_{n})$

 

 

[5] 베르누이 분포가 Exponential family에 포함되는지 증명해보시오.
$\bigstar$ Show that Bernoulli distribution is part of the exponential family. 

Proof 

We need to show $f_{\theta}(X)= \exp {[\sum_{i=1}^{k}]C_{i}(\theta)\cdot T_{j}(X)}+d(\theta)+ s(X)$

Click link to more details 


parameter p, where p= P(X=1)

$p(x|p)=p^x(1-p)^{1-x}$

$p(x|p)=exp{[log(p^x(1-p)^{1-x})]}=exp[x\cdot logp+(1-x)\cdot log(1-p)]$ 

          = $exp [x\cdot log \frac{p}{1-p} + log(1-p)]$     

This shows the Bernoulli distribution belongs to the exponential family with parameter 

$c(\theta)=\log \frac {p}{1-p}$, $T(x)=x, d(\theta)=\log (1-p), s(x)=0$  

 



 


반응형

[1] Expected Value (기댓값)

 • Discrete Case (이산확률): $\mathsf {E(x)= \sum x_{i} \cdot P(X=x_{i})}$       

 • Continuous Case (연속확률): $\mathsf {E(x)= \int_{-\infty}^{\infty} x \cdot f(x)dx }$

 • Properties (a, b $ \in \mathbb{R}$) 

If X$\geq$ 0, then E(X)$\geq$ 0

    Proof  $\mathsf { E(X)=\sum_{x}x\cdot P(X=x)=\sum_{x>0} x\cdot P(X=x)\geq \sum_{x>0} 0 \cdot P(X=x)=0}$

   

E(aX) = a E(X)

     Proof  $\mathsf {E(aX)=\sum _{x}a\cdot x \cdot P(X=x)=a \sum_{x} x \cdot P(X=x)=a \cdot E(x) }$

      E(X+Y) = E(X) + E(Y)

 

 

[2] Variance (분산)

 • $\mathsf{ Var= E(X^2)- E(X)^2 }$ 

     Proof  $\mathsf{Var= E[x- E(x)^2] = E[(x- \mu)^2)]= \sum_{x} (x_{i}-\mu)^2 \cdot P(X=x)}$

                     $\mathsf{= \sum_{x}(x^2 - 2\mu x + \mu^2) \cdot P(X=x)} $

                     $\mathsf{ = \sum_{x}x^2\cdot P(X=x)-2\mu \cdot \sum_{x}x\cdot P(X=x)+ \mu^2 \sum_{x}P(X=x)}$

                     $\mathsf{=E(x^2)-2\mu^2+\mu^2 = E(x^2)-\mu^2 = E(x^2)-E(x)^2}$

 

 • Properties (a, b $ \in \mathbb{R}$) 

      Var(a)=0  (All values are same, then there is no variance)

      Var (aX+b)= $a^2 \cdot$Var(x)

      Proof   From $\mathsf {E(aX+b)=aE(X)+b}$, and $\mathsf {E[(aX+b)^2]=a^2E(X^2)+2abE(X)+b^2}$

                      $\mathsf {Var(aX+b)=E[(aX+b)^2]-[E(aX+b)]^2}$

                                      $\mathsf {=a^2E(X^2)+2abE(X)+b^2-[aE(X)+b]^2}$

                                       $\mathsf {=a^2E(X^2)+2abE(X)+b^2-[a^2(E(X))^2+2abE(X)+b^2]}$

                                       $\mathsf {=a^2[E(X^2)-E(X)^2]=a^2\cdot Var(X)}$  

       

      Var(X+Y)= Var(X)+Var(Y)+ 2Cov(X,Y)

      Proof  From $\mathsf {E(X+Y)=E(X)+E(Y)}$, and $\mathsf {E[(X+Y)^2]=E(X^2)+2E(XY)+E(Y^2)}$

                       $\mathsf {Var(X+Y)=E[(X+Y)^2]-[E(X+Y)]^2}$

                                       $\mathsf {=E(X^2)+E(Y^2)+2E(XY)-[ (E(X))^2 + (E(Y))^2 +2E(X)E(Y)] }$

                                       $\mathsf {=E(X^2)-(E(X))^2+E(Y^2)-(E(Y))^2+2 [E(XY)-E(X)E(Y)] }$

                                       $\mathsf {=Var(X)+Var(Y)+2Cov(X,Y)}$

 

       Var(X+Y)= Var(X)+Var(Y), iff X and Y are uncorrelated

 

 

[3] Covariance (공분산)

 • A measure of how much two random variables change together!

 • Cov(X,Y)=E{ [X-E(X)][Y-E(Y)] } = E(XY)-E(X)E(Y)

      

 

[4] If X and Y are independent (독립변수), then

 • P(X=x, Y=y)=P(X=x)P(Y=y)

 • E(XY)=E(X)E(Y),

      Proof  $\mathsf {E(XY)=\sum_{x,y}xy \cdot P(X=x,Y=y)= \sum_{x}\sum_{y}xy \cdot P(X=x)P(Y=y)}$       

                       $\mathsf {=\sum_{x} x\cdot P(X=x) \cdot \sum_{y}y \cdot P(Y=y)=E(X)E(Y)}$

Cov (X,Y)=0

      Proof  E(XY)-E(X)E(Y)=E(X)E(Y)-E(X)E(Y)=0

 

 

 수학기호가 안보인다면 새로고침(F5)을 해보세요. 

 

 

반응형

 

[1] Convergence in probability

Definition:  A sequence of random variables $X_{1}, X_{2},...$ converges in probability to random variable X if for every e > 0, $\lim_{n\rightarrow \infty} P(|X_{n}-X| > e )=0$ $\Leftrightarrow \lim_{n\rightarrow \infty} P(|X_{n}-X| \leq e )=1$

Think about a sequence of random variables. This sequence asymptotically reaches a certain random variable X (or a constant). How do we know it? We can define a boundary of the certain random variable. The sequence will reach this boundary, however we never know it actually reach the certain random variable X

 


[2] Almost Sure Convergence

 

Definition: A sequence of random variables $X_{1}, X_{2},...$ almost surely to a random variable if for every e>0, $P(\lim_{n\rightarrow \infty}|X_{n}-X| \leq e )=1$  

A sequence of random variables definitely reach a certain random variable X. But we don’t know when it actually reach it. Therefore, after a certain n, then the sequence of random variables are equal to the variable X.

 

 

[3] Convergence in distribution.

Definition: A sequence of random variables $X_{1}, X_{2},...$ converge in distribution to a random variable X if $\lim_{n\rightarrow \infty}P(|X_{n} \leq x)= P(X\leq x)=F_{X}x$ at all points x where F(x) is continuous.

 

 

* Central Limit Theorem 

Definition: Suppose that $X_{1}, X_{2},..., X_{n}$ are i.i.d. random variable with mean $\mu$ and variance $\sigma^2$. Then, $Z_{n}=\frac{\sqrt{n}(\bar{X}-\mu)}{\sigma}\rightarrow Z\sim N(0,1)$ (in distribution)  

Remark) The condition of the CLT is different from the others. There should be i.i.d, number of n randm varaibles.  

Varance stabilizing transformations

When g is differentiable, we have $\sqrt{n}(g(\bar{X_{n}}-g(\mu)))\rightarrow g'(\mu)N(0, \sigma^2)$ in distribution.  

 

 

 수학기호가 안보인다면 새로고침(F5)을 해보세요. 

저도 아직 배우는 학생이다보니 수정해야할 부분이 있다면 댓글 부탁드릴게요 :D 

 

반응형

Maximum Likelihood Estimate (MLE) 

Parameter(모수, 모집단의 특정한 수인데요. 정확한 값을 모르지만 궁극적으로 알고 싶은 수를 말합니다.)를 예측하는 방법중에 하나가 MLE 인데요. 우선 Likelihood부터 설명해보자면-

 

What's the likelihood

If $X_{1}, X_{2},...,X_{n}$ are random variable with joint density(결합밀도) $f(X_{1}, X_{2},...,X_{n};\theta)$, then given observed values $X_{1}, X_{2},...,X_{n}$ = likelihood ($\theta$) = $L(\theta)$ = $L(\theta)=\prod_{i}^{n}f(X_{i}|\theta)$ 

* $\prod_{i}^{n}$ is a product notation form i to n. 

제가 여기에 설명하기까지 정확하기 이해한건 아니여서 수업노트로 대체합니다.


 
What's the MLE

We want to find the parameter that MAXIMIZE our probability of getting the data we obtained. That means what parameter of $\theta$ give us the most probable chance of getting the data we obtained?!! $MLE \hat{\theta }=L(\hat{\theta })= max L(\theta )$ 


So how can we find the MLE? 

By using log likelihood, as we can take a log transformation without changing the maximum value. So, $l(\theta)=log(L(\theta))=log(\prod_{i}^{n}f(X_{i}|\theta))= \sum_{i}^{n}(f(X_{i}(\theta )))$

And then take a derivative, then set the equation to equal to 0! 

MLE구할때 log를 씌워주는데요. 아무래도 독립변수끼리 곱하기때문에 숫자가 커질수밖에 없는데요, log를 씌우면 식을 다루는데 쉬울 뿐더러 구하고 싶은 최댓값에 영향을 주는게 아니라서 log를 씌워줍니다. 미분해서 0으로 문제푸는건 수학내용이라 아실꺼라 생각해요 :)

 
Example) Parameter Estimate Example: MoM, MLE

Let Y1, Y2, …, Yn denotes random sample. f(y|$\theta$)= $(\theta+1)y^\theta$, 0<y<1, -1<$\theta$, and f(y|$\theta$)=0 otherwise. 

a) $\hat{\theta}_{MoM}$ 

b) $\hat{\theta}_{MLE}$?

 

답안은 여기 클릭하면 보실 수 있어요. Solution??!!

 

 

* Method of Moment Estimate에 대한 글: http://statnmath.tistory.com/29

 

 수학기호가 안보인다면 새로고침(F5)을 해보세요. 

저도 아직 배우는 학생이다보니 수정해야할 부분이 있다면 댓글 부탁드릴게요 :D 

반응형

+ Recent posts