기본 콘텐츠로 건너뛰기

라벨이 cdf인 게시물 표시

[matplotlib]quiver()함수

[data analysis]연속확률분포: 확률밀도 함수(pdf)

연속확률분포 내용 확률밀도함수(Probability Density Function, PDF) 일정구간 [a, b]에서 무작위로 하나의 수를 선택하는 확률이 동일하다면 그 수는 랜덤변수(random variable) 가 됩니다. 그 구간의 수들은 무한하므로 하나의 점을 특정할 수 없습니다. 즉, 연속변수에서 특정한 점에서의 확률은 정의할 수 없습니다. 대신에 전체를 일정구간으로 소그룹화하면 하나의 그룹을 선택할 확률은 전체 구간의 길이에 대해 그 선택된 부분의 길이로 정의할 수 있습니다. 이 관계는 식 1과 같이 나타낼 수 있습니다. \begin{align}P(X ∈ [a, b])&=1\\P(\in [x_1,\,x_2])&=\frac{x_2-x_1}{b-a}\\a\le x_1&\le x_2 \le b \end{align} (식 1) 식 1을 기반으로 확률변수 X에 대한 누적분포함수(CDF)는 식 2와 같이 나타낼 수 있습니다. $$F(X)=\begin{cases}0&\text{for}\; x \le a\\\frac{x-a}{b-a}&\text{for}\; a \le x \le b\\1&\text{for}\; x \ge b \end{cases}$$ (식 2) 사실 연속변수의 경우 한 지점에서의 확률은 정의할 수 없으므로 기호 "≤" 와 "<"의 차이 역시 정의 할 수 없습니다. [연속확률함수의 조건] 식 3의 관계가 성립하기 위해서는 함수 f(x)가 모든 x에서 대응하는 값을 정의할 수 있는 연속함수(continuous function)이어야 합니다. F(x) = P(X ≤ x) (식 3) 다시말하면 누적분포함수인 F(x)는 모든 범위에서 미분가능한 함수이어야 합니다. 확률밀도함수(Probability Density Function, PDF) 이산확률함수에 각 경우의 확률은 확률질량함수(PMF)와 누적분포함수(CDF)...

[data analysis]이산확률분포: 확률질량함수(pmf)와 누적분포함수 (cdf)

이산확률분포 내용 확률질량함수(PMF) 누적분포함수(Cumulative Distribution Function, CDF) 확률분포는 샘플공간의 각 값과 그에 대응하는 확률로 구현됩니다. 즉, 변수의 값들과 확률 사이의 관계를 함수로 표현할 수 있습니다. 그 변수가 이산변수(discrete variable) 일 경우 각 값에 대응하는 확률은 대상이 되는 값들의 빈도를 비율로 나타냅니다. 이 경우 한 지점에 대응하는 확률을 표현할 수 있으며 확률질량함수 (Probability Mass Function, PMF) 라고 합니다. 그러나 연속변수(continuous variable) 의 경우 한 지점에 대응하는 확률을 계산할 수 없습니다. 대신에 일정한 구간에 대응하는 확률은 계산될 수 있습니다. 즉, 전체에 대해 일정한 구간의 밀도로 확률을 표현합니다. 이 경우의 확률함수를 확률밀도함수 (Probability Density Function, PDF) 라고 합니다. 두 경우 모두 일정한 변수구간에서의 각 확률의 합을 확률누적분포함수 (Cumulative Distribution Function, CDF) 라고 합니다. 확률함수는 변수에 대응하는 확률의 집중, 퍼짐등의 정보를 포함합니다. 이러한 정보에 따라 나타나는 특징적인 형태를 확률분포(probability distribution)라고 합니다. 데이터의 수가 증가할수록 분포는 특정한 형태로 수렴합니다. 그 특정한 분포의 형태는 몇 가지의 확률질량함수 또는 확률밀도함수로 나타낼 수 있습니다. 이러한 분포와 함수들은 여러 통계 분석의 근거를 제공합니다. 확률질량함수(PMF) 표본공간(S)의 각 사건(x)에 대응하는 확률(p)을 함수로 나타낼 수 있습니다. 즉, 확률은 사건에 의존하는 함수로 p(x) = f(x)의 형태로 나타낼 수 있습니다(식 1). S = {x 1 , x 2 , x 3 , …} (식 1) f(x i ) = P(X = x i ),   i = 1, 2, 3, … 표본공간이 이산변...

Uniform and Normal distribution

Contents Uniform Distribution Mean and Variance Normal (Gaussian) Distribution Possibility Desnity Function(PDF) Cumulative Distribution Function(CDF) Uniform Distribution If the probability density function of a random variable X is constant over the range [a, b] as in Equation 1, then the variable is said to be uniformly distributed. $$\begin{align}\tag{1}f(x)=\begin{cases}\frac{1}{b-a}& \quad a \lt x \lt b\\ 0&\quad \text{otherwise} \end{cases}\end{align}$$ A uniform distribution is expressed as $$X \sim \text{Uniform(a, b)}$$ Example 1)   If the variable X is uniformly distributed in the range [0,10], try calculating the following probabilities: $$\begin{align}&f(x)=\frac{1}{10-0}\\&F(x)=\int^b_a \frac{1}{10-0} \, dx \quad 0 \le a \lt b \le 10 \end{align}$$ import numpy as np import pandas as pd from sympy import * import matplotlib.pyplot as plt from scipy import stats a, b, x=symbols("a b x") f=Rational(1, 10) f $\quad \colo...

Discrete probability distribution I : Bernoulli and Binomial

Contents probability mass function Cumulative Distribution Function(CDF) Bernoulli and the binomial probability distribution Discrete probability distribution The probability distribution is created based on the probability of each point or each interval in the sample space. Such a probability can be written as a function, and if the event (random variable) that is the object of the probability is a discrete variable, it is called probability mass function (PMF). Also, if it is a continuous variable, it is called probability density function (PDF). In both cases, the sum of each probability in a constant variable interval is called Cumulative Probability Distribution Function (CDF). The probability distribution can be expressed visually as a correspondence between the values ​​of each random variable and a function. The shape of these distributions tends to follow the distributions implemented by a particular function. Therefore, various statistical methods can be applied by a...