기본 콘텐츠로 건너뛰기

pandas_ta를 적용한 통계적 인덱스 지표

Type of Variable & ratio

Types of variables

All data generated by measurement, surveys, research, etc. can be variables and also use the term feature in machine learning. An event contains multiple variable values and is called an instance. The following table contains three variables: name, age, gender, height, and three events: instances. A typical form of data, each variable consists of a column and an instance of a row, which is called a dataset.


name age sex height
A 10 male 153
B 15 female 161
C 21 male 181

In constructing a dataset, the number of questions equals the number of variables, and the number of respondents affects the number of observations. However, the number of respondents does not affect the number of variables.
As shown in Table 1.1, all variables are separated by categorical variables and quantitative variables, and variables are separated by nominal, ordinal, discrete, and continuous, depending on the measurement level.


Types of variables
Variable Contents Level
Categorical variables Group(Class) Nominal
Ordinal
Quantitative variables Quantity(Size) Discrete
Continuous

Nominal variables are variables that can only be qualitative classified without logical order. For example, for a dataset of fruits, 1=apples, 2=folds, and 3=watermelons, each fruit is numbered 1, 2 and 3, but the fruit is logically irrelevant between rank and other values. You can only give a name.

Movies can be ranked using rating data that is given within a certain range. However, ratings are subjective evaluations and the intervals between each rating are not constant either. These variables are called ordinal variables.

For quantitative variables, measurement levels have their own ranks, and differences between them are measurable and interrelated. Also, the figure itself is meaningful. Therefore, for the same level, it has the same meaning. For these measurement levels, they are divided into countable variables and uncountable parts, respectively, called discrete and continuous. Discrete refers to a form that can be represented as an integer, such as a population belonging to a certain group, and continuous refers to a form of proportion to absolute criteria such as temperature, height, weight, etc.

Example 1)
  Determine the measurement level of the following variables:
  • Age: discrete, there is a clear measure of measurement, and the difference between ages is meaningful.
  • Party Name: Nominal, this variable can only classify names.
  • Weight: Continuous, absolute reference value 0 exists. You can generate figures proportionally based on zero, but you cannot represent them in clear numbers, such as natural numbers or integers.
  • If students are grouped into three groups A, B, and C, the variable 'group': nominal
  • If players A, B, and C are participating in steps 5, 2 and 3 respectively, then the variable "Step": ordinal. For this variable, the differences within or between steps are not necessarily equal.
  • The movie was evaluated on a 5-point scale such as very good, good,... The level of the variable in this outcome: ordinal, in this survey, ordinal number are important. However, the difference between those intervals is not equal.
  • City Name: Nominal. You can just give it a name, but you can't rank it.
  • People's bank balances: continuous. The difference between each value is the same, and the value itself has meaning.

ratio

Distinguish between absolute and relative proportions.

  • absolute proportion: part of a whole
  • Relative Ratio: Increase or decrease relative to another ratio

The reason for the news that a city is not safe with the increase in crime cases is probably the rate of increase. If this news is added with information about a 50% increase in the homicide rate, it gives the basis for the news that it will get worse, but it's still incomplete. Its incompleteness is due to the lack of information about the number of events being compared, such as an increase from 2 to 3 or an increase from 10 to 4. That is, an increase of 50% is for an increase over the number of past events. Previous figures are needed for complete information. In this case, 50% is a relative ratio, and information about the absolute ratio is needed to fully understand this news. For example, in a city with a population of 100,000 people, if 3 cases occurred compared to 2 cases in the previous year, the increase would be 50%, but an absolute increase of 0.2% to 0.3% would significantly weaken the basis of the negative news. As such, the meaning of relative and absolute ratios is very important, and reporting only relative ratios should be avoided.

The following shows the change in population density in Seoul and the neighboring metropolitan area, and unlike the above case, a clear trend is shown by the relative ratio.

Seoul neighboring
Year Density Relative ratio(%) Density Relative ratio(%)
2106 16263 - 25350 -
2017 16136 -0.78 25476 0.50
2018 16034-0.63 25675 0.78
2019 15964 -0.44 25844 0.66

댓글

이 블로그의 인기 게시물

[Linear Algebra] 유사변환(Similarity transformation)

