Programming tutorials - page 15

 

Confidence Intervals and the Central Limit Theorem


Confidence Intervals and the Central Limit Theorem

Hello everyone, today we will be applying the Central Limit Theorem and constructing confidence intervals for the population mean. The formula for the confidence interval for the population mean, mu, relies on the assumption that the population being sampled follows a perfectly normal distribution with mean mu and variance sigma squared. However, in many cases, this assumption is not reasonable. For example, when determining the average length of calls from a phone bank, the distribution of call lengths is unlikely to be normal. It is more likely to have a histogram with a skewed distribution, rather than a bell curve.

Nevertheless, we can still construct a confidence interval for the population mean, mu, by utilizing the Central Limit Theorem. This theorem states that as long as the sample size, n, is sufficiently large (usually n ≥ 30), the sampling distribution of the sample mean will be approximately normally distributed, regardless of the shape of the population distribution. To visualize this, imagine repeatedly taking samples of size n, calculating the sample mean (x bar) each time, and creating a histogram of those sample means. According to the Central Limit Theorem, that histogram will exhibit a bell-shaped curve centered around the population mean, with a spread measured by the population variance divided by the sample size.

It is important to note that this approximation improves as the sample size, n, increases. Let's work through a couple of examples to illustrate this concept. Suppose the standard deviation of calls to the phone bank is sigma = 1 minute, and we are obtaining samples of size 81. The distribution of sample means (x bar) will be approximately normal, with a mean equal to the population mean and a standard deviation of sigma divided by the square root of n (1 / √81 ≈ 0.11 in this case).

With this information, we can compute confidence intervals, similar to when the population distribution is known to be normal. However, we must remember that these confidence intervals are only approximate. For instance, if we have a sample of size 81 and find a sample mean of 1.1 minutes, we can construct a 95% confidence interval for the population mean using the formula:

mu ≈ x bar ± z star * sigma / √n

By plugging in the values (x bar = 1.1, sigma = 1.0, n = 81), and using the critical z value (z star) corresponding to 95% confidence (1.960), we find that the population mean (mu) is approximately 1.1 ± 0.22 minutes with 95% confidence.

Let's consider another example. A large corporation employs thousands of clerks at retail stores nationwide. In a sample of size 35, the mean number of hours worked per week was 23. We want to construct a 90% confidence interval for the mean number of hours worked by all clerks employed by this corporation, assuming a standard deviation (sigma) of 5 hours. We can use the same formula:

mu ≈ x bar ± z star * sigma / √n

By plugging in the values (x bar = 23, sigma = 5, n = 35), and using the critical z value (z star) corresponding to 90% confidence (1.645), we find that the population mean (mu) is approximately 23 ± 1.4 hours with 90% confidence.

In summary, even if the population distribution is not exactly normal, we can still use the Central Limit Theorem to construct approximate confidence intervals for the population mean. These intervals provide valuable insights and help us make statistical inferences, understanding the level of confidence associated with our estimates.

Confidence Intervals and the Central Limit Theorem
Confidence Intervals and the Central Limit Theorem
  • 2020.08.11
  • www.youtube.com
The central limit theorem lets us build confidence intervals for the mean even when the shape of the population distribution isn't known. If this vid helps y...
 

Confidence Intervals and Sample Size


Confidence Intervals and Sample Size

Hello everyone, today we will be discussing confidence intervals and sample size. When we have a simple random sample of size "n" with a sample mean "x bar," we can construct a level "c" confidence interval for the population mean "mu" using the formula:

mu = x bar ± z star * sigma / √n

Here, "z star" represents the critical z score corresponding to the confidence level "c," and "sigma" is the population standard deviation. The term "z star * sigma / √n" is referred to as the margin of error, which is an estimate of how much our sample mean may deviate from the true population mean "mu."

The idea behind constructing a confidence interval is that, roughly speaking, "mu" will fall within the margin of error of "x bar" a percentage "c" of the time.

Now, let's consider a practical question: How large of a sample do we need if we want the margin of error to be no larger than a specified threshold "e"? In this case, we know "e," the desired margin of error, "c," the level of confidence, and "sigma," the population standard deviation (assuming it's known). We need to find the required sample size "n" by solving the equation algebraically.

