<?xml version="1.0" encoding="UTF-8" ?>
<!-- RSS generated by PHPBoost on Tue, 14 Apr 2026 00:43:59 +0200 -->

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Documentation]]></title>
		<atom:link href="https://www.sthda.com/french/syndication/rss/wiki/30" rel="self" type="application/rss+xml"/>
		<link>https://www.sthda.com</link>
		<description><![CDATA[Derniers articles de la catégorie Tests statistiques avec R]]></description>
		<copyright>(C) 2005-2026 PHPBoost</copyright>
		<language>fr</language>
		<generator>PHPBoost</generator>
		
		
		<item>
			<title><![CDATA[Test de Wilcoxon avec R]]></title>
			<link>https://www.sthda.com/french/wiki/test-de-wilcoxon-avec-r</link>
			<guid>https://www.sthda.com/french/wiki/test-de-wilcoxon-avec-r</guid>
			<description><![CDATA[Le test de Wilcoxon (ou de Mann-Whitney) est un test non-param?trique de comparaison de moyennes de deux ?chantillons ind?pendants ou appari?s.<br />
<br />
<span class="warning">Ce test est dit non-param?trique car il ne fait aucune hypoth?se sur la distribution des ?chantillons.</span><br />
<br />
<br />
<h2 class="formatter-title wiki-paragraph-2" id="paragraph-comparaison-de-deux-echantillons-independants">Comparaison de deux ?chantillons ind?pendants </h2><br />
<br />
Soient x et y deux ?chantillons ind?pendants ? comparer. La commande ? utiliser est la suivante :<br />
<br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;">&nbsp;
x <span style="color: #080;"><-</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">0.80</span>, <span style="color: #ff0000;">0.83</span>, <span style="color: #ff0000;">1.89</span>, <span style="color: #ff0000;">1.04</span>, <span style="color: #ff0000;">1.45</span>, <span style="color: #ff0000;">1.38</span>, <span style="color: #ff0000;">1.91</span>, <span style="color: #ff0000;">1.64</span>, <span style="color: #ff0000;">0.73</span>, <span style="color: #ff0000;">1.46</span><span style="color: #080;">&#41;</span>
y <span style="color: #080;"><-</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">1.15</span>, <span style="color: #ff0000;">0.88</span>, <span style="color: #ff0000;">0.90</span>, <span style="color: #ff0000;">0.74</span>, <span style="color: #ff0000;">1.21</span><span style="color: #080;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">wilcox.<span style="">test</span></span><span style="color: #080;">&#40;</span>x, y<span style="color: #080;">&#41;</span>
&nbsp;</pre></pre></div><br />
<br />
<strong><em>R?sultat de la commande :</em></strong><br />
<br />
Wilcoxon rank sum test<br />
<br />
data:  x and y<br />
W = 35,<strong><em> p-value = 0.2544</em></strong><br />
alternative hypothesis: true location shift is not equal to 0<br />
<br />
<span class="warning">p=0.25. Les deux ?chantillons x et y ne sont pas significativement diff?rents.</span><br />
<br />
<br />
<span class="notice"><br />
La fonction wilcox.test() peut ?galement ?tre utilis?e de la mani?re suivante :<br />
<br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">wilcox.<span style="">test</span></span><span style="color: #080;">&#40;</span>y~A<span style="color: #080;">&#41;</span> <span style="color: #228B22;"># y est un vecteur num?rique et la variable A indique le groupe</span></pre></pre></div><br />
</span><br />
<br />
<br />
<!-- START HTML -->
<div class="block">
  <i class="fa fa-cogs fa-4x"></i> Un outil web pour faire le <a href="https://www.sthda.com/french/french/rsthda/unpaired-wilcoxon.php">test de Wilcoxon pour ?chantillons ind?pendants en ligne</a>, sans aucune installation, est disponible <a href="https://www.sthda.com/french/french/rsthda/unpaired-wilcoxon.php">ici</a>.
</div>
<!-- END HTML --><br />
<br />
<br />
<h2 class="formatter-title wiki-paragraph-2" id="paragraph-comparaison-de-deux-echantillons-apparies">Comparaison de deux ?chantillons appari?s </h2><br />
<br />
Soient x et y deux ?chantillons appari?s ? comparer. La commande ? utiliser est la suivante :<br />
<br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;">&nbsp;
x <span style="color: #080;"><-</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">1.83</span>,  <span style="color: #ff0000;">0.50</span>,  <span style="color: #ff0000;">1.62</span>,  <span style="color: #ff0000;">2.48</span>, <span style="color: #ff0000;">1.68</span>, <span style="color: #ff0000;">1.88</span>, <span style="color: #ff0000;">1.55</span>, <span style="color: #ff0000;">3.06</span>, <span style="color: #ff0000;">1.30</span><span style="color: #080;">&#41;</span>
y <span style="color: #080;"><-</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">0.878</span>, <span style="color: #ff0000;">0.647</span>, <span style="color: #ff0000;">0.598</span>, <span style="color: #ff0000;">2.05</span>, <span style="color: #ff0000;">1.06</span>, <span style="color: #ff0000;">1.29</span>, <span style="color: #ff0000;">1.06</span>, <span style="color: #ff0000;">3.14</span>, <span style="color: #ff0000;">1.29</span><span style="color: #080;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">wilcox.<span style="">test</span></span><span style="color: #080;">&#40;</span>x, y, paired <span style="color: #080;">=</span> TRUE<span style="color: #080;">&#41;</span>
&nbsp;</pre></pre></div><br />
<br />
<br />
<strong><em>R?sultat de la commande :</em></strong><br />
<br />
    Wilcoxon signed rank test<br />
<br />
data:  x and y<br />
V = 40, <strong><em>p-value = 0.03906</em></strong><br />
alternative hypothesis: true location shift is not equal to 0<br />
<br />
<span class="warning">p = 0.039. Les deux ?chantillons x et y sont donc significativement diff?rents</span><br />
<br />
<br />
<!-- START HTML -->
<div class="block">
  <i class="fa fa-cogs fa-4x"></i> Un outil web pour faire le <a href="https://www.sthda.com/french/french/rsthda/paired-wilcoxon.php">test de Wilcoxon pour ?chantillons appari?s en ligne</a>, sans aucune installation, est disponible <a href="https://www.sthda.com/french/french/rsthda/paired-wilcoxon.php">ici</a>.
</div>
<!-- END HTML --><br />
<br />
<br />
<p class="float-left"><a href="https://www.sthda.com/french/french/wiki/test-de-student-avec-r">? Cours pr?c?dent</a><br />
Test de Student avec R</p><br />
<p class="float-right"><a href="https://www.sthda.com/french/french/wiki/anova-analyse-de-variance-avec-r">Cours suivant ?</a><br />
ANOVA : Analyse de variance avec R</p>]]></description>
			<pubDate>Sat, 25 Oct 2014 20:45:02 +0200</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[Test de normalité avec R : Test de Shapiro-Wilk]]></title>
			<link>https://www.sthda.com/french/wiki/test-de-normalite-avec-r-test-de-shapiro-wilk</link>
			<guid>https://www.sthda.com/french/wiki/test-de-normalite-avec-r-test-de-shapiro-wilk</guid>
			<description><![CDATA[Le test de Shapiro-Wilk est un test permettant de savoir si une s?rie de donn?es suit une loi normale.<br />
<br />
<!-- START HTML -->
<div class="block">
<i class="fa fa-cogs fa-4x"></i> Un outil web pour faire le test de <a href="https://www.sthda.com/french/french/rsthda/shapiro-wilk.php">Shapiro-Wilk en ligne</a>, sans aucune installation, est disponible <a href="https://www.sthda.com/french/french/rsthda/shapiro-wilk.php">ici</a>.
</div>
<!-- END HTML --><br />
<br />
<span class="notice"><br />
Hypoth?se nulle : l'?chantillon suit une loi normale. Par cons?quent si la p-value du test est significative, l'?chantillon ne suit pas une loi normale.<br />
</span><br />
<br />
<strong><em>Exemple 1:</em></strong><br />
<br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;">&nbsp;
<span style="color: #0000FF; font-weight: bold;">shapiro.<span style="">test</span></span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">rnorm</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">100</span>, <span style="color: #0000FF; font-weight: bold;">mean</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">5</span>, <span style="color: #0000FF; font-weight: bold;">sd</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">3</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
&nbsp;</pre></pre></div><br />
<br />
<em><strong>R?sultat de la commande:</strong></em><br />
<br />
Shapiro-Wilk normality test<br />
<br />
data:  rnorm(100, mean = 5, sd = 3)<br />
W = 0.9895, <strong>p-value = 0.6211</strong><br />
<br />
<span class="success"><br />
L'exemple ci-dessus renvoie une p-value non significative. L'?chantillon suit donc une loi normale.<br />
</span><br />
<br />
<br />
<strong><em>Exemple 2:</em></strong><br />
<br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;">&nbsp;
<span style="color: #0000FF; font-weight: bold;">shapiro.<span style="">test</span></span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">runif</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">100</span>, <span style="color: #0000FF; font-weight: bold;">min</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">2</span>, <span style="color: #0000FF; font-weight: bold;">max</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">4</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
&nbsp;</pre></pre></div><br />
<br />
<em><strong>R?sultat de la commande:</strong></em><br />
    Shapiro-Wilk normality test<br />
<br />
data:  runif(100, min = 2, max = 4)<br />
W = 0.9337, p-value = 8.077e-05<br />
<br />
<span class="success"><br />
Dans l'exemple 2, ci-dessus, la p-value est significative. L'?chantillon ne suit donc pas une loi normale.<br />
</span><br />
<br />
<br />
<br />
<p class="float-left"><a href="https://www.sthda.com/french/french/wiki/statistiques-descriptives-avec-r">? Cours pr?c?dent</a><br />
Statistiques descriptives avec R</p><br />
<p class="float-right"><a href="https://www.sthda.com/french/french/wiki/test-f-comparaison-de-deux-variances-avec-r">Cours suivant ?</a><br />
Test F : comparaison de deux variances avec R</p>]]></description>
			<pubDate>Sat, 25 Oct 2014 20:21:58 +0200</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[Tests statistiques avec R]]></title>
			<link>https://www.sthda.com/french/wiki/tests-statistiques-avec-r</link>
			<guid>https://www.sthda.com/french/wiki/tests-statistiques-avec-r</guid>
			<description><![CDATA[<!-- START HTML -->
<div class="chapter">Tests statistiques avec R</div>
<div class="sub_chapter"><a href="https://www.sthda.com/french/french/wiki/statistiques-descriptives-avec-r">Statistiques descriptives avec R</a></div>
<div class="sub_chapter"><a href="https://www.sthda.com/french/french/wiki/test-de-normalite-avec-r-test-de-shapiro-wilk">Test de normalit? avec R : Test de Shapiro-Wilk</a></div>
<div class="sub_chapter"><a href="https://www.sthda.com/french/french/wiki/test-f-comparaison-de-deux-variances-avec-r">Test F : comparaison de deux variances avec R</a></div>
<div class="sub_chapter"><a href="https://www.sthda.com/french/french/wiki/test-de-student-avec-r">Test de Student avec R</a></div>
<div class="sub_chapter"><a href="https://www.sthda.com/french/french/wiki/test-de-wilcoxon-avec-r">Test de Wilcoxon avec R</a></div>
<div class="sub_chapter"><a href="https://www.sthda.com/french/french/wiki/anova-analyse-de-variance-avec-r">ANOVA : Analyse de variance avec R</a></div>
<div class="sub_chapter"><a href="https://www.sthda.com/french/french/wiki/test-de-correlation-avec-r">Test de corr?lation avec R</a></div>
<div class="sub_chapter"><a href="https://www.sthda.com/french/french/wiki/regression-lineaire-avec-r">R?gression lin?aire avec R</a></div>


<!-- END HTML --><br />
<br />
<p class="float-left"><a href="https://www.sthda.com/french/french/wiki/gestion-des-donnees-dans-r">? Chapitre pr?c?dent</a><br />
Gestion des donn?es dans R</p><br />
<p class="float-right"><a href="https://www.sthda.com/french/french/wiki/graphique-avec-r">Chapitre suivant ?</a><br />
Graphique avec R</p>]]></description>
			<pubDate>Sat, 25 Oct 2014 02:30:25 +0200</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[Test exact de Fisher avec R]]></title>
			<link>https://www.sthda.com/french/wiki/test-exact-de-fisher-avec-r</link>
			<guid>https://www.sthda.com/french/wiki/test-exact-de-fisher-avec-r</guid>
			<description><![CDATA[Le test exact de fisher permet de tester si les fr?quences observ?es sur 2 ?chantillons sont identiques.<br />
<br />
Ce test est utilis? pour l'analyse des tableaux de contingence. <strong>Il s'applique aux ?chantillons de petite taille.</strong> Pour des ?chantillons de grande taille on utilise le test de khi2<br />
<br />
Utilisation de la fonction <strong>fisher.test()</strong>:<br />
<br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">fisher.<span style="">test</span></span><span style="color: #080;">&#40;</span>mytable<span style="color: #080;">&#41;</span> <span style="color: #228B22;">#mytable = tableau de contingence</span></pre></pre></div><br />
<br />
<br />
<br />
<p class="float-left"><a href="https://www.sthda.com/french/french/wiki/test-de-chi2-avec-r">? Cours pr?c?dent</a><br />
Test de Chi2 avec R</p><br />]]></description>
			<pubDate>Thu, 17 May 2012 12:20:15 +0200</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[Régression linéaire avec R]]></title>
			<link>https://www.sthda.com/french/wiki/regression-lineaire-avec-r</link>
			<guid>https://www.sthda.com/french/wiki/regression-lineaire-avec-r</guid>
			<description><![CDATA[<h2 class="formatter-title wiki-paragraph-2" id="paragraph-regression-lineaire-simple">R?gression lin?aire simple</h2><br />
<br />
y en fonction de x :<br />
<br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;">&nbsp;
x<span style="color: #080;"><-</span><span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">2</span>,<span style="color: #ff0000;">5</span>,<span style="color: #ff0000;">3</span>,<span style="color: #ff0000;">7</span><span style="color: #080;">&#41;</span>
y<span style="color: #080;">=</span><span style="color: #ff0000;">2</span><span style="color: #080;">*</span>x<span style="color: #080;">+</span><span style="color: #ff0000;">5</span>
<span style="color: #0000FF; font-weight: bold;">lm</span><span style="color: #080;">&#40;</span>y ~ x<span style="color: #080;">&#41;</span>
&nbsp;</pre></pre></div><br />
<br />
La commande retourne :<br />
<br />
<!-- START HTML -->

<pre>
Call:
lm(formula = y ~ x)

Coefficients:
(Intercept)            x  
          5            2  
</pre>

<!-- END HTML --><br />
<br />
On peut ?galement appeler la fonction lm avec une data frame :<br />
<br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;">dframe<span style="color: #080;"><-</span><span style="color: #0000FF; font-weight: bold;">data.<span style="">frame</span></span><span style="color: #080;">&#40;</span> x<span style="color: #080;">=</span><span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">2</span>,<span style="color: #ff0000;">5</span>,<span style="color: #ff0000;">3</span>,<span style="color: #ff0000;">7</span><span style="color: #080;">&#41;</span>, y<span style="color: #080;">=</span><span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">9</span>, <span style="color: #ff0000;">15</span>, <span style="color: #ff0000;">11</span>, <span style="color: #ff0000;">19</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
reglin <span style="color: #080;"><-</span> <span style="color: #0000FF; font-weight: bold;">lm</span><span style="color: #080;">&#40;</span>y ~ x, dframe<span style="color: #080;">&#41;</span></pre></pre></div><br />
<br />
Pour tracer la droite de r?gression :<br />
<br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;">&nbsp;
<span style="color: #0000FF; font-weight: bold;">plot</span><span style="color: #080;">&#40;</span>y ~ x, dframe<span style="color: #080;">&#41;</span> 
<span style="color: #0000FF; font-weight: bold;">abline</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">lm</span><span style="color: #080;">&#40;</span>y ~ x, dframe<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
&nbsp;</pre></pre></div><br />
<br />
<br />
<p class="float-left"><a href="https://www.sthda.com/french/french/wiki/test-de-correlation-avec-r">? Cours pr?c?dent</a><br />
Test de corr?lation avec R</p><br />
<p class="float-right"><a href="https://www.sthda.com/french/french/wiki/test-de-chi2-avec-r">Cours suivant ?</a><br />
Test de Chi2 avec R</p>]]></description>
			<pubDate>Thu, 17 May 2012 09:12:29 +0200</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[Test de Chi2 avec R]]></title>
			<link>https://www.sthda.com/french/wiki/test-de-chi2-avec-r</link>
			<guid>https://www.sthda.com/french/wiki/test-de-chi2-avec-r</guid>
			<description><![CDATA[Utilisation de la fonction <strong>chisq.test().</strong><br />
<br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">chisq.<span style="">test</span></span><span style="color: #080;">&#40;</span>mytable<span style="color: #080;">&#41;</span> <span style="color: #228B22;"># mytable = tableau de contingence</span></pre></pre></div><br />
<br />
Le code ci-dessus, test l'ind?pendance de la variable colonne et de la variable ligne du tableau de contingence.<br />
<br />
<br />
<strong><em>Exemple :</em></strong><br />
<br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;">&nbsp;
M <span style="color: #080;"><-</span> <span style="color: #0000FF; font-weight: bold;">as.<span style="">table</span></span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">rbind</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">762</span>, <span style="color: #ff0000;">327</span>, <span style="color: #ff0000;">468</span><span style="color: #080;">&#41;</span>, <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">484</span>,<span style="color: #ff0000;">239</span>,<span style="color: #ff0000;">477</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span> <span style="color: #228B22;"># cr?ation d'une table 2 lignes/3 colonnes</span>
<span style="color: #0000FF; font-weight: bold;">dimnames</span><span style="color: #080;">&#40;</span>M<span style="color: #080;">&#41;</span> <span style="color: #080;"><-</span> <span style="color: #0000FF; font-weight: bold;">list</span><span style="color: #080;">&#40;</span>gender<span style="color: #080;">=</span><span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">"M"</span>,<span style="color: #ff0000;">"F"</span><span style="color: #080;">&#41;</span>, party<span style="color: #080;">=</span><span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">"Democrat"</span>,<span style="color: #ff0000;">"Independent"</span>, <span style="color: #ff0000;">"Republican"</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #228B22;"># ent?te colonne et ligne</span>
<span style="color: #080;">&#40;</span>test <span style="color: #080;"><-</span> <span style="color: #0000FF; font-weight: bold;">chisq.<span style="">test</span></span><span style="color: #080;">&#40;</span>M<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span> <span style="color: #228B22;"># affichage des r?sultats du test</span>
&nbsp;</pre></pre></div><br />
<br />
Acc?s aux diff?rents objets du test:<br />
<br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;">&nbsp;
test$statistic <span style="color: #228B22;">#: la statistique du Chi2.</span>
test$parameter <span style="color: #228B22;">#: le nombre de degr?s de libert?s.</span>
test$p.<span style="">value</span> <span style="color: #228B22;">#: la p-value.</span>
test$observed <span style="color: #228B22;">#: la matrice observ?e de d?part.</span>
test$expected <span style="color: #228B22;">#: la matrice attendue sous l'hypoth?se nulle d'absence de biais.</span>
&nbsp;</pre></pre></div><br />
<br />
<br />
<br />
<p class="float-left"><a href="https://www.sthda.com/french/french/wiki/regression-lineaire-avec-r">? Cours pr?c?dent</a><br />
R?gression lin?aire avec R</p><br />
<p class="float-right"><a href="https://www.sthda.com/french/french/wiki/test-exact-de-fisher-avec-r">Cours suivant ?</a><br />
Test exact de Fisher avec R</p>]]></description>
			<pubDate>Thu, 17 May 2012 09:02:38 +0200</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[ANOVA : Analyse de variance avec R]]></title>
			<link>https://www.sthda.com/french/wiki/anova-analyse-de-variance-avec-r</link>
			<guid>https://www.sthda.com/french/wiki/anova-analyse-de-variance-avec-r</guid>
			<description><![CDATA[L'ANOVA permet de voir si une variable num?rique a des valeurs diff?rentes en fonction de plusieurs groupes. C'est une g?n?ralisation du test de Student permettant de comparer plus de deux groupes.<br />
<br />
<br />
La commande ? utiliser est :<br />
<br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;">&nbsp;
fit <span style="color: #080;"><-</span> <span style="color: #0000FF; font-weight: bold;">aov</span><span style="color: #080;">&#40;</span>y ~ A, <span style="color: #0000FF; font-weight: bold;">data</span><span style="color: #080;">=</span>mydataframe<span style="color: #080;">&#41;</span> <span style="color: #228B22;"># y est la variable num?rique et A indique les groupes</span>
<span style="color: #0000FF; font-weight: bold;">summary</span><span style="color: #080;">&#40;</span>fit<span style="color: #080;">&#41;</span>
&nbsp;</pre></pre></div><br />
<br />
<strong>Exemple : </strong><br />
<br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;">&nbsp;
fr <span style="color: #080;"><-</span> <span style="color: #0000FF; font-weight: bold;">data.<span style="">frame</span></span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">var</span> <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">10</span>, <span style="color: #ff0000;">4</span>, <span style="color: #ff0000;">5</span>, <span style="color: #ff0000;">3</span>, <span style="color: #ff0000;">3</span>, <span style="color: #ff0000;">7</span>, <span style="color: #ff0000;">2</span>, <span style="color: #ff0000;">6</span>, <span style="color: #ff0000;">2</span>, <span style="color: #ff0000;">8</span>, <span style="color: #ff0000;">5</span><span style="color: #080;">&#41;</span>,
                 group <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">factor</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">"c"</span>, <span style="color: #ff0000;">"a"</span>, <span style="color: #ff0000;">"b"</span>, <span style="color: #ff0000;">"a"</span>, <span style="color: #ff0000;">"b"</span>, <span style="color: #ff0000;">"b"</span>, <span style="color: #ff0000;">"a"</span>, <span style="color: #ff0000;">"b"</span>, <span style="color: #ff0000;">"a"</span>, <span style="color: #ff0000;">"c"</span>, <span style="color: #ff0000;">"c"</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #228B22;">#table de donn?es</span>
fit <span style="color: #080;"><-</span> <span style="color: #0000FF; font-weight: bold;">aov</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">var</span> ~ group, fr<span style="color: #080;">&#41;</span><span style="color: #228B22;"># analyse de variance</span>
<span style="color: #0000FF; font-weight: bold;">summary</span><span style="color: #080;">&#40;</span>fit<span style="color: #080;">&#41;</span>
&nbsp;</pre></pre></div><br />
<br />
<br />
<strong><em>R?sultat de la commande:</em></strong><br />
<br />
<!-- START HTML -->

<pre>
            Df Sum Sq Mean Sq F value  Pr(>F)  
group        2 41.833 20.9167  6.9241 0.01798 *
Residuals    8 24.167  3.0208                  
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
</pre>

<!-- END HTML --><br />
<br />
<strong>Le test renvoie une p-value significative; p = 0.018. </strong><br />
<br />
<span class="warning">Dans le cas d'un test d' ANOVA, m?me si le test est significatif, on ne sait  par contre pas quelles cat?gories sont concern?es. Il faudra donc faire un test de Student pour comparer les groupes 2 par 2.</span><br />
<br />
<br />
<br />
<p class="float-left"><a href="https://www.sthda.com/french/french/wiki/test-de-wilcoxon-avec-r">? Cours pr?c?dent</a><br />
Test de Wilcoxon avec R</p><br />
<p class="float-right"><a href="https://www.sthda.com/french/french/wiki/test-de-correlation-avec-r">Cours suivant ?</a><br />
Test de corr?lation avec R</p>]]></description>
			<pubDate>Tue, 08 May 2012 12:16:47 +0200</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[Test F : comparaison de deux variances avec R]]></title>
			<link>https://www.sthda.com/french/wiki/test-f-comparaison-de-deux-variances-avec-r</link>
			<guid>https://www.sthda.com/french/wiki/test-f-comparaison-de-deux-variances-avec-r</guid>
			<description><![CDATA[Le test F permet de comparer les variances de deux ?chantillons.<br />
<br />
<span class="notice"><br />
Condition d'application du test : Les ?chantillons doivent suivre la loi normale.<br />
</span><br />
<br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;">&nbsp;
x <span style="color: #080;"><-</span> <span style="color: #0000FF; font-weight: bold;">rnorm</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">50</span>, <span style="color: #0000FF; font-weight: bold;">mean</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">0</span>, <span style="color: #0000FF; font-weight: bold;">sd</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">2</span><span style="color: #080;">&#41;</span> <span style="color: #228B22;"># g?n?ration d'un ?chantillon x suivant la loi normale</span>
y <span style="color: #080;"><-</span> <span style="color: #0000FF; font-weight: bold;">rnorm</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">30</span>, <span style="color: #0000FF; font-weight: bold;">mean</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">1</span>, <span style="color: #0000FF; font-weight: bold;">sd</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">1</span><span style="color: #080;">&#41;</span><span style="color: #228B22;"># g?n?ration d'un ?chantillon y suivant la loi normale</span>
<span style="color: #0000FF; font-weight: bold;">var.<span style="">test</span></span><span style="color: #080;">&#40;</span>x, y<span style="color: #080;">&#41;</span>  <span style="color: #228B22;"># test F</span>
&nbsp;</pre></pre></div><br />
<br />
<strong><em>R?sultat de la commande:</em></strong><br />
<br />
<br />
    F test to compare two variances<br />
<br />
data:  x and y<br />
F = 4.0688, num df = 49, denom df = 29, <strong>p-value = 0.0001312</strong><br />
alternative hypothesis: true ratio of variances is not equal to 1<br />
95 percent confidence interval:<br />
 2.044255 7.655093<br />
sample estimates:<br />
ratio of variances<br />
          4.068792<br />
<br />
<br />
<span class="warning">La p-value < 0.05. La variance des deux ?chantillons x et y diff?rent donc significativement</span><br />
<br />
<p class="float-left"><a href="https://www.sthda.com/french/french/wiki/test-de-normalite-avec-r-test-de-shapiro-wilk">? Cours pr?c?dent</a><br />
Test de normalit? avec R : Test de Shapiro-Wilk</p><br />
<p class="float-right"><a href="https://www.sthda.com/french/french/wiki/test-de-student-avec-r">Cours suivant ?</a><br />
Test de Student avec R</p>]]></description>
			<pubDate>Sun, 06 May 2012 17:01:44 +0200</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[Statistiques descriptives avec R]]></title>
			<link>https://www.sthda.com/french/wiki/statistiques-descriptives-avec-r</link>
			<guid>https://www.sthda.com/french/wiki/statistiques-descriptives-avec-r</guid>
			<description><![CDATA[<h2 class="formatter-title wiki-paragraph-2" id="paragraph-la-fonction-summary">La fonction summary()</h2><br />
<br />
La fonction <strong><span style="color:blue;">summary()</span></strong> permet d'avoir la description statistique d'une variable ou d'une table de donn?e.<br />
<br />
Pour une variable donn?e, la fonction renvoie 5 valeurs : le minimum (<strong>Min.</strong>), le premier quartile (<strong>1st Qu.</strong>), la m?diane (<strong>Median</strong>), la moyenne (<strong>Mean</strong>), le troisi?me quartile (<strong>3rd Qu.</strong>) et le maximum (<strong>Max</strong>).<br />
<br />
<br />
<h3 class="formatter-title wiki-paragraph-3" id="paragraph-exemple-1-statistiques-descriptives-d-une-variable">Exemple 1 : Statistiques descriptives d'une variable</h3><br />
<br /><br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;">&nbsp;
<span style="color: #0000FF; font-weight: bold;">attach</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">faithful</span><span style="color: #080;">&#41;</span> <span style="color: #228B22;"># chargement de la table de donn?e faithful</span>
<span style="color: #0000FF; font-weight: bold;">summary</span><span style="color: #080;">&#40;</span>eruptions<span style="color: #080;">&#41;</span> <span style="color: #228B22;">#description de la variable eruptions</span>
&nbsp;
<span style="color: #228B22;">#r?sultat de la commande</span>
 Min. 1st Qu.  <span style="">Median</span>    Mean 3rd Qu.    <span style="">Max</span>. 
  <span style="color: #ff0000;">1.600</span>   <span style="color: #ff0000;">2.163</span>   <span style="color: #ff0000;">4.000</span>   <span style="color: #ff0000;">3.488</span>   <span style="color: #ff0000;">4.454</span>   <span style="color: #ff0000;">5.100</span> 
&nbsp;</pre></pre></div><br />
<br />
<br />
<br />
<h3 class="formatter-title wiki-paragraph-3" id="paragraph-exemple-2-statistiques-descriptives-d-une-table-de-donnee">Exemple 2 : Statistiques descriptives d'une table de donn?e</h3><br />
<br /><br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;">&nbsp;
<span style="color: #0000FF; font-weight: bold;">attach</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">faithful</span><span style="color: #080;">&#41;</span> <span style="color: #228B22;"># chargement de la table de donn?e faithful</span>
<span style="color: #0000FF; font-weight: bold;">summary</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">faithful</span><span style="color: #080;">&#41;</span> <span style="color: #228B22;">#description de la table de donn?e</span>
&nbsp;
<span style="color: #228B22;">#r?sultat de la commande</span>
   eruptions        waiting    
 Min.   <span style="color: #080;">:</span><span style="color: #ff0000;">1.600</span>   Min.   <span style="color: #080;">:</span><span style="color: #ff0000;">43.0</span>  
 1st Qu.<span style="color: #080;">:</span><span style="color: #ff0000;">2.163</span>   1st Qu.<span style="color: #080;">:</span><span style="color: #ff0000;">58.0</span>  
 Median <span style="color: #080;">:</span><span style="color: #ff0000;">4.000</span>   Median <span style="color: #080;">:</span><span style="color: #ff0000;">76.0</span>  
 Mean   <span style="color: #080;">:</span><span style="color: #ff0000;">3.488</span>   Mean   <span style="color: #080;">:</span><span style="color: #ff0000;">70.9</span>  
 3rd Qu.<span style="color: #080;">:</span><span style="color: #ff0000;">4.454</span>   3rd Qu.<span style="color: #080;">:</span><span style="color: #ff0000;">82.0</span>  
 Max.   <span style="color: #080;">:</span><span style="color: #ff0000;">5.100</span>   Max.   <span style="color: #080;">:</span><span style="color: #ff0000;">96.0</span> 
&nbsp;
&nbsp;</pre></pre></div><br />
<br />
<br />
<h2 class="formatter-title wiki-paragraph-2" id="paragraph-la-fonction-sapply">La fonction sapply()</h2><br />
<br />
La fonction <strong><span style="color:blue;">sapply()</span></strong> est g?n?ralement utilis?e pour appliquer sp?cifiquement une fonction ? une variable ou ? une table de donn?e.<br />
<br />
Ainsi on peut sp?cifiquement appliquer des fonctions telles que <strong>mean</strong> (moyenne), <strong>sd</strong> (?cart type), <strong>var </strong>(variance), <strong>min</strong> (minimum), <strong>max </strong>(maximum), <strong>med</strong> ( m?diane), <strong>range</strong> (l'?tendue) et le <strong>quantile</strong> (quartile 1, 2 , 3, ...).<br />
<br />
<strong><em>Exemple </em></strong><br />
<br />
<span class="formatter-code">Code R :</span><div class="code"><pre style="display:inline;"><pre class="r" style="font-family:monospace;">&nbsp;
<span style="color: #0000FF; font-weight: bold;">attach</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">faithful</span><span style="color: #080;">&#41;</span> <span style="color: #228B22;"># chargement de la table de donn?e faithful</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">sapply</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">faithful</span>, <span style="color: #0000FF; font-weight: bold;">sd</span><span style="color: #080;">&#41;</span> <span style="color: #228B22;">#ecart type de la table de donn?e</span>
<span style="color: #228B22;">#r?sultat de la commande</span>
  eruptions   waiting 
 <span style="color: #ff0000;">1.141371</span> <span style="color: #ff0000;">13.594974</span> 
&nbsp;
<span style="color: #0000FF; font-weight: bold;">sapply</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">faithful</span>,<span style="color: #0000FF; font-weight: bold;">quantile</span><span style="color: #080;">&#41;</span><span style="color: #228B22;"># calcul du quantile</span>
<span style="color: #228B22;">#r?sultat de la commande</span>
     eruptions waiting
<span style="color: #ff0000;">0</span><span style="color: #080;">%</span>     <span style="color: #ff0000;">1.60000</span>      <span style="color: #ff0000;">43</span> <span style="color: #228B22;">#minimum</span>
<span style="color: #ff0000;">25</span><span style="color: #080;">%</span>    <span style="color: #ff0000;">2.16275</span>      <span style="color: #ff0000;">58</span> <span style="color: #228B22;">#premier quartile</span>
<span style="color: #ff0000;">50</span><span style="color: #080;">%</span>    <span style="color: #ff0000;">4.00000</span>      <span style="color: #ff0000;">76</span> <span style="color: #228B22;">#m?diane</span>
<span style="color: #ff0000;">75</span><span style="color: #080;">%</span>    <span style="color: #ff0000;">4.45425</span>      <span style="color: #ff0000;">82</span> <span style="color: #228B22;">#troisi?me quartile</span>
<span style="color: #ff0000;">100</span><span style="color: #080;">%</span>   <span style="color: #ff0000;">5.10000</span>      <span style="color: #ff0000;">96</span> <span style="color: #228B22;"># maximum</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">sapply</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">faithful</span>,<span style="color: #0000FF; font-weight: bold;">range</span><span style="color: #080;">&#41;</span> <span style="color: #228B22;">#calcul de l'?tendue (min, max)</span>
     eruptions waiting
<span style="color: #080;">&#91;</span><span style="color: #ff0000;">1</span>,<span style="color: #080;">&#93;</span>       <span style="color: #ff0000;">1.6</span>      <span style="color: #ff0000;">43</span> <span style="color: #228B22;">#minimum</span>
<span style="color: #080;">&#91;</span><span style="color: #ff0000;">2</span>,<span style="color: #080;">&#93;</span>       <span style="color: #ff0000;">5.1</span>      <span style="color: #ff0000;">96</span> <span style="color: #228B22;">#maximum</span>
&nbsp;
&nbsp;</pre></pre></div><br />
<br />
<br />
<br />
<p class="float-left"><a href="https://www.sthda.com/french/french/wiki/transposer-une-table-de-donnees-avec-r">? Cours pr?c?dent</a><br />
Transposer une table de donn?es avec R</p><br />
<p class="float-right"><a href="https://www.sthda.com/french/french/wiki/test-de-normalite-avec-r-test-de-shapiro-wilk">Cours suivant ?</a><br />
Test de normalit? avec R : Test de Shapiro-Wilk</p>]]></description>
			<pubDate>Sun, 06 May 2012 15:52:08 +0200</pubDate>
			
		</item>
		
	</channel>
</rss>
