기본 콘텐츠로 건너뛰기

라벨이 probability인 게시물 표시

통계관련 함수와 메서드 사전

A B C d E F G H I K L M N O P Q R S T U V W Z A statsmodels.ap.stats.anova_lm(x) statsmodels.formula.api.ols 에 의해 생성되는 모형 즉, 클래스 인스턴스(x)를 인수로 받아 anova를 실행합니다. np.argsort(x, axis=-1, kind=None) 객체 x를 정렬할 경우 각 값에 대응하는 인덱스를 반환합니다. Axis는 기준 축을 지정하기 위한 매개변수로서 정렬의 방향을 조정할 수 있음(-1은 기본값으로 마지막 축) pandas.Series.autocorr(lag=1) lag에 전달한 지연수에 따른 값들 사이의 자기상관을 계산 B scipy.stats.bernoulli(x, p) 베르누이분포에 관련된 통계량을 계산하기 위한 클래스를 생성합니다. x: 랜덤변수 p: 단일 시행에서의 확률 scipy.stats.binom(x, n, p) 이항분포에 관련된 통계량을 계산하기 위한 클래스를 생성합니다. x: 랜덤변수 n: 총 시행횟수 p: 단일 시행에서의 확률 C scipy.stats.chi2.pdf(x, df, loc=0, scale=1) 카이제곱분포의 확률밀도함수를 계산 $$f(x, k) =\frac{1}{2^{\frac{k}{2}−1}Γ(\frac{k}{2})}x^{k−1}\exp\left(−\frac{x^2}{2}\right)$$ x: 확률변수 df: 자유도 pd.concat(objs, axis=0, join=’outer’, …) 두 개이상의 객체를 결합한 새로운 객체를 반환. objs: Series, DataFrame 객체. Axis=0은 행단위 즉, 열 방향으로 결합, Axis=1은 열단위 즉, 행 방향으

Probability Inequalities & Moment Generating Functions

Contents Probability Inequalities Markov's inequality Chebyshev's inequality Moment generating function Combination of random variables Probability Inequalities & Moment Generating Functions It is necessary to know the interval of probabilities that contains the value(s) of interest in a distribution that can be estimated as a statistic. In addition, it is necessary to establish a confidence interval indicating the degree of confidence in the results of statistical analysis. Markov and Chebyshev inequalities are mathematical expressions underlying the rationale for establishing probability intervals or confidence intervals. Probability Inequalities Markov's inequality If X is a random variable and g(x) is a nonnegative real-valued function, then Equation 1 holds for any positive real c. $$\begin{equation} \tag{1} p[g(x) \ge c] \le \frac{E[g(x)]}{c} \end{equation}$$ If the event of this variable is $A=\{x|g(x) \ge c\}$, the above expression is proved

Probability and Expected Value

Contents Probability and Expected Value Expected value Linear combination of expected values Probability and Expected Value A quantitative indicator for mathematically describing the characteristics and shape of random variables and probability distributions is called moment . $$\begin{aligned}&\text{nth order moment }= E(x^n)\\ &n= 1, 2, \cdots \end{aligned}$$ Moments are used to derive various statistics such as skewness and kurtosis along with mean and variance introduced in descriptive statistics. Expected value The mean is the most commonly used statistic to characterize variables. This statistic is calculated as the product of the frequency and probability for each variable value and is called expected value (E(X)). Each value of the random variable X can be specified by the relative likelihood, that is, the probability function, which is the probability that the value can appear compared to other values. When the v

Permutation & Combination

Contents Probability Permutation & Combination Probability Probability is a measure of belief about an event that will occur in the future, based on historical data. In other words, the probability of occurrence of a specific target event among the total from past data can be defined as probability. Probability has the following axiom: Probability axiom A value between 0 and 1 $$ 0 \,\le\, P(x) \,\le\, 1$$ The sum of all probability is 1 $$\begin{align}&\sum_{x \in S} P(x) =1\\ & S=\text{all possible spaces} \end{align} $$ A: Event(s) included in S $$A \subset S, P(X \in A) = \sum_{x \in A}P(X=x)$$ The concept of the probability that a particular event will occur in an experiment can be applied and interpreted in many ways. For example, for a forecast that there is a 70% chance of rain tomorrow, you can analyze the data of past climatic conditions and interpret it as a result of 70% rain under conditio

[Probability]순열(permutation)