To calculate the sample size, we multiply both sides of the equation by √n, divide both sides by "e," and then square both sides, which gives us:

n = (z star * sigma / e)^2

If the resulting value of "n" is not an integer, which is often the case since "z star" tends to be irrational, we round it up to the nearest whole number. It's important to note that increasing the sample size decreases the margin of error, and rounding down "n" could potentially increase the margin of error beyond the desired threshold "e."

The critical z score, "z star," is determined by the specified confidence level "c." This value can be computed using technology or by referring to a table. Although using tables for statistical calculations is not typically recommended, in the case of commonly used confidence levels, such as a 95% confidence level (corresponding to a z score of 1.960), the table is small and reasonable to use.

Let's consider an example: Suppose we want to determine a statistician's weight to the nearest half pound with 95% confidence using a scale with a standard deviation of 1.2 pounds. How many times do we need to weigh the statistician?

By plugging the given values into the sample size formula, we find that the minimum required sample size is 23 weighings, which we round up to 23. Therefore, we need to weigh the statistician 23 times to know their weight to the nearest half pound with 95% confidence.

As expected, if we increase the confidence level or decrease the margin of error, the required sample size will also increase. Conversely, if we increase the margin of error, the sample size needed will decrease.

In another example, let's say a manufacturer wants to determine the mean weight of a certain type of iron nail within 0.2 grams with 99% confidence, and the population standard deviation is 0.5 grams. By applying the sample size formula, we find that a minimum sample size of 42 nails is needed to achieve a 99% confidence level with a margin of error no worse than 0.2 grams.

Understanding confidence intervals and their relationship to sample size allows us to plan studies and experiments effectively, ensuring that our estimates are accurate and reliable within the desired level of confidence and precision.

Confidence Intervals and Sample Size
Confidence Intervals and Sample Size
  • 2020.08.03
  • www.youtube.com
Choosing the correct sample size to accommodate a required margin of error is easy! Let's see how to do it. If this vid helps you, please help me a tiny bit ...
 

Confidence Intervals Using the t-Distribution


Confidence Intervals Using the t-Distribution

Hello everyone, in today's session, we will be constructing confidence intervals using the t-distribution. In our previous discussions, we used the formula mu equals x bar plus or minus z-star sigma over the square root of n to approximate the population mean mu with the sample mean x bar and calculate the margin of error. However, this formula assumes that we know the population standard deviation sigma, which is often not the case.

To overcome this limitation, we can estimate the population standard deviation sigma using the sample standard deviation s. The formula for the confidence interval with the t-distribution is similar to the previous one, with a slight modification. Instead of the critical z-score, we use the critical t-value based on the chosen level of confidence. The t-distribution describes the variability of the variable t, which is given by t equals x bar minus mu over s divided by the square root of n. The t-distribution is symmetric and bell-shaped, similar to the standard normal distribution, but with slightly more spread for smaller sample sizes.

To construct a confidence interval, we need to find the cutoff values for t, denoted as t-star, such that the probability of t being between negative t-star and positive t-star is equal to the chosen confidence level. Once we determine t-star, we can calculate the confidence interval using the formula mu equals x bar plus or minus t-star s over the square root of n.

Let's work through an example. A group of researchers wants to investigate sodium concentrations in a Canadian lake. They collected 23 samples and found a mean of 24.7 parts per million and a sample standard deviation of 4.2 parts per million. We want to construct a 95% confidence interval for the mean sodium concentration in the lake. Since we don't know the population standard deviation, we will use the t-distribution.

Plugging in the values, we have x bar equals 24.7, s equals 4.2, and n equals 23. To find the critical t-value, we need to determine the t-star value that corresponds to leaving 2.5% of the area on each side of the t-distribution. Using an inverse t calculation, we find that t-star is approximately 2.074.

Now we can construct the confidence interval: 24.7 plus or minus 2.074 times 4.2 divided by the square root of 23. Simplifying this expression, we get a confidence interval of 24.7 plus or minus 1.8.

