• Aucun résultat trouvé

Lab 7: Statistical testing with a simulated single sample

N/A
N/A
Protected

Academic year: 2022

Partager "Lab 7: Statistical testing with a simulated single sample"

Copied!
2
0
0

Texte intégral

(1)

Universit´e Joseph Fourier L2/STA230

Lab 7: Statistical testing with a simulated single sample

Objectives: Compute the test statistic, the decision rule for two-sided or one-sided tests.

A statistical test is a decision taken from the information available within the data. Several steps are required:

1. Model the variable of interest with an appropriate random variable.

2. Define the null and alternative hypothesis, calledH0 andH1.

3. Construct the decision rule to rejectH0or not. The decision rule is based on a well-chosen estimator and its distribution underH0. No observation are required to construct the rule.

4. Apply the rule to data and decide if H0 is rejected or not.

Exercise 1

1. Setµ= 2, σ= 3, and N = 1000 andn= 100.

2. SimulateN samples of sizenwith the distributionN(µ, σ2). Compute theN empirical means ¯Xn, and called it Xbar.

We want to choose between the two sets

H0:µ= 2 or (µ≤2) and H1:µ >2 3. First rule: if ¯Xn is greater than 2, then chooseH1; else chooseH0.

Apply this rule to the N samples. What proportion of samples choose H1 ? What does represent this proportion ?

4. Second rule: if ¯Xn is greater than 3, then chooseH1; else chooseH0.

Apply this rule to the N samples. What proportion of samples choose H1 ? What does represent this proportion ? What rule is more conservative ofH0 ?

5. Third rule: we wand to construct a rule at level 5%. The statistic used for this test is T = ( ¯Xn−µ0)

√n σ .

Give the distribution of T under H0. Give the definition of the first kind risk α. Construct the decision rule to rejectH0, for a givenα. Give the definition of a p-value.

6. Apply this third rule to the N samples. What proportion of samples chooseH1 ? Comment.

(2)

Exercise 2

1. Simulate a sampleXof lengthn= 1000 with a normal distribution with meanµ= 10 and standard deviation σ= 1.

2. We consider a test at level 5% for comparing the empirical mean of a sample X to µ0, assuming the variance known. Define the null and alternative hypothesis. Is it a two-tailed or one-tailed test

? Construct the decision rule to reject H0, for a givenα.

3. Compute the p-value of the two-sided test at level 5% for comparing the empirical mean of X to µ0= 9, assuming the data are normal, and the variance known. Repeat withµ0= 10.

4. Compute the p-value of the two-sided test at level 5% for comparing the empirical mean of X to µ0= 9, assuming the data are normal, and the variance unknown. Repeat withµ0= 10.

5. Compare the outputs with t.test(X, mu=9, sd=1) t.test(X, mu=10, sd=1)

6. Understand the output of t.test with the following inputs.

(a) x=rnorm(100), mu=0, alternative="two.sided"

(b) x=rnorm(100), mu=0.5, alternative="less"

(c) x=rnorm(100), mu=0.5, alternative="greater"

(d) x=rnorm(100), mu=-0.5, alternative="greater"

(e) x=rnorm(100,-1,1), mu=-0.5, alternative="greater"

(f) x=rnorm(100,1,10), mu=0.5, alternative="greater"

2

Références

Documents relatifs

According to the values found at the preceding question, discuss and decide (if possible) on the nature of the critical points (extremum, saddle points ?).. Write the expression of

For each method, we obtain formulas that provide bounds on the total number of vector additions in F k b required to perform any of the following three computations, given a vector S

Express the rational number 71 55 as a finite simple continued

Express the rational number 71 55 as a finite simple continued

CHANDRASEKHARAI~, K., & I~ARASIMHAN, RAOHAVAN, I-Iecke's functional equation and the average order of arithmetical functions.. - - Functional equations with

E, LITTLEWOOD, Proc.. Actually two groups of new terms emerge, the number of terms in each group depending on T, so that the result falls into the category of

Objectives: Compute statistical testing for single samples from real data.. 1 Statistical testing of the

Compute the p-value of the test at level 5% for comparing the empirical variance of X to σ 2 0 = 2, assuming the data