순열(Permutaion) 경우의 수 주사위 2개를 시행할 경우 발생되는 모든 경우는 다음과 같습니다. event=[] for i in range(1, 7): for j in range(1, 7): event.append((i, j)) print(event, end="") [(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6), (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6), (5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6), (6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6)] (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (5, 1) (5, 2) (5, 3) (5, 4) (5, 5) (5, 6) (6, 1) (6, 2) (6, 3) (6, 4) (6, 5)

집합 자료형과 집합연산_python

python에서는 set이라는 집합 자료형을 제공합니다. 이 자료형은 집합들 간의 합집합 등의 연산을 위해 사용되는 형태입니다. 이번 글에서는 python 의 set 자료형에 의한 연산 종류를 알아봅니다. 우선 리스트등의 자료형을 집합형으로 전환하기위해서 set() 함수를 사용합니다. 다음은 주사위 두개를 던져 나올수 있는 모든 경우입니다. >>> S=[(i, j) for i in range(1, 7) for j in range(1, 7)] >>> print(S) [(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6), (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6), (5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6), (6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6)] 다음 A와 B는 각각 두수의 합이 2의 배수, 3의 배수인 경우입니다. >>> A=[(S[i][0], S[i][1]) for i in range(len(S)) if (S[i][0]+S[i][1])%2 ==0] >>> print(A) [(1, 1), (1, 3), (1, 5), (2, 2), (2, 4), (2, 6), (3, 1), (3, 3), (3, 5), (4, 2), (4, 4), (4, 6), (5, 1), (5, 3), (5, 5), (6, 2), (6, 4), (6, 6)] >>> B=[(S[i][0], S[i][1]) for i in range(len(S)) if (S[i][0]+S[i][1])%3 ==0] >>> print(B) [(1, 2), (1,

확률의 개요

확률이란... 확률은 미래에 발생할 사건에 대한 믿음의 측정값입니다. 어떠한 사건에 대해 그 사건이 일어날 빈도수를 전체사건에서 차지하는 비율로 나타낼 수 있습니다. 확률은 통계의 기본이 되며 일상에서 많은 경우를 접하고 있습니다. 그러나 확률을 정의하는 것은 많은 사람들에게는 새로운 작업이 될 수도 있습니다. 그러나 이것은 일상에서 접하는 것을 서술하는 것으로 사실 새로운 것은 아닙니다. 1. 용어 이러한 확률을 다루기 위해서 몇가지 알아야할 용어가 있습니다. - 확률실험(random experiment, 시행) 실험결과를 예측할 수 없는 실험을 말하며 실험결과를 알 수 없다는 것은 실험의 모든 시행의 가능성이 동일하다고 할 수 있습니다. 예를들어 동전던지기에서 앞과 뒤가 나올 확률은 동일합니다. 이러한 실험을 확률실험이라고 합니다. - 표본공간(sample space)와 원소(element) 확률실험의 각 결과를 원소라 하며 그 실험의 모든 결과를 모아 놓은 공간을 표본공간이라고 합니다. 주사위 던지기 실험 역시 각 눈의 값이 나올 확률은 동일하므로 확률실험이며 이 실험에서 나올 수 있는 결과(사건)은 1, 2,3 ,4,5 ,6 입니다. 이 모든 사건들의 모임을 표본공간이라고 하고 이 실험에서 표본공간(S)은 S={1,2,3,4,5,6} 이며 각 값들을 원소라고 합니다. - 사건(event) 또는 집합(set) 확률실험에서 관심의 대상이 되는 원소들의 모임을 사건 또는 집합이라고 합니다. 특히 확률이 정의된 집합을 사건이라고 합니다. - 벤다이어그램(Venn Diagram) : 집합간의 관계를 그림으로 나타낸 것입니다. 그림 1 벤다이어 그램  - 전체집합(Universe set) : 샘플공간과 같으며 실험에서 발생하는 모든 원소들의 집합입니다. 그림 1에서 S - 공집합(Empty set) : 원소가 하나도 없는 집합 ($\emptyset$) - 합집합(Union) :  각 집합에 속한 모든 원소들의

조합과 순열

조합과 순열 (Combination & Permutation) 조합의 정의 조합은 전체 집합중에서 일정한 수의 부분집합을 선택하는 방법의 수로 그 순서는 고려하지 않습니다 . 다음과 같이 나타내지요 . $\left( \begin{array}{rr} n \\ p \end{array}\right)$ or $C_n^p$  로 표현합니다 . 위의 의미는 전체 n 원소들로 이루어진 집합에서 p 개의 일부 원소들 취해 부분집합을 만드는 방법으로 위의 표현은 $ n^p$ 로 계산됩니다 . 2 진법으로 6 자리를 만드는 방법의 수는 다음과 같이 계산됩니다 . $\left( \begin{array}{rr} 2 \\ 6 \end{array}\right)=2^6$ 모든 자리에 0, 1 중의 하나를 선택하고 이러한 경우가 6 번이므로 $ 2 \times 2 \times 2 \times 2 \times 2 \times 2$ 이 됩니다 . 위와 같은 결과이지요 . {a, b, c, d, e} 중에서 서로 다른 세개만을 선택하는 방법을 생각해보면 먼저 a 를 선택한 후 나머지를 선택하는 방법은 다음과 같이 12 가지가 됩니다 . a b c d e c b d e d b c e