It's worth noting that the critical t-value, 2.074, is slightly larger than the critical z-score would have been for the same confidence level. This is because we are estimating the population standard deviation, introducing some additional uncertainty, resulting in a slightly wider confidence interval.

In summary, when constructing confidence intervals without knowing the population standard deviation, we use the t-distribution and estimate the population standard deviation with the sample standard deviation. The rest of the process is similar to constructing confidence intervals with known standard deviation, but with critical t-values instead of critical z-scores.

Confidence Intervals Using the t-Distribution
Confidence Intervals Using the t-Distribution
  • 2020.08.15
  • www.youtube.com
How do we construct confidence intervals when the population standard deviation is unknown? Easy! We use the t-distribution. If this vid helps you, please he...
 

Using R to Calculate in the t-Distribution


Using R to Calculate in the t-Distribution

Hey everyone, today we'll be performing some calculations using the t-distribution in R. We'll work through three problems step by step. Let's dive right in!

First, let's talk about how we compute probabilities in the t-distribution using the cumulative distribution function (CDF). By plugging in a specific t-value, such as 0.44, the CDF gives us the probability of randomly obtaining a t-score less than or equal to that value. Visually, this corresponds to graphing a bell curve since t-distributions exhibit bell-shaped patterns.

To find the probability, we label the t-score of interest (0.44) and shade the area to the left of that score. This shaded area represents the probability we're looking for. I strongly recommend using R for t-distribution calculations instead of relying on tables, as they can be challenging and less accurate. In R, the command corresponding to the CDF of a t-distribution is pt, which requires two arguments: the t-value (0.44) and the number of degrees of freedom (26).

Let's switch over to R and execute the pt command: pt(0.44, 26). The result is approximately 0.668, indicating that the probability of randomly obtaining a t-score less than or equal to 0.44 in this t-distribution is around 66.8%.

Now, let's move on to problem two. We want to find the probability that t is between -0.8 and 0.5 in a t-distribution with 19 degrees of freedom. To solve this, we calculate the area to the left of t = 0.5 and subtract the area to the left of t = -0.8. We can achieve this by using two pt commands with a subtraction in between: pt(0.5, 19) - pt(-0.8, 19). The result is approximately 0.472, indicating that the probability of randomly obtaining a t-score between -0.8 and 0.5 in a t-distribution with 19 degrees of freedom is approximately 47.2%.

Moving on to problem three, we need to find a value (tau) in the t-distribution with 50 degrees of freedom, such that the probability of obtaining a t-score less than or equal to tau is 0.3. This involves an inverse CDF calculation. We can use the qt function in R, providing the probability (0.3) and the number of degrees of freedom (50). Let's execute the qt command: qt(0.3, 50). The result is approximately -0.5277. It's important to note that obtaining a negative number is reasonable since the center of the bell curve in any t-distribution is at t = 0.

Remember, these calculations can be done manually, but R provides convenient functions (pt and qt) to simplify the process. Utilizing these functions saves time and ensures accuracy.

Using R to Calculate in the t-Distribution
Using R to Calculate in the t-Distribution
  • 2020.08.15
  • www.youtube.com
R is a fantastic way to do computations in the t-distribution. If this vid helps you, please help me a tiny bit by mashing that 'like' button. For more #rsta...
 

Confidence Intervals in R


Confidence Intervals in R

Hey everyone, today we'll be working with confidence intervals in R, which is particularly useful when we have an actual data set instead of just summary statistics. In this example, we'll be looking at the CO2 data set and focusing on the "uptake" variable.

Previously, we computed confidence intervals using sample mean (x-bar) and sample standard deviation (s), but now we'll learn a shortcut using the "t.test" command. By providing the variable of interest, in this case, "uptake" from the CO2 data set, the command will default to a 95% confidence level.

The t-test command provides several pieces of information, some of which will become more relevant when we discuss hypothesis testing later. For now, the key details to note are the 95% confidence interval and the point estimate. The confidence interval represents the range of values within which we can estimate the population mean. The point estimate is the sample mean, which serves as a single value estimate for the population mean.

The t-test output also includes the degrees of freedom, which is one less than the sample size. Other information, such as p-values and alternative hypotheses, will be discussed in future videos on significance testing.

