Answer to the following exercises in the form of a script that would run the exercise in R with success. Don't forget to include your comments preceded by the character # and indent the code if needed. Use comments to identify your answers to different points (note that there are sub points inside each exercise:
1. Use the built in family of normal distribution functions to answer to the following questions 1.1) What is the height of the probability density function of a random continuous normal distributed (with mean=0 and standard deviation=3.5) variable X, for x=4. 1.2) What is the cumulative probability of such distribution at P(X)<=5?
2. Use the built in family of t distribution functions to answer to the following questions. Imagine you are testing if a sample mean obtained from a sample with n = 20 observations could belong to a particular normal distribution. Doesn't matter exactly what type of comparison you were making for the sake of this example. Let's assume you obtained a value of t = 0.78 for this sample. 2.1) What is the density for this t value given the relevant t distribution (df=n-1)? 2.2) What is the p value of the test (i.e., the probability of observing that t value or one more extreme given the t distribution for that sample size)? 2.3) What is your conclusion about this test if you use a α (type error I) of 5%? 2.4) what is the critical value for this t distribution if we set α to 1%?
3. The F distribution is used to test the null hypothesis that two samples came from a population with equal variance. It consist in the distribution of ratios that we would obtain if we sampled a population using one sample of size n₁ and calculated the variance of that sample (s₁²), then we would sample the same population with sample 2 of size n₂ (note that n₁ and n₂ can be different), and calculated the variance of sample 2 (s₂²). We would then calculate the ratio F= s₁²/ s₂². Finally we would repeat the process many times keeping the same sample sizes n₁ and n₂, we would then have enough F points to look at the sampling distribution of F. The samples sizes dictate the degrees of freedom, df₁ and df₂ of the F distribution (df₁=n₁-1 and df₂=n₂-1) and there are many different F distributions depending on the degrees of freedom in the numerator and denominator.
Given the variances s₁²= 0.953 and s₂² = 0.345 with 3 and 10 degrees of freedom respectively, use the R built in F distribution functions to answer to the following questions:
3.1) Is variance σ₁² larger than σ₂²? Give support to your answer in the form of a p value.
3.2) Is this a one or a two tailed test (note that the larger variance always goes in the numerator)?
3.3) Depending on your answer to 3.2, use the conventionally used type error I and show the code that outputs the critical value of F for that α
3.4) Explore how the degrees of freedom in the numerator affect the shape and location of the F distribution by plotting in the same graph the probability density functions of 3 different F distributions. The degrees of freedom in the denominator should be fixed to 20 for these 3 distributions, the degrees of freedom in the numerator are 2, 5, and 10 respectively. Hint1: you will need to create a vector of values that will represent your F values and produce their density with df() using the x, df₁ and df₂ parameter values for each distribution. The latter will be your y values and the original vector of F values the x values for a plot() with type=”l”. Add the 2nd and third distribution density lines to the same plot using the function lines().
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
#1.2 Cumulative probability
cat("cumulative prob ")
This is only a preview of the solution. Please use the purchase button to see the entire solution