Introduction Odds Ratio (2015)

Introduction Odds Ratio

An odds ratio is a relative measure of effect, allowing the comparison of the intervention group of a study relative to the comparison or placebo group.

Medical students, students from clinical and psychological sciences, professionals allied to medicine enhancing their understanding and learning of medical literature, and researchers from different fields of life usually encounter Odds Ratio (OR) throughout their careers.

When computing the OR, one would do:

  • The numerator is the odds in the intervention arm
  • The denominator is the odds in the control or placebo arm= OR

Calculating ODDs Ratios

The ratio of the probability of success and failure is known as the odds. If the probability of an event is $P_1$ then the odds are:
\[OR=\frac{p_1}{1-p_1}\]

If the outcome is the same in both groups, the ratio will be 1, implying that there is no difference between the two arms of the study. However, if the $OR>1$, the control group is better than the intervention group while, if the $OR<1$, the intervention group is better than the control group.

The Odds Ratio is the ratio of two odds that can be used to quantify how much a factor is associated with the response factor in a given model. If the probabilities of occurrences of an event are $P_1$ (for the first group) and $P_2$ (for the second group), then the OR is:
\[OR=\frac{\frac{p_1}{1-p_1}}{\frac{p_2}{1-p_2}}\]

If predictors are binary then the OR for $i$th factor is defined as
\[OR_i=e^{\beta}_i\]

Odds Ratio

The regression coefficient $b_1$ from logistic regression is the estimated increase in the log odds of the dependent variable per unit increase in the value of the independent variable. In other words, the exponential function of the regression coefficients $(e^{b_1})$ in the OR is associated with a one-unit increase in the independent variable.

Online MCQs about Economics with Answers

R Programming Language Lectures

Median Definition, Formula, and Example: Quick Guide (2014)

Median Definition

Median (a measure of central tendency) is the middle-most value in the data set when all of the values (observations) in a data set are arranged either in ascending or descending order of their magnitude. The median is also considered a measure of central tendency that divides the data set into two halves, where the first half contains 50% observations below the median value and 50% above the median value. If there are an odd number of observations (data points) in a data set, the median value is the single-most middle value after sorting the data set.

After understanding the median definition, let us consider a few examples to calculate the median for a data set.

Median Example – 1

Question: For the following data set: 5, 9, 8, 4, 3, 1, 0, 8, 5, 3, 5, 6, 3, calculate the median.

Answer: To find the median of the given data set, first sort the data (either in ascending or descending order), that is
0, 1, 3, 3, 3, 4, 5, 5, 5, 6, 8, 8, 9. The middle-most value of the above data after sorting is 5, which is the median of the given data set.

When the number of observations in a data set is even then the median value is the average of two middle-most values in the sorted data.

Median Example – 2

Question: Consider the following data set, 5, 9, 8, 4, 3, 1, 0, 8, 5, 3, 5, 6, 3, 2. Compute the median.

Answer: To find the median first sort it and then locate the middle-most two values, that is,
0, 1, 2, 3, 3, 3, 4, 5, 5, 5, 6, 8, 8, 9. The middle-most two values are 4 and 5. So the median will be the average of these two values, i.e. 4.5 in this case.

The median is less affected by extreme values in the data set, so the median is the preferred measure of central tendency when the data set is skewed or not symmetrical.

Median Formula for Odd Number of Observations

For large data sets it is relatively very difficult to locate median values in sorted data. It will be helpful to use the median value using the formula. The formula for an odd number of observations is
$\begin{aligned}
Median &=\frac{n+1}{2}th\\
Median &=\frac{n+1}{2}\\
&=\frac{13+1}{2}\\
&=\frac{14}{2}=7th
\end{aligned}$

The 7th value in sorted data is the median of the given data.

Median Formula for Even Number of Observations

The median formula for an even number of observations is
$\begin{aligned}
Median&=\frac{1}{2}(\frac{n}{2}th + (\frac{n}{2}+1)th)\\
&=\frac{1}{2}(\frac{14}{2}th + (\frac{14}{2}+1)th)\\
&=\frac{1}{2}(7th + 8th )\\
&=\frac{1}{2}(4 + 5)= 4.5
\end{aligned}$

Median definition formula example

The computation of the median is a crucial step in exploratory data analysis (EDA). It helps identify potential outliers, assess skewness in the data distribution, and choose appropriate statistical methods for further analysis.

Applications of Median in Different Scenarios

1. Resisting Outliers: The median’s primary strength lies in its resistance to outliers. Unlike the mean (which can be swayed by extreme values), the median remains unaffected and stable by a few very high or very low data points (extreme observations).