Although the t-test output does not directly provide the margin of error, we can calculate it manually. The margin of error for a t-confidence interval follows the formula: T* * (s / sqrt(n)), where s is the sample standard deviation, n is the sample size, and T* is the critical t-value for the desired confidence level.

To find T*, we use the "qt" function and specify the area to the left of T*. For a 95% confidence interval, we want 97.5% of the area to the left of T*. Therefore, we calculate T* as "qt(0.975, 83)". Multiplying T* by the sample standard deviation and dividing it by the square root of the sample size yields the margin of error.

Alternatively, we can use the "t.test" function in R to calculate the confidence interval automatically. To change the confidence level, we add the argument "conf.level=" and specify the desired percentage. For example, setting "conf.level = 90" gives us a 90% confidence interval.

When we decrease the confidence level, the resulting confidence interval becomes narrower. The upper limit of the interval decreases, indicating a higher level of precision in our estimation.

In summary, confidence intervals provide a range of values within which we estimate the population mean. R provides convenient functions like "t.test" and "qt" to simplify the calculations and obtain accurate results.

Confidence Intervals in R
Confidence Intervals in R
  • 2020.03.27
  • www.youtube.com
Quick t-distribution confidence intervals in R. So easy! If this vid helps you, please help me a tiny bit by mashing that 'like' button. For more #rstats joy...
 

Confidence Intervals for Proportions


Confidence Intervals for Proportions

Hello everyone, today we will be constructing confidence intervals for proportions. Often, we come across random processes with two possible outcomes, such as heads or tails, yes or no, or true and false. We want to draw conclusions about the probabilities of these outcomes based on sample data.

To analyze these outcomes, we assign one outcome as a success and encode it as one, while the other outcome is a failure and encoded as zero. It's important to note that the terms "success" and "failure" are arbitrary and don't imply any value judgments on the outcomes.

By encoding the variable this way, we create a discrete random variable, which we'll call X. X can take on two values, one and zero, with probabilities p and (1 - p) respectively. Here, p represents the probability of success.

For this type of random variable, we can compute summary information. The mean or expected value is the sum of all possible values of the random variable weighted by their respective probabilities. For a Bernoulli trial, the mean is equal to p.

The standard deviation of a random variable is the square root of the sum of the squares of the differences between individual values and the expected value, each weighted by their probabilities. For a Bernoulli trial, the standard deviation is given by the square root of (p * (1 - p)).

Now, let's consider running n identical, independent Bernoulli trials, where p remains constant across trials. The proportion of successes in these trials is denoted as p-hat, which equals (1/n) * sum(xi), where xi is one for success and zero for failure. In other words, p-hat is the proportion of successes in the n trials.

As p-hat is just a sample mean, we can apply our knowledge of sampling means to it. The mean of p-hat is equal to p, the same as the mean for an individual Bernoulli trial. The standard deviation of p-hat is equal to the square root of ((p * (1 - p)) / n), which is the standard deviation of a single Bernoulli trial divided by the square root of n. By the central limit theorem, the sampling distribution of p-hat is approximately normal when n is large, typically 30 or more.

Now, let's discuss confidence intervals. In the case of a mean, the basic structure of a confidence interval is mu = x-bar +/- z-star * sigma-sub-x-bar. Similarly, for a proportion, the confidence interval formula is p = p-hat +/- z-star * sqrt((p-hat * (1 - p-hat)) / n).

In the proportion formula, p-hat represents the experimental proportion of successes in our sample, while p is the overall probability of success that we're trying to estimate. The margin of error decreases when p-hat is close to zero or one, so it's advisable not to use this confidence interval in such cases.

To determine the required sample size for a given margin of error (e), we use the formula n = (p-hat * (1 - p-hat) * z-star^2) / epsilon^2. If we don't have preliminary data, we can use the most conservative estimate, p-hat = 0.5, which gives the largest possible sample size. In this case, the formula becomes n = (z-star^2) / (4 * epsilon^2).

