2
$\begingroup$

I'm trying to complete an exercise from my book, asking me to find
the variance to allow a sample of 49 items (that follows a normal law)
to stay in bounds of one confidence interval, at 95% of confidence.

The original question, in French: le chef d'atelier souhaite que 95% des échantillons de 49 pièces donnent une hauteur moyenne entre 21.72 mm et 22.28 mm.
Comment faut-il modifier l'écart-type de la hauteur d'une pièce pour obtenir ce résultat ?

Translated in English: the workshop chief wishes that 95% of its samples of 49 items give an average height between 21.72 mm and 22.28 mm.
How the standard deviation of the height of an item must be modified to get this result?

(at the end of this post is the full text of the exercise)

But I'm stuck a the moment I've got $a$ and $b$ values, the bounds of my $\chi^2(48)$ distribution.

Allow me to explain what happens to me. My program is written in french, but I translate its logs in English, of course.

(here is now the corrected program, glad to your answers. In comments at its end, are the original statements I once put for the question b of the exercise, and that led me to open this post because I wasn't able to complete it)

@Test @Order(8)
@DisplayName("Dans un atelier qui fabrique des pièces : estimation d'une variance")
public void dansUnAtelier() {
   LOGGER.info("==> Exercice 8 : Dans un atelier, on fabrique des pièces de bois d'espérance mathématique 22 mm et d'écart-type 2 mm.");
   // NormalDistribution N = new NormalDistribution(22, 2);

   LOGGER.info("On prélève un échantillon de 49 pièces.");
   LOGGER.info("a) Quelle est la probabilité que la hauteur moyenne sur cet échantillon dépasse 22.3 mm ?");

   // On sait que la moyenne est centrée sur 22 mm. Mais quel est son écart-type ?
   // ̅X ∼ N(µ, σ/√n) avec µ = 22 mm, σ = 2 mm, et n = 49
   double ecartTypeMoyenne = 2.0 / Math.sqrt(49.0);

   LOGGER.info("\tLa moyenne de cet échantillon de 49 pièces suit une loi ~ ̅X ∼ N(µ, {})", ecartTypeMoyenne);
   NormalDistribution NX = new NormalDistribution(22, ecartTypeMoyenne);

   // P(m > 22.3) = 1 - P(m ≦ 22.3)
   double hauteurMoyenneSuperieure = 1 - NX.cumulativeProbability(22.3);
   LOGGER.info("\tLa probabilité que la hauteur moyenne de cet échantillon dépasse 22.3 est de {}", hauteurMoyenneSuperieure);
   assertEquals(0.1469, hauteurMoyenneSuperieure, 0.01, "Mauvaise probabilité que P(m > 22.3)");

   // Quel écart-type pour une hauteur moyenne comprise entre 21.72 et 22.28 mm ?
   LOGGER.info("Le chef d'atelier souhaite que 95% des échantillons de 49 pièces donnent une hauteur moyenne comprise entre 21.72 et 22.28 mm");
   LOGGER.info("b) Comment faut-il modifier l'écart-type de la hauteur d'une pièce pour obtenir ce résultat ?");

   double phi = (1 + 0.95) / 2; // L'on recherche un intervalle de confiance à 95%
   NormalDistribution NCentreeReduite = new NormalDistribution(0, 1); // Sur la loi normale centrée réduite
   double u = NCentreeReduite.inverseCumulativeProbability(phi);      // u est à lire sur la courbe
   double borneInfActuelle = 22.0 - u * ecartTypeMoyenne;
   double borneSupActuelle = 22.0 + u * ecartTypeMoyenne;
   LOGGER.info("\tL'actuel intervalle de confiance est, à 95%, de m = 22 ± {} × {} = 22 ± {}, soit [{},{}]",
      u, ecartTypeMoyenne, u * ecartTypeMoyenne, borneInfActuelle, borneSupActuelle);

   LOGGER.info("\tIl suffit de déterminer la valeur pour 22 - {} × σ = 21.72 et 22 + {} × σ = 22.28", u, u);
   LOGGER.info("\tau lieu de 22 - {} × {} = {} et 22 + {} × {} = {} comme actuellement.", u, ecartTypeMoyenne, borneInfActuelle, u, ecartTypeMoyenne, borneSupActuelle);

   double ecartTypeMoyenneCible = borneInfActuelle / (22 - u);
   LOGGER.info("\tσ = {22 - {}} = {}. ", u, ecartTypeMoyenneCible);

   LOGGER.info("L'écart-type qui convient pour une hauteur moyenne de pièce comprise entre [21.72, 22.28] mm est σ = {}", ecartTypeMoyenneCible);
   assertEquals(1, ecartTypeMoyenneCible, 0.1, "Mauvais écart-type pour une hauteur moyenne de pièce comprise entre [21.72, 22.28] mm");

   /* Cette partie était inexacte, avec une tentative échouée par le Khi-Deux :

      // à 95% de confiance, on aura α = 0.05 => a = α/2 = 0.025 et b = 1 - α/2 = 0.975 dans la courbe du χ²(48)
      LOGGER.info("\tà 95% de confiance, on aura α = {} => a = α/2 = {} et b = 1 - α/2 = {} dans la courbe du χ²({})", 0.05, 0.05/2.0, (1-0.05/2.0), 49-1);
      ChiSquaredDistribution Chi = new ChiSquaredDistribution(48);
      double a = Chi.inverseCumulativeProbability(0.025);
      double b =  Chi.inverseCumulativeProbability(0.975);
      LOGGER.info("\tc'est à dire : a = {} et b = {}", a, b); */
}

It's output, translated in English:

Exercise 8 : In a workshop we are crafting pieces of wood 
of mathematical expectation 22 mm and standard deviation 2 mm.
We draw a sample of 49 pieces.
The mean of that sample of 49 piece follows a law ̅X ∼ N(µ, 0.2857142857142857)
The probability that the average height of that sample go over 22.3 mm is  0.14685905637589547

My trouble starts below:

I am in search of the standard deviation for an average height between 21.72 et 22.28 mm:

at 95% of confidence, we will have α = 0.05 => a = α/2 = 0.025 et b = 1 - α/2 = 0.975 on the χ²(48) curve.
namely : a = 30.754505709372623 and b = 69.02258578966595

From here, I'm unable to follow the good path.

With the formulas I know, I am willing to write something like:

$\begingroup \large \sigma^2 \in \big[\frac{(n-1)s^2}{b}, \frac{(n-1)s^2}{a}\big] \endgroup$

or

$\begingroup \large \sqrt{\frac{(n-1)s^2}{b}} \leq \sigma \leq \sqrt{\frac{(n-1)s^2}{a}} \endgroup$

but this leads me to a strange :

$\begingroup \sqrt{\frac{(48)s^2}{69.02}} \leq \sigma \leq \sqrt{\frac{(48)s^2}{30.75}} \endgroup$

I don't know what to do with, because I don't know with what I should replace $s^2$,
and whatever I try, I don't reach the solution my book is giving: 1 mm.


Here is the full text (in French) of the exercise my program tries to solve:

enter image description here

**and here's is the final output, when my program finishes successfully the exercise:

==> Exercice 8 : Dans un atelier, on fabrique des pièces de bois d'espérance mathématique 22 mm et d'écart-type 2 mm.
On prélève un échantillon de 49 pièces.
a) Quelle est la probabilité que la hauteur moyenne sur cet échantillon dépasse 22.3 mm ?
    La moyenne de cet échantillon de 49 pièces suit une loi ~ ̅X ∼ N(µ, 0.2857142857142857)
    La probabilité que la hauteur moyenne de cet échantillon dépasse 22.3 est de 0.14685905637589547
