************************************************************; * Cas barres ; * espace perceptuel non pré défini ; * Pierre Desmet 2012 ; ***********************************************************; Title1 H=1 j=l "Etude Barres chocolatées"; Footnote1 H=1 j=l "Analyse sensorielle" j=r "Master Marketing. 2012" ; *****************************************************************************; * Espace perceptuel des barres chocolatées : variables objectives; *****************************************************************************; data objectif ; length descriptif $ 100. fab $ 10. marque $ 9. type $ 9.; input fab $ marque $ Cacao_100 Coco Nougat Caramel Nois_Cacahuet Cereales Chocolat Biscuit Gaufrettes Prix_lot Combien Poids_total Poids_u Prix_u Prix_kg Cal Cal_u Proteines_100 Glucides_100 G_sucres_100 G_autre_100 Lipides_100 Descriptif $; /* ne pas laisser d'espace dans le descriptif */ if chocolat=1 then type="Chocolat"; else if biscuit=1 then type="Biscuit"; else type="Gaufrette" ; /* attention : si couper/coller d'excel , penser à remplacer les '.' par des '.' */ cards; Nestlé Nuts 0 0 0 1 1 0 1 0 0 2.70 6 252 42.0 0.45 10.71 498 209 4.6 62.3 55.2 7.1 24.8 Chocolat_au_lait_fourrage_caramel_et_noisettes Mars Snickers 1 0 0 1 1 0 1 0 0 2.44 6 300 50.0 0.41 8.13 503 252 9.1 56.2 48.6 7.6 26.7 Chocolat_au_lait_100%_pur_beurre_de_cacao_fourré_de_confiserie_et_de_caramel_avec_des_cacahuètes_grillées Mars Mars 1 0 0 1 0 0 1 0 0 2.09 6 252 42.0 0.35 8.29 452 190 3.5 70.2 54.3 15.9 17.2 Chocolat_au_lait_100%_pur_beurre_de_cacao_fourré_de_confiserie_et_caramel Mars Milky_way 1 0 0 0 0 0 1 0 0 2.50 9 197 21.9 0.28 12.69 449 98 4 71.8 66.8 5 16.1 Chocolat_au_lait_100%_pur_beurre_de_cacao_fourré_de_mousse_dau_lait Mars Bounty 1 1 0 0 0 0 1 0 0 2.75 10 285 28.5 0.28 9.65 488 139 3.7 58.3 48 10.3 26.1 Chocolat_au_lait_100%_beurre_de_cacao_fourré_de_noix_de_coco_blanche_et_tendre Kraft Nougatti 0 0 1 0 0 0 1 0 0 3.99 9 270 30.0 0.44 14.78 470 141 6.2 57.5 56 1.5 24 Chocolat_au_lait_extra-fin_fourré_au_nougat Nestlé Lion 0 0 0 1 0 1 0 0 1 2.48 6 252 42.0 0.41 9.84 493 207 5.5 65.5 53.1 12.4 22.9 Gaufrette_fourrée_nappage_caramelisé_et_céréales_enrobage_chocolat_au_lait Ferrero Kinder 0 0 0 0 1 0 0 0 1 2.79 10 215 21.5 0.28 12.98 394 85 9.2 49.5 41.3 8.2 37.3 Fines_gaufrettes_enrobées_de_chocolat_au_lait_fourrées_lait_et_noisettes_broyées Nestlé Kit_Kat 0 0 0 0 0 0 0 0 1 2.14 6 270 45.0 0.36 7.93 522 235 7 60.2 49.4 10.8 27.6 Gaufrette_croustillante_enrobée_de_chocolat_au_lait Auchan Pouce 0 0 0 1 0 1 0 0 1 1.65 10 300 30.0 0.17 5.50 496 149 4.5 66 . . 23.5 Gaufrettes_et_riz_souflé_nappés_de_caramel_et_enrobées_de_chocolat_au_lait Nestlé Sundy 0 0 0 0 0 1 0 1 0 2.55 5 180 36.0 0.51 14.17 508 183 3.7 64.5 34.1 30.4 25.4 Barre_croustillante_de_céréales_au_chocolat Mars Balisto 1 0 0 0 0 1 0 1 0 2.10 9 166 18.4 0.23 12.65 503 93 7.4 60.3 43.8 16.5 25.1 Biscuit_aux_céréales_complètes__crème_et_fruit_des_bois_enrobage_avec_du_chocolat_au_lait_100%_pur_beurre_de_cacao Mars Twix 1 0 0 1 0 0 0 1 0 1.65 6 348 58.0 0.28 4.74 495 287 4.4 64.6 48.7 15.9 24 Biscuit_nappé_au_caramel_et_enrobé_avec_du_chocolat_au_lait_100%_pur_beurre_de_cacao ; run ; Title2 h=2 'Données objectives : Fabriquant'; proc print data=objectif ; var Marque Fab descriptif ; run ; Title2 h=2 'Données objectives : Lot et Prix'; proc print data=objectif ; var Marque Prix_lot Combien poids_total poids_u Prix_u Prix_kg ; run ; Title2 h=2 'Données objectives : proteines, glucides, lipides'; proc print data=objectif ; var Marque cal cal_u Proteines_100 Glucides_100 G_sucres_100 G_autre_100 Lipides_100 ; run ; Title2 h=2 'Données par type : proteines, glucides, lipides'; proc tabulate data=objectif ; class type ; var cal cal_u Proteines_100 Glucides_100 G_sucres_100 G_autre_100 Lipides_100 ; table (cal cal_u Proteines_100 Glucides_100 G_sucres_100 G_autre_100 Lipides_100)*(min max mean)*F=4.0, type; run ; Title2 h=2 'Données par type : Prix '; proc tabulate data=objectif ; class type ; var Prix_lot Combien poids_total poids_u Prix_u Prix_kg ; table (Prix_lot Combien poids_total poids_u Prix_u Prix_kg)*(min max mean)*F=4.1, type; run ; proc sort data=objectif; by marque; run ; *****************************************************************************; * Traitement des Variables quantitatives par ACP ; *****************************************************************************; /* tableau par marque */ Title2 'Barres chocolatées : variables quantitatives par marque'; Proc tabulate data=objectif ; class marque ; var Prix_lot Combien poids_total poids_u Prix_u Prix_kg cal cal_u Proteines_100 Glucides_100 G_sucres_100 G_autre_100 Lipides_100 ; table marque, (Prix_lot Combien poids_total poids_u Prix_u Prix_kg cal cal_u Proteines_100 Glucides_100 G_sucres_100 G_autre_100 Lipides_100)*(mean); run; /* tableau par fabriquant * marque */ Title2 'Barres chocolatées : variables quantitatives par fabriquant * marque'; Proc tabulate data=objectif ; class fab marque ; var Prix_lot Combien poids_total poids_u Prix_u Prix_kg cal cal_u Proteines_100 Glucides_100 G_sucres_100 G_autre_100 Lipides_100 ; table fab*marque, (Prix_lot Combien poids_total poids_u Prix_u Prix_kg cal cal_u Proteines_100 Glucides_100 G_sucres_100 G_autre_100 Lipides_100)*(mean); run; ods graphics on ; ********************************; * exploration ; ********************************; Title2 'ACP des barres chocolatées (variables quanti): exploration'; proc corr data=objectif ; var Prix_lot Combien poids_total poids_u Prix_u Prix_kg cal cal_u Proteines_100 Glucides_100 G_sucres_100 G_autre_100 Lipides_100 ; run ; proc factor data=objectif n=4 rotate=varimax; var Prix_lot Combien poids_total poids_u Prix_u Prix_kg cal cal_u Proteines_100 Glucides_100 G_sucres_100 G_autre_100 Lipides_100 ; run ; ****************************************************; * sélection des variables et choix du nombre d'axes ; ****************************************************; Title2 'ACP des barres chocolatées (variables quanti): variables à choisir'; proc factor data=objectif msa rotate=varimax n=2 out=obj_factor plots=all ; var cal Proteines_100 G_sucres_100 G_autre_100 Lipides_100 ; run ; data work ; set obj_factor ; keep X Y Xsys Ysys text size ; Label Y='Dim 2' X='Dim 1'; size=1; xsys='2'; ysys='2'; X=Factor1; Y=factor2; text=marque ; run; proc gplot data=work; symbol1 V=none interpol=none; plot Y*X=1 / haxis=axis1 vaxis=axis2 annotate=work Frame Href=0 Vref=0; run; *****************************************************************************; * Variables nominales ; *****************************************************************************; Title2 'Espace perceptuel des barres chocolatées (variables nominales)'; /* tableau par marque */ Title2 'Tableau des variables nominales par marque'; Proc tabulate data=obj_factor ; class marque ; var cacao_100 Coco Nougat Caramel Nois_Cacahuet cereales Chocolat Biscuit Gaufrettes ; table marque, (Cacao_100 Coco Nougat Caramel Nois_Cacahuet cereales Chocolat Biscuit Gaufrettes)*(mean*F=4.0); run; /* tableau total : médiane et moyenne des variables quanti */ Title2 'Tableau des variables nominales : détermination de la médiane'; Proc tabulate data=obj_factor ; var Prix_lot Combien poids_total poids_u Prix_u Prix_kg cal cal_u Proteines_100 Glucides_100 G_sucres_100 G_autre_100 Lipides_100 ; table (Prix_lot Prix_u Prix_kg Combien poids_total poids_u cal cal_u Proteines_100 Glucides_100 G_sucres_100 G_autre_100 Lipides_100),(mean median); run; data obj_factor; set obj_factor ; if cal=. then cal_B=.; else if cal>495 then cal_B=1; else cal_B=0 ; if Proteines_100 =. then Proteines_B=. ; else if Proteines_100>4.6 then Proteines_B=1; else Proteines_B=0; if G_sucres_100=. then G_sucres_B=. ; else if G_sucres_100> 49 then G_sucres_B=1; else G_sucres_B =0; if G_autre_100 =. then G_autre_B=.; else if G_autre_100>10.55 then G_autre_B =1; else G_autre_B = 0; if Lipides_100=. then Lipides_B=. ; else if Lipides_100> 24.8 then Lipides_B=1; else Lipides_B = 0; run ; proc format ; value cal 0="CL-" 1="Calorie"; value Coco 0="CO-" 1="Coco"; value proteines 0="PR-" 1="protein" ; value lipides 0="LI-" 1="Lipide" ; value G_sucre 0="SU-" 1="Sucre" ; value G_autre 0="GA-" 1="Gluc_A" ; value cacao_100p 0="CA-" 1="Cacao100" ; value Nougat 0="NO-" 1="Nougat" ; value Caramel 0="CA-" 1="Caramel" ; value Nois_Cacahuet 0="NX- " 1="Nois_Cacah" ; value cereales 0="CE-" 1="Cereales" ; value Chocolat 0="CH-" 1="T_Chocolat" ; value Biscuit 0="BI-" 1="T_Biscuit" ; value Gaufrettes 0="G-" 1="T_Gaufrettes" ; run ; /* tableau discretisé complet */ Title2 'Tableau des variables nominales discrétisées par marque'; Proc tabulate data=obj_factor ; class marque ; var cacao_100 Nougat Caramel Nois_Cacahuet cereales Chocolat Biscuit Gaufrettes cal_B Proteines_B G_sucres_B G_autre_B Lipides_B; table marque, (cacao_100 Nougat Caramel Nois_Cacahuet cereales Chocolat Biscuit Gaufrettes cal_B Proteines_B G_sucres_B G_autre_B Lipides_B)*(mean*F=4.0); run; ods graphics on ; ********************************; * exploration ; ********************************; Title2 'Espace perceptuel des barres chocolatées (variables nominales) : exploration'; proc corresp data=obj_factor DIMENS=4 ; Tables marque, cacao_100 Nougat Caramel Nois_Cacahuet Cereales Chocolat Biscuit Gaufrettes Cal_B Proteines_B G_sucres_B G_autre_B Lipides_B; Format cal_B cal. cacao_100 cacao_100p. Nougat nougat. Caramel caramel. cereales cereales. Chocolat chocolat. Biscuit biscuit. Nois_Cacahuet Nois_Cacahuet. Gaufrettes gaufrettes. Proteines_B proteines. G_sucres_B G_sucre. G_autre_B G_autre. Lipides_B lipides. coco coco. ; run ; ****************************************************; * sélection des variables et choix du nombre d'axes ; ****************************************************; Title2 'Espace perceptuel des barres chocolatées (variables nominales) : variables choisies'; proc corresp data=obj_factor OUTC=obj_cor (rename= (_NAME_=marque)) DIMENS=2 ; Tables marque, cacao_100 Cereales Caramel Nois_cacahuet Chocolat Biscuit Gaufrettes cal_B Proteines_B G_sucres_B G_autre_B Lipides_B; Format cal_B cal. cacao_100 cacao_100p. Nougat nougat. Caramel caramel. cereales cereales. Chocolat chocolat. Biscuit biscuit. Nois_Cacahuet Nois_Cacahuet. Gaufrettes gaufrettes. Proteines_B proteines. G_sucres_B G_sucre. G_autre_B G_autre. Lipides_B lipides. coco coco.; run ; proc sort data=obj_cor; by marque; run ; data objectif_cor ; merge obj_factor obj_cor ; by marque ; If _TYPE_="OBS" ; run ; Title2 'Obj_Cor : Tableau de sortie de l"AFACO'; proc print data=objectif_cor ; run ; Title2 'Graphique de sortie de l"AFACO'; data work ; set objectif_cor ; X=dim1; Y=dim2; text=Marque ; Label Y='Dim 2' X='Dim 1'; size=1; xsys='2'; ysys='2'; keep X Y Xsys Ysys text size _TYPE_; run; * axis1 length=17 cm order=(-15 to 15 by 1); * axis2 length=17 cm order=(-15 to 15 by 1); proc gplot data=work; symbol1 V=none interpol=none; * where _TYPE_="OBS"; plot Y*X=1 / haxis=axis1 vaxis=axis2 annotate=work Frame Href=0 Vref=0; run;