Let's consider an example. Suppose we want to conduct a survey with 95% confidence, and the margin of error should be no larger than 3%. Since we have no preliminary data, we'll use the conservative estimate p-hat = 0.5. Plugging in the values z-star = 1.96 and epsilon = 0.03 into the formula, we get:

n = (1.96^2) / (4 * 0.03^2) ≈ 1067.1

Since the sample size must be an integer, we round up the value to ensure the margin of error doesn't exceed 3%. Therefore, we would need a sample size of 1068 for this survey.

In summary, constructing confidence intervals for proportions involves assigning success and failure values, computing sample means and standard deviations, and using the appropriate formulas to determine confidence intervals. It's important to consider the conditions for using these intervals and adjust the sample size based on the desired margin of error.

Confidence Intervals for Proportions
Confidence Intervals for Proportions
  • 2020.10.11
  • www.youtube.com
How can we estimate a population proportion using only a sample proportion? Using a confidence interval, of course! If this vid helps you, please help me a t...
 

Confidence Intervals for Proportions: Examples


Confidence Intervals for Proportions: Examples

Today we will be working on two example problems that involve constructing confidence intervals for proportions. Let's dive into the problems:

Problem 1: A survey of 275 randomly selected American adults reveals that 29 of them drink coffee. We need to construct a 90% confidence interval for the proportion of all American adults who drink coffee.

Using the formula for a confidence interval for proportions: p = p̂ ± z√(p̂(1 - p̂)/n), where p̂ is the sample proportion, n is the sample size, and z is the critical z-value corresponding to the desired confidence level.

Given p̂ = 29/275 = 0.1055, n = 275, and z* = 1.645 (for a 90% confidence level), we can plug in these values:

p = 0.1055 ± 1.645 * √((0.1055 * (1 - 0.1055))/275)

Calculating this expression, we find that the confidence interval for the proportion of American adults who drink coffee is approximately 0.1055 ± 0.045. Thus, we can estimate with 90% confidence that the true proportion falls within the interval (0.0605, 0.1505).

Problem 2: A researcher wants to study tea drinking in America and needs to determine the sample size required to guarantee a margin of error no larger than 4%.

Using the formula for the margin of error in a confidence interval for proportions: e = z*√(p̂(1 - p̂)/n), we can rearrange it to solve for the sample size:

n = (z*^2 * p̂(1 - p̂)) / e^2.

In this case, we don't have any preliminary data, so we use the most conservative estimate for p̂, which is 0.5 (indicating maximum variability). Given z* = 1.645 (for a 90% confidence level) and e = 0.04, we can substitute these values into the formula:

n = (1.645^2 * 0.5(1 - 0.5)) / 0.04^2

Simplifying the expression, we find that the minimum required sample size is approximately 257.03. Since the sample size must be an integer, we round up to ensure the desired margin of error is not exceeded. Therefore, a sample size of 258 is required to guarantee a margin of error no larger than 4%.

In summary, constructing confidence intervals for proportions involves using formulas that incorporate sample proportions, sample sizes, and critical values. By applying these formulas, we can estimate population proportions within a specified level of confidence and determine the sample size needed to achieve a desired margin of error.

Confidence Intervals for Proportions: Examples
Confidence Intervals for Proportions: Examples
  • 2020.10.12
  • www.youtube.com
Constructing a confidence interval for a population proportion using sample data, and planning the sample size of a study. Awesome! If this vid helps you, pl...
 

Introduction to Hypothesis Testing


Introduction to Hypothesis Testing

Hello everyone, in today's session, we will dive into hypothesis testing, also known as significance testing. To grasp the concept better, we will work through an example together. Let's begin.

Suppose a chocolate manufacturer claims that their chocolate bars weigh, on average, 350 grams. However, I suspect that their claim is overstated, and the true mean weight of their chocolate bars is less than 350 grams. To investigate this, I collect a sample of 10 chocolate bars and record their weights. If the sample mean is below 350 grams, it will provide evidence against the company's claim. If it's equal to or greater than 350 grams, it won't challenge their assertion.

