您现在的位置:首页 > 教案格式 > 正文

主成分分析_成份分析_主成分分析的主要步骤(2)

2016-11-26 11:08 网络整理 教案网

用VAR语句指定原始变量。必须为数值型(区间变量)。

例1.一月和七月平均气温的主成份分析

在数据集TEMPERAT中存放有美国一些城市一月和七月的平均气温。我们希望对这两个气温进行主成分分析,希望用一个统一的温度来作为总的可比的温度,所以进行主成份分析。程序如下:

/*EXAMPLE 1*/
DATA TEMPERAT;
   INPUT CITY $1-15 JANUARY JULY;
   CARDS;
MOBILE          51.2 81.6
PHOENIX         51.2 91.2
LITTLE ROCK     39.5 81.4
SACRAMENTO      45.1 75.2
DENVER          29.9 73.0
HARTFORD        24.8 72.7
WILMINGTON      32.0 75.8
WASHINGTON DC   35.6 78.7
JACKSONVILLE    54.6 81.0
MIAMI           67.2 82.3
ATLANTA         42.4 78.0
BOISE           29.0 74.5
CHICAGO         22.9 71.9
PEORIA          23.8 75.1
INDIANAPOLIS    27.9 75.0
DES MOINES      19.4 75.1
WICHITA         31.3 80.7
LOUISVILLE      33.3 76.9
NEW ORLEANS     52.9 81.9
PORTLAND, MAINE 21.5 68.0
BALTIMORE       33.4 76.6
BOSTON          29.2 73.3
DETROIT         25.5 73.3
SAULT STE MARIE 14.2 63.8
DULUTH           8.5 65.6
MINNEAPOLIS     12.2 71.9
JACKSON         47.1 81.7
KANSAS CITY     27.8 78.8
ST LOUIS        31.3 78.6
GREAT FALLS     20.5 69.3
OMAHA           22.6 77.2
RENO            31.9 69.3
CONCORD         20.6 69.7
ATLANTIC CITY   32.7 75.1
ALBUQUERQUE     35.2 78.7
ALBANY          21.5 72.0
BUFFALO         23.7 70.1
NEW YORK        32.2 76.6
CHARLOTTE       42.1 78.5
RALEIGH         40.5 77.5
BISMARCK         8.2 70.8
CINCINNATI      31.1 75.6
CLEVELAND       26.9 71.4
COLUMBUS        28.4 73.6
OKLAHOMA CITY   36.8 81.5
PORTLAND, OREG  38.1 67.1
PHILADELPHIA    32.3 76.8
PITTSBURGH      28.1 71.9
PROVIDENCE      28.4 72.1
COLUMBIA        45.4 81.2
SIOUX FALLS     14.2 73.3
MEMPHIS         40.5 79.6
NASHVILLE       38.3 79.6
DALLAS          44.8 84.8
EL PASO         43.6 82.3
HOUSTON         52.1 83.3
SALT LAKE CITY  28.0 76.7
BURLINGTON      16.8 69.8
NORFOLK         40.5 78.3
RICHMOND        37.5 77.9
SPOKANE         25.4 69.7
CHARLESTON, WV  34.5 75.0
MILWAUKEE       19.4 69.9
CHEYENNE        26.6 69.1
;
PROC PRINCOMP COV OUT=PRIN;

  VAR JULY JANUARY;
RUN;