Admin Admin
Nombre de messages : 418 Date d'inscription : 27/09/2005
| Sujet: TP8 : ANALYSE EN COMPOSANTES PRINCIPALES Ven 2 Déc à 11:41 | |
| Visualiser le nuage de points - Code:
-
Options formdlim='*'; LIBNAME repdata 'C:\Documents and Settings\etudiant\Bureau\TP8'; /* nuage de points*/ title1 'nuage de points'; DATA repdata.tabUS; INFILE 'C:\Documents and Settings\etudiant\Bureau\TP8\ustemp.txt' FIRSTOBS=2 DLM=';'; INPUT City $ :15. January July; RUN; PROC PRINT; RUN; /*macro pour affichage*/ title2 'Plot of Raw Data'; %plotit(data=repdata.tabUS, labelvar=City, plotvars=July January, color=black, colors=blue); RUN;
| |
|
Admin Admin
Nombre de messages : 418 Date d'inscription : 27/09/2005
| Sujet: Re: TP8 : ANALYSE EN COMPOSANTES PRINCIPALES Ven 2 Déc à 11:53 | |
| Analyse en composantes principaleshttp://www.ulg.ac.be/pedaexpe/cours/glosaire/acp.htmhttp://www.obs-vlfr.fr/Enseignement/enseignants/labat/anado/acp/exemp1.htmlhttp://www.labri.fr/perso/amblard/enseignement/statr/acpcor.pdfVisualiser le nuage de points projetés avec la macro. - Code:
-
Options formdlim='*'; LIBNAME repdata 'C:\Documents and Settings\etudiant\Bureau\TP8'; /* nuage de points*/ title1 'nuage de points'; DATA repdata.tabUS; INFILE 'C:\Documents and Settings\etudiant\Bureau\TP8\ustemp.txt' FIRSTOBS=2 DLM=';'; INPUT City $ :15. January July; RUN; PROC PRINT; RUN;
/*macro pour affichage*/ title2 'Plot of Raw Data'; %plotit(data=repdata.tabUS, labelvar=City, plotvars=July January, color=black, colors=blue); RUN;
/*analyse en composantes principales*/ PROC princomp data=repdata.tabUS cov out=Prin; title2; var July January; RUN;
/*affichage*/ title2 'Plot of Raw Data'; %plotit(data=Prin, labelvar=City, plotvars=Prin2 Prin1, color=black, colors=blue); RUN;
Dernière édition par le Ven 6 Jan à 1:15, édité 7 fois | |
|
Admin Admin
Nombre de messages : 418 Date d'inscription : 27/09/2005
| Sujet: Re: TP8 : ANALYSE EN COMPOSANTES PRINCIPALES Ven 2 Déc à 12:26 | |
| Ecrire une ACP sur X1-X5(chenilles) et faire une régression de Y sur Prin1 Prin2 Prin3 - Code:
-
Options formdlim='*'; LIBNAME repdata 'C:\Documents and Settings\etudiant\Bureau\TP8'; /* donnees d'entrée pour la régression*/ title1 'nuage de points chenilles'; DATA repdata.tabpin; INFILE 'C:\Documents and Settings\etudiant\Bureau\TP8\pins.txt' FIRSTOBS=2 DLM=';'; INPUT y x1-x5; RUN;
/*macro pour affichage*/ title2 'Plot of Raw Data pins'; %plotit(data=repdata.tabpin, labelvar=y, plotvars=x1 x2 x3 x4 x5, color=black, colors=blue); RUN;
/*analyse en composantes principales*/ PROC princomp data=repdata.tabpin cov out=Prin; title2; var x1-x5; RUN;
DATA pins; set repdata.tabpin; Prin1=0.999275*X1+ 0.004229*X2+0.036561*X3+ 0.002390*X4+ 0.009475*X5; Prin2= -.033904*X1+0.539487*X2+0.833183*X3+0.038344*X4+0.110185*X5; Prin3=0.016634*X1+ 0.841889*X2-.535938*X3 -.024521*X4 -.055810*X5; RUN;
/*Regression rsquare*/ Title1 'Regression rsquare'; PROC REG data=pins; model Y=Prin1 Prin2 Prin3; RUN;
Dernière édition par le Ven 6 Jan à 0:54, édité 2 fois | |
|
Admin Admin
Nombre de messages : 418 Date d'inscription : 27/09/2005
| Sujet: Re: TP8 : ANALYSE EN COMPOSANTES PRINCIPALES Ven 2 Déc à 12:35 | |
| Utiliser PROC FACTOR - Code:
-
Options formdlim='*'; LIBNAME repdata 'C:\Documents and Settings\etudiant\Bureau\TP8'; /* nuage de points*/ title1 'nuage de points'; DATA repdata.tabUS; INFILE 'C:\Documents and Settings\etudiant\Bureau\TP8\ustemp.txt' FIRSTOBS=2 DLM=';'; INPUT City $ :15. January July; RUN; PROC PRINT; RUN;
/*macro pour affichage*/ title2 'Plot of Raw Data'; %plotit(data=repdata.tabUS, labelvar=City, plotvars=July January, color=black, colors=blue); RUN;
/*analyse en composantes principales*/ PROC princomp data=repdata.tabUS cov out=Prin; title2; var July January; RUN;
/*affichage*/ PROC FACTOR data=repdata.tabUS; RUN; | |
|
Admin Admin
Nombre de messages : 418 Date d'inscription : 27/09/2005
| Sujet: Re: TP8 : ANALYSE EN COMPOSANTES PRINCIPALES Ven 6 Jan à 1:06 | |
| ACP sur les données "Europe", sur 2 axes principaux - Code:
-
Options formdlim='*'; LIBNAME repdata 'G:\DocsdeMicka\Master2\Projets\SAS'; /* nuage de points*/ title1 'nuage de points'; DATA repdata.europe; INFILE 'G:\DocsdeMicka\Master2\Projets\SAS\europe.txt'; INPUT pays $ :17. pop superficie pib date monnaie $; RUN; PROC PRINT; RUN;
/*macro pour affichage*/ title2 'Plot of Raw Data'; %plotit(data=repdata.europe, labelvar=pays, plotvars=pop superficie pib date, color=black, colors=blue); RUN;
/*analyse en composantes principales*/ PROC princomp data=repdata.europe cov out=Prin; title2; var pop superficie pib date; RUN;
/*affichage*/ title2 'Plot of Raw Data'; %plotit(data=Prin, labelvar=pays, plotvars=Prin2 Prin1, color=black, colors=blue); RUN; | |
|
Contenu sponsorisé
| Sujet: Re: TP8 : ANALYSE EN COMPOSANTES PRINCIPALES | |
| |
|