Let's assume that my sample yields a mean weight of 347 grams, which is below 350 grams. Consequently, this result supports my suspicion and challenges the company's claim. However, the company could argue that my sample might have been randomly light, and if I were to collect another sample, it might yield exactly 350 grams or even higher due to random chance. Therefore, I need a method to make a decision between these two possibilities: the company lying or the result being due to chance.

In such a situation, the best we can do is make a probability statement regarding the company's claim. We want to determine the probability that, if the company is telling the truth, we would obtain a sample mean as low as the one we observed purely by chance. A lower probability indicates stronger evidence against the company's claim.

To proceed mathematically, let's assume the null hypothesis, denoted as H0, which aligns with the company's claim. In this case, the null hypothesis states that the population mean of all chocolate bars is exactly 350 grams. On the other hand, we have the alternative hypothesis, denoted as Ha, which represents what we aim to establish. In this case, Ha asserts that the mean weight of all chocolate bars is less than 350 grams (Ha: μ < 350).

It's important to note that both H0 and Ha refer to population parameters, not the sample mean (x-bar). We haven't mentioned x-bar yet because we will use it to make a decision between H0 and Ha.

To calculate the probability, we need to consider the sampling distribution of x-bar. We assume the null hypothesis is true and envision obtaining multiple samples of size 10. What does the distribution of x-bar look like? While individual chocolate bars may vary in weight, the average weight (x-bar) will, on average, align with the population mean (μ).

The central limit theorem further helps us understand the sampling distribution. For a sufficiently large sample size (often n > 30), the sampling distribution of x-bar approximates a normal distribution with mean μ and standard deviation σ/√n. If the population distribution itself is normal, the approximation is exact, and the distribution of x-bar is precisely normal.

Imagine the blue curve representing individual chocolate bars, where there is an average weight of 350 grams under the null hypothesis. Some bars may be slightly heavier or lighter, and a few may deviate significantly. Now visualize the green curve, which represents the sampling distribution of x-bar. On average, x-bar will be 350 grams if the null hypothesis is true, with some slight variation. However, the variability in x-bar will be less compared to individual bars because extreme weights tend to balance each other out in a sample.

Let's assume we know the standard deviation of the chocolate bars, which is 4 grams. Although this might not be a value we typically know, we will address that in future videos. With the null hypothesis of μ = 350 grams and the central limit theorem, we have all the necessary information about the sampling distribution of x-bar. It will follow a normal distribution with a mean of 350 grams and a standard deviation of 4 grams divided by the square root of 10 (since the sample size is 10), which is approximately 1.26 grams.

To calculate the probability of obtaining a sample mean (x-bar) less than or equal to 347 grams purely by random chance, we can compute a z-score. The probability that x-bar is less than or equal to 347 grams is equal to the probability that the corresponding z-score is less than or equal to (347 - 350) / 1.26, which simplifies to -2.37.

Using statistical software or a table, we find that the probability of a standard normal distribution being less than or equal to -2.37 is approximately 0.0089. This probability is called the p-value.

Now, let's discuss the interpretation of the p-value. In this case, the p-value of 0.0089 is relatively small. The p-value represents the probability of obtaining a sample mean of 347 grams or less if the null hypothesis (μ = 350 grams) is true. A small p-value suggests that it is unlikely to observe such a low sample mean if the null hypothesis is true.

There are two possibilities to consider: First, it's possible that the null hypothesis is true, and we observed a rare event (sample mean of 347 grams or less) by chance, which occurs approximately 0.0089 of the time. Second, it's possible that the null hypothesis is false (as we initially suspected), and the alternative hypothesis (μ < 350 grams) is true.

Since the p-value of 0.0089 is quite low, the first possibility seems unlikely. Therefore, we reject the null hypothesis (H0: μ = 350 grams) and support the alternative hypothesis (Ha: μ < 350 grams). This leads us to conclude that there is strong evidence to suggest that the population mean weight of the chocolate bars produced by this company is indeed less than 350 grams.

In closing, we have covered the basic steps of conducting a hypothesis test. However, there are additional questions that we have not yet addressed, such as determining the threshold for a small enough p-value, considering alternative hypotheses, and dealing with situations where population parameters are unknown. In future videos, we will explore these questions and provide further insights into hypothesis testing.

