* ===================================================================; * Analyse sensorielle =; * EPREUVES DE POSITIONNEMENT - par critère =; * Comparaison par paire, classement, notation =; * Pierre DESMET Janvier 2012 =; * ===================================================================; footnote1 h=1 j=l "Université Paris-Dauphine" j=r "(c) DESMET Pierre, 2012"; ODS rtf ; ********************************************************************; * P1. Comparaison par paires ; ********************************************************************; data in ; input effectif reponse; x=0 ; freq = reponse ;output ; /* bonnes réponses */ x=1 ; freq = effectif-reponse ; output; /* mauvaises réponses */ cards; 36 24 ; proc format ; value xfmt 0="Plus" 1="Moins" ; run ; Title1 j=l "Positionnement : Comparaison par paires NF V 09-012"; Title2 j=l "Test binomial Uni ou bilatéral, p=1/2"; Title3 "Examinez les 2 produits de gauche à droite. De ces 2 échantillons, lequel est le plus ..."; Title4 ""; Title5 ""; proc freq data = in; weight freq ; tables x / binomial(p=0.5); exact binomial; format x xfmt. ; /* prob théorique à calculer selon le nombre de produits */ run ; ********************************************************************; * P2. Classement : Traitement d'une variable de rang ; ********************************************************************; * exemple sur les chous : * source : http://www.itab.asso.fr/downloads/actus/rapport-vindras-2010.pdf ; ********************************************************************; /* d'abord dégustation (ordre imposé) puis évaluation ordre croissant */ /* somme des rangs par sujet et par échantillon */ data in ; * entrée du numéro du produit selon le classement ; array produit{5} produit1-produit5 ; array r{5} r1-r5 ; input juge $ r1 r2 r3 r4 r5 ; do i=1 to 5 ; produit{r{i}}= i; end ; cards; FR 2 3 5 1 4 BTL 3 2 1 4 5 JLB 4 2 1 3 5 CB 3 2 4 1 5 AB 1 2 4 3 5 CV 1 3 4 2 5 MM 3 2 1 4 5 ; title1 "Produits classés selon leur rang "; proc tabulate data=in ; class juge ; var r1-r5 ; table juge, (r1-r5)*sum*F=3.0 ; run ; title1 "Rang de classement pour chaque produits"; proc tabulate data=in ; class juge ; var produit1-produit5 ; table juge, (produit1-produit5)*sum*F=3.0 ; run ; data in ; * Rang pour chaque objet; input juge $ c1 c2 c3 c4 c5 ; Label C1="Chou chinois" C2="Chou rouge" C3= "Chou vert frisé" C4 ="Chou vert lisse Biocoop" C5= "Chou vert lisse Botanic" ; cards; FR 4 1 2 5 3 BTL 3 2 1 4 5 JLB 3 2 4 1 5 CB 4 2 1 3 5 AB 1 2 4 3 5 CV 1 4 2 3 5 MM 3 2 1 4 5 ; title6 "Caractère FRUITE des choux"; proc tabulate data=in ; class juge ; var c1-c5 ; table (juge all), (c1-c5)*mean*F=5.2 ; run ; data in_long ; set in ; produit=1; rang= C1; output ; produit=2; rang= C2; output ; produit=3; rang= C3; output ; produit=4; rang= C4; output ; produit=5; rang= C5; output ; run ; proc format ; value produitfmt 1="Chou chinois" 2="Chou rouge" 3= "Chou vert frisé" 4 ="Chou vert lisse Biocoop" 5= "Chou vert lisse Botanic"; run; Title1 j=l "Positionnement : Classement NF ISO 8587" ; Title2 j=l "Test Friedman" ; Title3 "Examinez les produits de gauche à droite. Ecrivez les numéros de code par ordre croissant d'intensité pour l'attribut ..."; Title4 "Analyse SANS neutraliser les différences dues aux juges "; proc freq data=in_long ; tables produit*rang / CMH2 scores=rank nocol nopercent ; format produit produitfmt. ; run ; Title4 "Analyse AVEC neutralisation des différences dues aux juges"; Title5 "LIRE : 'différence de scores moyens entre les lignes' " ; proc freq data=in_long ; tables juge*produit*rang / CMH2 scores=rank nocol nopercent norow; format produit produitfmt. ; run ; Proc cluster data=in method=average outtree= tree noprint ; var C1-C5 ; id juge ; run ; Title2 "Dendrogramme de la typologie hiérarchique des juges (average)"; Title3 " ";Title4 " ";Title5 " "; data outtree; set tree; if _parent_ eq '' and _name_ ne 'CL1' then delete; run; proc tree data=outtree; run ; ods rtf ; Title2 "Traitement en GLM"; proc GLM data=in_long ; class produit juge ; model rang = produit juge; lsmeans produit / pdiff=all adjust=tukey ; run ; Title2 "Traitement en Kruskal-Wallis (1 seule VD >2 modalités) puis Wilcoxon (rank sum 2 à 2)"; proc npar1way data=in_long wilcoxon; var rang; class produit; * exact; * pour un échantillon de faible taille; run; ********************************************************************; * P3. Evaluation par Notation : 2 produits ; ********************************************************************; * Note de deux produits (dosé à 5 et 9% sur un critère par 30 juges ; ; * test de student ; * source : http://www.ac-creteil.fr/biotechnologies/fichiers%20pdf/Pr%C3%A9sentation.pdf ; ********************************************************************; Title6 "Note de deux biscuits dosé à 5% et 9%" ; data in ; input ID Biscuit_5 Biscuit_9 @@ ; diff = biscuit_5 - biscuit_9 ; cards; 1 4 6.5 16 2 5 2 4 7 17 4 7 3 7 3 18 6 6 4 5 5 19 4 6 5 3 5 20 6 5 6 2 2.5 21 6 7 7 4 5 22 7 4.5 8 5 4 23 5 8 9 5.5 5.5 24 5.5 4.5 10 4 4 25 7 6 11 5 5 26 5.5 6 12 5 5 27 7 6.5 13 3 6 28 5 5 14 5 4 29 5.5 6.5 15 4 2 30 5 6 ; run ; data in_long ; set in ; groupe=5; biscuit= biscuit_5 ; output ; groupe=9; biscuit= biscuit_9 ; output ; Title1 j=l "Positionnement : Notation" ; Title2 " Ttest échantillons indépendants (non adapté ici,seulement pour les sorties)"; ods graphics on ; proc ttest data =in_long ; class groupe ; var biscuit ; run ; ods graphics off ; Title2 " Vérifier la normalité de l'écart"; proc Univariate data =in normal; var diff ; histogram diff / normal ; run ; Title2 " Ttest sur la différence (diff)"; proc ttest data =in ; var diff ; run ; Title2 " Ttest pairé paired : biscuit_5*biscuit_9"; proc ttest data =in ; paired biscuit_5*biscuit_9 ; run ; ********************************************************************; * P4. Evaluation par Notation : > 2 produits ; ********************************************************************; * anova ; ********************************************************************; data in_long ; input ID Biscuit_5 Biscuit_9 @@ ; note = biscuit_5 ;biscuit = 5 ; output ; note = biscuit_9 ;biscuit = 9 ; output ; cards; 1 4 6.5 16 2 5 2 4 7 17 4 7 3 7 3 18 6 6 4 5 5 19 4 6 5 3 5 20 6 5 6 2 2.5 21 6 7 7 4 5 22 7 4.5 8 5 4 23 5 8 9 5.5 5.5 24 5.5 4.5 10 4 4 25 7 6 11 5 5 26 5.5 6 12 5 5 27 7 6.5 13 3 6 28 5 5 14 5 4 29 5.5 6.5 15 4 2 30 5 6 ; run ; proc tabulate data=in_long ; class biscuit ; var note ; table (biscuit all), n note*(mean std)*F=6.3 ; run ; Title1 " Anova par GLM"; proc glm data= in_long ; class biscuit ; model note = biscuit ; means biscuit / bon ; run ;