Professional Documents
Culture Documents
SID-999459827
O
bs name
part
y
start
end
ag
e
roman_numerals_age
1 Ford
MCMLXXIV
MCMLXXVII
61
MCMXIII
2 Carter
MCMLXXVII
MCMLXXXI
52
MCMXXV
3 Reaga
MCMLXXXI
MCMLXXXI
X
69
MCMXII
4 Bush4
MCMLXXXI
X
MCMXCIII
64
MCMXXV
5 Clinto
MCMXCIII
MMI
46
MCMXLVII
6 Bush4
MMI
MMIX
54
MCMXLVII
7 Obam
MMIX
47
MCMLXII
n
1
n
3
a
Problem 2.2: Change in CPI relative to previous month( printed first 5 observations only)
Ob
s month
date
cpi
change_in_cpi
1534
1
177.
1
1537
2
177.
8
0.7
1540
0
178.
8
1.0
1543
1
179.
8
1.0
1546
1
179.
8
0.0
Problem 2.3: Consumer Price Index test the normality distribution assumption.
The SAS System
The UNIVARIATE Procedure
Variable: change_in_cpi
STA-201 HW-2
N
Mean
Std Deviation
Skewness
Uncorrected
SS
Coeff
Variation
Moments
145 Sum Weights
0.3978 Sum
Observations
0.8782355 Variance
3
- Kurtosis
1.1336079
134.01236 Corrected SS
3
220.77313 Std Error Mean
5
0.8782
4
0.7713
0
6.5480
0
1.0900
0
SID-999459827
145
57.681
0.7712976
5
4.7417521
5
111.06686
1
0.0729334
9
STA-201 HW-2
SID-999459827
Extreme Observations
Lowest
Highest
Valu Ob Valu Ob
e
s
e
s
- 83 1.85 63
4.14
3
8
- 82 1.88 13
2.21
6
4
0
- 84 2.15 111
2.19
8
7
- 47 2.18 78
1.60
3
0
- 58 2.40 45
1.10
0
0
Missing Values
Missi Coun
Percent Of
ng
t
All
Missing
Value
Obs
Obs
.
11
7.05
100.00
Conclusion- The distribution looks heavy tailed. Hence the change in CPI doesnt seem to follow a normal
distribution.
Problem 2.4a) The weight used to calculate the average age of presidents.
STA-201 HW-2
SID-999459827
Mean
Std Dev
Minimu
m
57.1142
857
22.5190
713
46.0000
000
Maximu
m
69.00000
00
b) The data was initially sorted in descending for the variable party and then the average age was calculated
using weights.
party=D
Mean
Std Dev
Minimum
Maximum
48.000000
0
9.797959
0
46.000000
0
52.000000
0
party=R
Analysis Variable : age
N
Mean
Std Dev
61.869565
2
17.536711
0
Minimum
Maximum
54.000000 69.0000000
0
Problem 2.5: The Average percentage of Californians who ride bike to work.
Mean
Std Dev
Minimum
Maximum
STA-201 HW-2
439
1.010483
3
405.179739
1
SID-999459827
0 16.6000000
STA-201 HW-2
SID-999459827
run;
ods rtf file= 'amruta.calculate_cpi.rtf';
proc print data = amruta.calculate_cpi (obs=5);
title 'Problem 2.2:Change in CPI relative to previous month';
run;
ods rtf close;
/* Problem 2.3 */
PROC UNIVARIATE DATA=amruta.calculate_cpi;
QQPLOT change_in_cpi;
HISTOGRAM;*/
RUN;
proc print;
run;
/* Problem 2.4*/
data amruta.presidents1;
set amruta.presidents;
year=end-start;
run;
ods rtf file= 'amruta.presidents1.rtf';
proc means data = amruta.presidents1;
weight year;
var age;
run;
ods rtf close;
proc sort data= amruta.presidents OUT=amruta.democrats ;
BY party ;
RUN ;
data amruta.democrats;
set amruta.democrats;
year= end-start;
run;
proc means data =amruta.democrats;
by party;
weight year;
var age;
run;
/*Problem 2.5*/
proc import datafile ="C:\Users\amrmad\Documents\amruta\bikecommuters.xlsx" out=amruta.bike;
sheet='sheet1';
run;
ods rtf file= 'amruta.bike.rtf';
proc means data = amruta.bike;
weight Total_Workers;
var Bike_Share_of_Commuters;
STA-201 HW-2
run;
ods rtf close;
/*end of code*/
SID-999459827