Introduction to Hypothesis Testing
Introduction to Hypothesis Testing
  • 2020.10.29
  • www.youtube.com
Let's talk about hypothesis testing (also known as significance testing). How can we test a claim about a population using just sample data? What is a p-valu...
 

Statistical Significance


Statistical Significance

Good day, everyone! Today, we will delve deeper into the concept of hypothesis testing and discuss the idea of statistical significance. Hypothesis tests come in various forms, with the most common ones being the z-test and t-test for population means. Nevertheless, the fundamental logic remains the same.

First, we assume that the null hypothesis is true. Then, we gather a sample of data and calculate the probability of obtaining a similar sample purely by random chance, assuming the null hypothesis is correct. This probability is known as the p-value of the test. A lower p-value indicates stronger evidence against the null hypothesis.

However, in most cases, simply comparing p-values might not be sufficient to make a definitive decision. Thus, it is often helpful to establish a predetermined cutoff p-value, known as the significance level alpha, before conducting the hypothesis test. Commonly, alpha is set at 0.05, although it can vary.

When we reject the null hypothesis based on a p-value that is less than alpha, we consider the results to be statistically significant. In other words, the evidence supports the alternative hypothesis. Now, let's explore a couple of examples to illustrate these concepts.

Example 1: A chocolate manufacturer claims that the mean weight of their chocolate bars is 350 grams. However, we suspect that the true mean weight is lower. We set up a significance test by stating a null hypothesis that the company's claim is true and an alternative hypothesis that the mean weight is less than 350 grams. We decide in advance to use a significance level of alpha equals 0.05.

After collecting a sample of size 10 and calculating a sample mean of 347 grams, we determine the probability of obtaining results as extreme as this, assuming the null hypothesis is true. This results in a p-value of 0.0089. Since this p-value is less than 0.05, we reject the null hypothesis and conclude that the average weight of the company's chocolate bars is indeed less than 350 grams.

Example 2: Medical researchers conduct a study to test the effectiveness of a new weight loss medication. They choose a significance level of alpha equals 0.01. The null hypothesis states that the mean weight loss compared to a placebo is zero, while the alternative hypothesis suggests a positive mean weight loss. After analyzing the data, they obtain a p-value of 0.045. As the p-value is greater than the chosen significance level of 0.01, they cannot reject the null hypothesis. Therefore, there is insufficient evidence to conclude that the treatment is superior to the placebo on average.

It's important to note that the conclusion could have been different if they had chosen a significance level of alpha equals 0.05 instead. This highlights a potential pitfall of significance testing and the use of alpha thresholds. Blindly relying on hypothesis testing for decision-making can be risky. Always report the p-value alongside any decision made based on the significance level alpha. Additionally, be cautious when interpreting p-values and consider various factors, as I will discuss in the next video.

Statistical Significance
Statistical Significance
  • 2020.10.30
  • www.youtube.com
Let's talk about statistical significance! What's up with alpha anyway?? If this vid helps you, please help me a tiny bit by mashing that 'like' button. For ...
 

Hypothesis Testing: One- and Two-Sided Alternatives


Hypothesis Testing: One- and Two-Sided Alternatives

In today's discussion, we will delve deeper into the concept of hypothesis testing, specifically focusing on one-sided and two-sided alternative hypotheses. Let's begin by revisiting the fundamental structure of a hypothesis test for the mean.

The first step is to identify the null hypothesis, denoted as H₀. This statement pertains to the population mean and represents the claim we aim to gather evidence against. Following that, we establish an alternative hypothesis, denoted as Hₐ, which contradicts the null hypothesis and typically represents the hypothesis we seek to establish. The notion behind this process is that by accumulating evidence against the null hypothesis, we indirectly accumulate evidence in favor of the alternative hypothesis.

Subsequently, we collect data and compute a sample mean, denoted as x̄. From there, we determine the probability (p-value) of obtaining a sample mean that is as extreme as the one we observed, assuming the null hypothesis is true. The p-value signifies the strength of evidence against the null hypothesis, with lower values indicating stronger evidence in favor of the alternative hypothesis. Often, we conclude the hypothesis test by comparing the p-value to a pre-determined cutoff, referred to as alpha, which denotes the significance level of the test. If the p-value is less than alpha, we reject the null hypothesis. It is crucial to note that the significance level alpha must be chosen prior to data collection.