Le chef d'atelier souhaite que 95% des échantillons de 49 pièces donnent une hauteur moyenne comprise entre 21.72 et 22.28 mm
b) Comment faut-il modifier l'écart-type de la hauteur d'une pièce pour obtenir ce résultat ?
    L'actuel intervalle de confiance est, à 95%, de m = 22 ± 1.959963984540054 × 0.2857142857142857 = 22 ± 0.5599897098685869, soit [21.44001029013141,22.55998970986859]
    Il suffit de déterminer la valeur pour 22 - 1.959963984540054 × σ = 21.72 et 22 + 1.959963984540054 × σ = 22.28
    au lieu de 22 - 1.959963984540054 × 0.2857142857142857 = 21.44001029013141 et 22 + 1.959963984540054 × 0.2857142857142857 = 22.55998970986859 comme actuellement.
    σ = {22 - 1.959963984540054} = 1.0698588701932197. 
L'écart-type qui convient pour une hauteur moyenne de pièce comprise entre [21.72, 22.28] mm est σ = 1.0698588701932197

It's more σ = 1.07 than σ = 1 (the solution of the book), whatever. But I think it's ok.


But can you explain me more two things?

  1. Why are you telling me that $[21.72, 22.28]$ isn't a confidence interval?

  2. I succeed with $N$ distribution. But my lessons (provided I've reported them correctly) are telling me this (sorry it's in French, but you will see the formulas):

enter image description here

This is why I were willing to search that standard deviation by the mean of a Chi squared. And I am left, a bit troubled.

Could you explain me more what happens? Thanks!

$\endgroup$
3
  • $\begingroup$ "find the variance to allow a sample of 49 items (that follows a normal law) to stay in bounds of one confidence interval, at 95% of confidence." This question makes no sense to me. Could you write the original question (in French if you like). $\endgroup$ Commented Aug 5, 2022 at 11:32
  • $\begingroup$ @SextusEmpiricus I wrote the original question and attempted to translate it. I hope it will be clearer. $\endgroup$ Commented Aug 5, 2022 at 12:37
  • $\begingroup$ Now it makes sense. Note that this is not a confidence interval. $\endgroup$ Commented Aug 5, 2022 at 13:54

1 Answer 1

1
+50
$\begingroup$

You are using a $\chi^2$ distribution but you should use the normal distribution like you did in the first part of the exercise.

With the $N(22,\sigma/\sqrt{49})$ distribution you get that 95% of the sample means will be between $21.44$ and $22.56$ if $\sigma = 2$. Now you need to figure out by how much you should scale this $\sigma$ to end up with $21.72$ and $22.28$ instead.

$\endgroup$
2
  • $\begingroup$ Thanks! I resoived the exercise and edited the post accordingly with the corrected program. But also a question that I've added in this post. Because my lessons told me that for such a case I was to use the Chi squared distribution? But I can see that's your way that is working! $\endgroup$ Commented Aug 9, 2022 at 6:05
  • $\begingroup$ @MarcLeBihan you use the chi squared distribution when you are estimating a standard deviation. You do this estimation with the sum of square residuals statistic; The chi squared distribution is the sample distribution of that statistic when a sample follows the normal distribution. Your case is different. You are not estimating the standard deviation. Instead you are computing a desired cutoff values for the standard deviation below which the worshop needs to operate. $\endgroup$ Commented Aug 9, 2022 at 6:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.