2. Analyzing Skewed Distributions: When dealing with data that is not symmetrical (has skewed distributions), the median provides a more accurate representation of the “center” of the data compared to the mean/average. The median reflects the value that divides the data into halves, whereas the mean gets pulled towards the tail of the skewed distribution.

3. Ease of Interpretation: The median is a simple concept – the middle (centermost) value when the data is arranged in order (either ascending or descending).

Note that the median measure of central tendency, cannot be found for categorical data.

FAQs about Median

  1. What is the median?
  2. What is the advantage of the median over other measures of central tendencies?
  3. On what kind/type of data median can be computed?
  4. What is the benefit of using the median?
  5. Write the formula for the median when the number of observations is even and when the number of observations is odd.
  6. How median is interpreted?
  7. In how many groups median classify the data/sample/population?
https://itfeature.com

Online MCQs Test website

R Programming Language

Pseudo Random Numbers (2014)

A sequence of Pseudo Random Numbers is generated by a deterministic algorithm and should simulate a sequence of independent and uniformly distributed random variables on the interval [0, 1]. Every random experiment results in two or more outcomes.

A variable whose values depend upon the outcomes of a random experiment is called a random variable denoted by capital letters $X, Y$, or $Z$ and their values by the corresponding small letters $x, y$, or $z$.

Pseudo Random Numbers and their Generation

Random numbers are a sequence of digits from the set {0,1,2,⋯,9} so that, at each position in the sequence, each digit has the same probability 0.1 of being selected irrespective of the actual sequence, so far constructed.

The simplest ways of achieving such numbers are games of chance such as dice, coins, and cards, or by repeatedly drawing numbered slips out of a jar. These are usually grouped purely for the convenience of reading but this would become very tedious for long runs of each digit. Fortunately, tables of random digits are widely available now.

Pseudo Random Numbers and Their Process

pseudo random process is a process that appears to be random but actually, it is not. Pseudo random sequences typically exhibit statistical randomness while being generated by an entirely deterministic causal process. Such a process is easier to produce than a genuinely random one and has the benefit that it can be used again and again to produce the same numbers and they are useful for testing and fixing software.

For implementation on computers to provide a sequence of such digits easily, and quickly, the most common methods are called Pseudo Random Technique.

Here, the digit will eventually reappear in the same order (cycle. For a good technique, the cycle might be tens of thousands of digits long. Of course, the pseudorandom numbers/digits are not truly random. They are completely deterministic but they do exhibit most of the properties of random digits. Generally, their methods involve the recursive formula e.g.

\[X_{n+1}= a x_n +b\, mod\, m; n=0, 1, 2, …\]

$a, b$, and $n$ are suitably chosen integer constants and the seed $x_0$ (a starting number i.e. n = 0) is an integer. (Note mode $m$ means that if the result from the formula is greater than m, divide it by m and keep the remainder as a random number.

Use of this formula gives rise to a sequence of integers each of which is in the random 0 to $m-1$.

Example (Pseudorandom Numbers Generation)

let a = 13, b=5, and m = 1000, Generate 500 random numbers.

Solution

\[x_{n+1}=a \, x_n + \,b\, mod\, 1000; n=0,1,2,…\]

let seed $x_0=5$, then for $n=0$ we have

\begin{align*}
x_{0+1}&=13 \times 5 +5\, mod\, 1000=70\\
x_{1+1}&=13 \times 70 + 5\, mod\, 1000=915
\end{align*}

Pseudo Random Numbers

Application of Random Variables

The random numbers have wide applicability in the simulation techniques (also called Monte Carlo Methods) which have been applied to many problems in the various sciences and one useful in situations where direct experimentation is not possible, the cost of experimenting is very high or the experiment takes too much time.

R code to Generate Random Number

# store the pseudo random output
a = 13
b = 5
m = 1000
sim = 500
x <- numeric (sim)
x[0] = 5
for (i in 1: sim){
  x[i+1] <- (a * x[i] + b ) %% 1000
}
x[2:sim]
Pseudo Random Numbers Generation

Pseudo random numbers (PRNs) are a cornerstone of computer simulations and many other applications. However, computers cannot generate true randomness and PRNs are used extensively in many fields, including:

  • Simulations: Modeling complex systems like Financial market analysis, weather patterns, or traffic flow often relies on PRNs.
  • Games: From card shuffles to enemy movement in computer video games, PRNs add an element of chance and keep things interesting.
  • Cryptography: While not the only source, PRNs are used to generate encryption keys that appear random and improve security.

Read more about Pseudo Random Process | Random Number Generation and Linear Congruential Generator (LCG)

Read more on Wikipedia: Pseudo Randon Numbers generator

Generate Binomial Random Numbers in R