Department of Psychology
Probability refers to the likelihood of a particular event of interest occurring (Dancey, 2020).
Two similar, but not identical terms (Butler, 2021):
Relative frequency: The proportion of times some event occurs during a certain number of trials
n: Number of times a trial/experiment is run
N(A): The number of times that event A occurs during n trials
N(A)/n: Relative frequency of event A
Probability: The proportion of times an event occurs when the number of trials is very large
This is given by N(A)/n as n approaches infinity
Experiments with fair coin
In R language it is possible to use simulation - sample ()
Create vector with two possibilities
sample(x, size, replace = FALSE, prob = NULL)
sample() has two mandatory arguments. The first argument, x, is the object from which a sample is to be drawn and the second argument, size, is the size of the sample to be drawn.
In real experiments or reproducible research we have situation that we must repeating sampling.
R have replicate() function to simulate sampling the same population many times
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] "Tails" "Heads" "Heads" "Tails" "Tails" "Heads" "Heads"
[2,] "Heads" "Tails" "Heads" "Tails" "Heads" "Heads" "Heads"
[3,] "Tails" "Heads" "Heads" "Tails" "Heads" "Heads" "Heads"
[4,] "Tails" "Tails" "Tails" "Heads" "Heads" "Tails" "Tails"
[5,] "Tails" "Tails" "Heads" "Heads" "Heads" "Tails" "Tails"
[6,] "Tails" "Tails" "Heads" "Tails" "Heads" "Heads" "Tails"
[7,] "Tails" "Tails" "Tails" "Heads" "Heads" "Tails" "Heads"
[8,] "Heads" "Heads" "Heads" "Tails" "Tails" "Heads" "Tails"
[9,] "Heads" "Tails" "Tails" "Tails" "Heads" "Tails" "Heads"
[10,] "Heads" "Tails" "Heads" "Heads" "Tails" "Tails" "Heads"
For the purpose of research in psychology it would be very important to understand conditional probability.
It is probability of some event which is dependent of some other event.
A conditional probability is the probability of a particular event happening if another event (or set of conditions) has also happened (Dancey, 2020).
A probability distribution is a mathematical distribution of scores where we know the probabilities associated with the occurrence of every score in the distribution. We know what the probability is of randomly selecting a particular score or set of scores from the distribution (Dancey, 2020).
The binomial distribution is a discrete probability distribution and describes the outcome of n independent trials in an experiment. Each trial is assumed to have only two outcomes, either success or failure.
Probability distribution that represents the probabilities of binomial random variables in binomial experiment
Let’s imagine an experiment with 10 identical six-sided dice. On one face of each there’s a letter A. Other dice face are empty. If we proceed to roll 10 dice what would be the probability to get 2 with letter A?
N denote the number of dice rolls in our experiment. In R that is parameter size
x a vector that specifying the outcomes whose probability we a trying to calculate
prob success probability for any one trial in the experiment
The d form we’ve already seen: you specify a particular outcome x, and the output is the probability of obtaining exactly that outcome. (the “d” is short for density).
The p form calculates the cumulative probability. You specify a particular quantile q, and it tells you the probability of obtaining an outcome smaller than or equal to q.
The q form calculates the quantiles of the distribution. You specify a probability value p, and gives you the corresponding percentile. That is, the value of the variable for which there’s a probability p of obtaining an outcome lower than that value.
The r form is a random number generator: specifically, it generates n random outcomes from the distribution.
The probability of rolling 0, 1 and 2 letter A?
There is a 77.5% chance that we would roll 2 or fewer letter A.
The other interpretation: the value of 2 is the 77.5 percentile of this binomial distribution
If we want to calculate the 77th percentile of that binomial distribution — use qbinom() function
If we repeat that 100 times… How? What happened with distribution?
Normal distribution
The bell curve distribution
Gaussian distribution
Describing with two parameters: the mean of the distribution μ and the standard deviation of the distribution σ
in R we have also functions: dnorm(), pnorm(), qnorm(), rnorm()
https://rpubs.com/CarstenGrube/573181
Comparison of means
Skewed distributions are those where the peak is shifted away from the centre of the distribution and there is an extended tail on one of the sides of the peak.
A negatively skewed distribution is one where the peak has been shifted to the right towards the high numbers on the scale and the tail is pointing to the low number (or even pointing to the negative numbers).
A positively skewed distribution has the peak shifted left, towards the low numbers, and has the tailed extended towards the high numbers.
Skewness value lower than -1 or higher than +1: distribution is assimetric
Skewness value between -0.5 and -1 as +0.5 and +1 - assimetric but not to much
Skewness value between -0.5 and 0.5 - we could conclude that is simmetric distribution
vars n mean sd median trimmed mad min max range skew kurtosis se
X1 1 10 5.5 3.03 5.5 5.5 3.71 1 10 9 0 -1.56 0.96
vars n mean sd median trimmed mad min max range skew kurtosis se
X1 1 10 6 4.08 5.5 5.5 3.71 1 15 14 0.79 -0.25 1.29
vars n mean sd median trimmed mad min max range skew kurtosis se
X1 1 10 8.2 3.61 8.5 8.5 3.71 1 13 12 -0.48 -0.87 1.14
Kurtosis is a measure of the peakedness or how heavy the tails of a distribution.
The kurtosis of a normal distribution is 3.
If a given distribution has a kurtosis less than 3, it is said to be playkurtic, which means it tends to produce fewer and less extreme outliers than the normal distribution.
If a given distribution has a kurtosis greater than 3, it is said to be leptokurtic, which means it tends to produce more outliers than the normal distribution.
The qq plot is used to assess the normality of a distribution of sample data.
The better the data points fit the qq line, the more normal the data is.
QQ plots tend to make it easier to find outliers
The Poisson distribution is used in situations when we observe the counts of events within a set unit of time, area, volume, length…
The Poisson distribution is a discrete probability distribution for the counts of events that occur randomly in a given interval of time (or space).
Binomial and Poisson distributions - probability distributions were characterized by a formula for the probability of each possible discrete value.
Given that 5% of a population are left-handed, use the Poisson distribution to estimate the probability that a random sample of 100 people contains 2 or more left-handed people
Create variable with some data… analysis with psych package (Revelle, 2022)