유사변환(Similarity transformation) n×n 차원의 정방 행렬 A, B 그리고 가역 행렬 P 사이에 식 1의 관계가 성립하면 행렬 A와 B는 유사행렬(similarity matrix)이 되며 행렬 A를 가역행렬 P와 B로 분해하는 것을 유사 변환(similarity transformation) 이라고 합니다. $$\tag{1} A = PBP^{-1} \Leftrightarrow P^{-1}AP = B $$ 식 2는 식 1의 양변에 B의 고유값을 고려한 것입니다. \begin{align}\tag{식 2} B - \lambda I &= P^{-1}AP – \lambda P^{-1}P\\ &= P^{-1}(AP – \lambda P)\\ &= P^{-1}(A - \lambda I)P \end{align} 식 2의 행렬식은 식 3과 같이 정리됩니다. \begin{align} &\begin{aligned}\textsf{det}(B - \lambda I ) & = \textsf{det}(P^{-1}(AP – \lambda P))\\ &= \textsf{det}(P^{-1}) \textsf{det}((A – \lambda I)) \textsf{det}(P)\\ &= \textsf{det}(P^{-1}) \textsf{det}(P) \textsf{det}((A – \lambda I))\\ &= \textsf{det}(A – \lambda I)\end{aligned}\\ &\begin{aligned}\because \; \textsf{det}(P^{-1}) \textsf{det}(P) &= \textsf{det}(P^{-1}P)\\ &= \textsf{det}(I)\end{aligned}\end{align} 유사행렬의 특성 유사행렬인 두 정방행렬 A와 B는 'A ~ B' 와 같...

유리함수 그래프와 점근선 그리기

내용 유리함수(Rational Function) 점근선(asymptote) 유리함수 그래프와 점근선 그리기 유리함수(Rational Function) 유리함수는 분수형태의 함수를 의미합니다. 예를들어 다음 함수는 분수형태의 유리함수입니다. $$f(x)=\frac{x^{2} - 1}{x^{2} + x - 6}$$ 분수의 경우 분모가 0인 경우 정의할 수 없습니다. 이와 마찬가지로 유리함수 f(x)의 정의역은 분모가 0이 아닌 부분이어야 합니다. 그러므로 위함수의 정의역은 분모가 0인 부분을 제외한 부분들로 구성됩니다. sympt=solve(denom(f), a); asympt [-3, 2] $$-\infty \lt x \lt -3, \quad -3 \lt x \lt 2, \quad 2 \lt x \lt \infty$$ 이 정의역을 고려해 그래프를 작성을 위한 사용자 정의함수는 다음과 같습니다. def validX(x, f, symbol): ① a=[] b=[] for i in x: try: b.append(float(f.subs(symbol, i))) a.append(i) except: pass return(a, b) #x는 임의로 지정한 정의역으로 불연속선점을 기준으로 구분된 몇개의 구간으로 전달할 수 있습니다. #그러므로 인수 x는 2차원이어야 합니다. def RationalPlot(x, f, sym, dp=100): fig, ax=plt.subplots(dpi=dp) # ② for k in x: #③ x4, y4=validX(k, f, sym) ax.plot(x4, y4) ax.spines['left'].set_position(('data', 0)) ax.spines['right...

부분분수의 미분

내용 방법 1 방법 2 방법 3 부분분수의 미분 분수의 미분은 일정한 공식 을 적용하여 계산할 수 있습니다. 그러나 분수 자체가 단순한 표현으로 이루어지지 않았다면 미분 과정이나 결과는 매우 복잡할 수 있습니다. 만약 복잡한 분수 함수를 간단한 분수들로 분해할 수 있다면 계산이 보다 간편해질 것입니다. 이와 같이 분해된 간단한 분수들을 부분분수 라고 합니다. 예를 들어 다음 두 분수의 합을 계산해 봅니다. $$\begin{align} \frac{1}{x+1}+\frac{2}{x-1}&=\frac{x-1+2(x+1)}{(x+1)(x-1)}\\ &=\frac{3x+1}{x^2-1} \end{align}$$ 위 과정은 3개 이상의 여러 분수에서도 이루어질 수 있습니다. 또한 역으로 진행될 수 있습니다. 즉, 분수를 부분 분수로 분할할 수 있습니다. 그러나 이러한 과정은 대수분수 (분자의 가장 큰 차수가 분모의 최고의 차수보다 작은 분수)에서만 이루어질 수 있습니다. 예를 들어 $\displaystyle \frac {x^2+2}{x^2-1}$의 경우는 분자와 분모의 차수는 2차로 같습니다. 이러한 경우 다음과 같이 분리할 수 있습니다. $$\frac{x^2+2}{x^2-1}=1+\frac{3}{x^2-1}$$ 위의 식 중 $\displaystyle \frac{3}{x^2-1}$은 분자의 차수가 분모의 차수 보다 낮은 대수 분수이므로 부분 분수로 분리할 수 있습니다. 이와같이 부분 분수로 분해하는 방법은 다음과 같이 몇 가지로 구분할 수 있습니다. 방법 1 위 예의 결과 $\displaystyle \frac{3x+1}{x^2-1}$의 경우를 역으로 생각해 봅니다. 분모의 인수분해가 가능하면 그 분모의 인수에 의해 다음과 같이 분해할 수 있습니다. $$\begin{align} \frac{3x+1}{x^2-1}&=\frac{3x+1}{(x+1)(x-1)}\\ &=\frac{A}{x+1...