Now, let's explore alternative hypotheses in more detail. In the previous discussion, we stated that the alternative hypothesis is chosen to contradict the null hypothesis. Even for a simple null hypothesis of mu equals mu₀, where mu₀ represents a hypothesized value, there are three potential alternative hypotheses:

  1. mu < mu₀: This alternative hypothesis asserts that the population mean, mu, is less than the hypothesized value, mu₀.
  2. mu > mu₀: This alternative hypothesis suggests that the population mean, mu, is greater than the hypothesized value, mu₀.
  3. mu ≠ mu₀: This alternative hypothesis makes no assumptions regarding the specific value of mu.

The first two alternative hypotheses are referred to as one-sided alternatives due to their focus on a specific direction, while the third alternative is known as a two-sided alternative hypothesis. Each of these alternatives contradicts the null hypothesis in slightly different ways.

When conducting a hypothesis test for the mean, the choice between these options depends on real-world considerations. As a general guideline, it is advisable to select the two-sided alternative hypothesis unless there is a specific reason, grounded in real-world factors, to assume that the population mean cannot or should not be larger or smaller than the value provided by the null hypothesis, mu₀.

To enhance our understanding, let's proceed with some examples. The first example involves a candy company claiming that the mean weight of its chocolate bars is 350 grams. If we suspect that the mean weight is actually less, the null hypothesis would be the company's claim, while the alternative hypothesis would be mu < 350 grams. In this case, we are solely concerned with the possibility that the chocolate bars' mean weight is lower than 350 grams.

In the second example, a teaching manual asserts that a specific exercise takes an average of 30 minutes. The null hypothesis would be the manual's claim, mu = 30, and the alternative hypothesis would be mu ≠ 30. Here, we have no justifiable reason to exclude or disregard the possibility that mu is either less than or greater than 30.

In the third example, an oil change business maintains that, on average, they complete an oil change in 15 minutes. Suppose we suspect that the actual time is longer.

If the p-value is less than or equal to the significance level (alpha), we reject the null hypothesis. This means that the data provides strong evidence against the null hypothesis and supports the alternative hypothesis. On the other hand, if the p-value is greater than the significance level, we fail to reject the null hypothesis. In this case, the data does not provide sufficient evidence to reject the null hypothesis, and we do not have enough support for the alternative hypothesis.

It's important to note that failing to reject the null hypothesis does not necessarily mean that the null hypothesis is true. It simply means that the data does not provide significant evidence to support the alternative hypothesis. The absence of evidence against the null hypothesis does not prove its truth.

The choice between a one-sided or two-sided alternative hypothesis depends on the specific research question and the hypotheses you want to address. If you are interested in determining whether the population mean is significantly different from a specific value, you would choose a two-sided alternative hypothesis. This allows you to consider both possibilities of the mean being greater or smaller than the hypothesized value.

However, if you have a specific reason to believe that the mean can only be larger or smaller than the hypothesized value, you can choose a one-sided alternative hypothesis. This narrows down the focus of the test to only one direction of deviation from the null hypothesis.

In summary, hypothesis testing involves formulating a null hypothesis, which represents the statement you want to gather evidence against, and an alternative hypothesis, which contradicts the null hypothesis. Data is collected, and a test statistic is computed, such as the sample mean. The p-value is then calculated, representing the probability of obtaining a test statistic as extreme as the one observed, assuming the null hypothesis is true. The choice of a one-sided or two-sided alternative hypothesis depends on the research question and the specific assumptions about the population parameter. Finally, the p-value is compared to the significance level, and a decision is made whether to reject or fail to reject the null hypothesis based on the evidence provided by the data.

Hypothesis Testing: One- and Two-Sided Alternatives
Hypothesis Testing: One- and Two-Sided Alternatives
  • 2020.10.31
  • www.youtube.com
How do we determine the an alternative hypothesis when setting up a hypothesis test? How does our choice affect the way we calculate a p-value?
Reason: