You are on page 1of 11

Name: wasim chamanshaikh

Div: A
Roll no :48

ASA Lab Assignment

2 Data Set : HT-WT-Age (Responses) CSV :


Quantitative Variables:

i. Height
Name: wasim chamanshaikh
Div: A
Roll no :48

> #Frequency Table of Height


> freq_table=transform(table(scores))
> freq_table
score s Freq 1
(1 TO, 157] 12
2 (157, 164] 13
5 (164, 171] 21
4 (171, 178] 23
S (178 ,18 5] 24
> t ran sforrr {f req_tabl e , Re 1_Freq=p rop . tabl e Freq) , curr_Freq=cunsum(Freq) )
score s Freq Rel _+req Cu z_Freq
1 (150, 157] 12 0. 12 903 23 12
2 (157, 164] 13 0. 159 7849 25
3 (164, 171] 21 0 . 22 S 806 5 46
4 (171, 178] 2 3 0 . 24 7 3118 69
S (178, 18 5] 24 0.2 S 8064 5 93
> # Histogram of Height
> hist(var)
> hist(var breaks=b1ns, main="Height of Students" xlab=”He1ght(incm)",col=”Red”)

¥50 155 JbO 1g5 170 175 SBO


Name: wasim chamanshaikh
Div: A
Roll no :48

Ii. Age
Name: wasim chamanshaikh
Div: A
Roll no :48

Toyota Corolla:

Quantitative Variable:
i.KM
Name: wasim chamanshaikh
Div: A
Roll no :48

R R 4.1.Z -/
> data<- read . c sv (II 1e . c hoose {J }
> V T ew (d ata }
> d1m (d ata }
1 14 6 10
> str (data}
’ data . frame ' • 14 3 6 oo s . of 10 var 1ab1 es :
S Pr J ce : In t 1 3 S 00 13 7 50 13 9 50 149 S 0 13 750 129 5 0 16900 18600 21500 129 5 0 ...
I Age : int 23 25 24 26 30 3Z 27 30 27 23 ...
I KM : int 46986 72937 41711 48000 38500 61000 94612 75889 19700 71138 ...
$ FuelType : chr "Diesel" "Diesel" "Diesel" "Diesel" .,
$ HP ’ int 90 90 9O 90 90 90 90 90 192 69 .
$ MetColor . int 1 1 1 0 0 0 1 1 0 0
I Automatic: int 0 0 0 0 0 0 0 0 0 0
I CC : int 2000 2000 2000 2000 2000 2000 2000 2000 1800 1900...
5 Doors : int 3 3 3 3 3 3 3 3 3 5
SWeight : int 1165 1165 1165 1165 1170 1170 1245 1245 11B5 1105 ...
> # KI orete rs oata
> var=data$KY
> mx=max (var )

> mn=m\ n (var }


> mn

> w1dth= {rrx- mn / s


> w1dth
1{ 48 599. 8
> b1n s -seq {mn , m x , w1 dt h }
> sco r e s=cu t: {va r , b1 ns}
> tabl e (scores} s
c o re s
(1 , 4. 86 e+O4§ (4 . 86 e+0 4 , 9. 7 2e+O § (9 . 72 e+04 , 1 . 46e+0 5 § (1 . 46 e+O 5 , 1 . 94e+0 5 (1 . 9 4e+O 5 , 2 . 4 3 e+0 5
44 S 718 2 04 47 14

> t ran s form(tab1e (scor e sg g


sc o es Freq
1 C1,4.86e+04J 445
2 (4. 86e•04,9.72e+04s 718
3 {9. 72e+04, 1. 46e+05 204
4 (1. 46e+05 , 1. 94e+0s 47
S (1. 94e•05 , 2. 43e+0S 14
yFrequency Tab1e of K11oueters
I r eq_tab 1e - trans *o r n {tab1e scor es g }
freq_table
sc o es F r eq
1 (I , 4. 86e + 04 j 44S
2 (4. 86 e•04 , 9. 72 e+04 718
3 {9 . 72 e•04 , 1. 46e+05 204
4 (1. 46e+o s , 1. 94e+0 S 47
S (1. 94e•05 , 2. 4 3e+0 S I4
> t r ans form(fr eq_tab1e , Re1_Freq=p rop . tabl e (Freq} , Cum_Freq=c unsu m (Freq
sc o ° es F r eq Re1 _Fr eq Cun_F r eq
1 {1 , 4. 8 6e+ 04§ 44 5 0 . 3116 2 46 5 0 44 5
2 (4. 86 e+O4 , 9. 72 e+04§ 718 O . 5D 28 OLIZ 0 116 3
3 (9 . 72 e+04 , 1. 46e+0 S § 2D4 0. 1428 S 714 3 1367
4 (1. 46e•05 , 1. 94e+05 47 0. D 3 291316 5 1414
5 (1. 94e•0 5, 2. 4 3e+05 14 0. 00980 3922 14 28
# H1 stog ram of' KI 1onete r s
h1 st (var
h1 st (var , breaks=b1ns , naln=' of " , x1ab=” Km " , co1= "B1ue "
h st (var , b reaks=b1n s , mat n= ” KM o1° Car s ” , x1ab= " KM " , c o1=" B1 ue " }
Name: wasim chamanshaikh
Div: A
Roll no :48

ii. CC
Name: wasim chamanshaikh
Div: A
Roll no :48
R R 4.1.2 -/

L1? 2000

wJ dth= {mx- mn } / 5
wJ dth

b \ ns=seq {mn , mx , w1 dth g


s -cu t s}

(1 . 3e o 3, 1. 44e +0 33 (1. 44e o 3, 1. s8e +o S3 (1 . s8 e+0 72e +o S3 (1 . 72ego 3, 1. 8oe +0 3?


168 152

scores Freq
,1 .
2 (I . 44e +03 , 1. S 8 e+03 § 0

5 (1. 86 e 0 2 e+03 2
OF requen cy Tab1e aI CC

scor es * req
1 (1. 3e+03 , 1. 44e+ 03 168
2 (1. 44e+03 , 1. 58e+ 03 0
3 (1. 58e+03 , 1.72e+03J 8 54
4 (1.7ze+03, 1.86e+03s 14
5 (1.86e+03,2e+03J 152

> tr an s for m tfr eq_t ab l e , Re 1 _F r e q =p r op . t ab l e C Fr eqn , Cu m_F r e q=cums u m F r eq } }


scores Freq Re1_Fr eg cum_rr eq z 4z.
se+os,‹. ooe+owl ass o. z z z4ze zse
2 {I. 44e+03, . 58e+03 § 0 0 OOOOOOOO 68
3 €1.58e+O3, 1. 72e+03 J e s o. zzg8 s szz zoz z
4 {1. 72 e+0 5, 1 . 86e+0 3 § 14 0. 011784 51 1036
5 {1 . 86e+0 3, 2 e+03 § 152 0. 12794613 11B8
> # HI st ogr am of° cc
> h st {var g
> h st Char , b reaks -b a n s , man n- ’ CC of' Car s ” , x1ab- ” cc” , c of - " e rown " 3

1300 4OO d5DO 16OO 17 00 1 800 1 9OO 2000


Name: wasim chamanshaikh
Div: A
Roll no :48

Qualitative

Variable: i.Metcolor
Name: wasim chamanshaikh
Div: A
Roll no :48

Ii. Automatic
Name: wasim chamanshaikh
Div: A
Roll no :48

R R ^ 1.2 -/
> #Automat1 c Data
> var=data$Au to ma t 4 c
>

> nn=m1n }
> nn
§1§ 0
> wJ dth= {mx- mn) / 5
> wJ dth
§1§ 0.2
> b ns=seq (mn , rrx , w1 dth)
> score s=cu t (var , b1n s}
> table(scores)
sco re s
(0, O . 2 § (0. 2 , 0. 4§ (0 . 4, 0. 6 ] (0. 6 , 0. 8§ (0. 8, 1§
0 0 0 0 80
> I ransform (tabl e (scor e s} }
score s Freq
1 (0, 0.2] 0
2 (0 . 2, 0. 4] 0
3 (0 . 4, 0. 6 ] 0
4(0.6,0.8] 0
S (0.8,1] 80
> $Frequency Table o* Automatic
> *req_table=trans*orm(tableCscoresJ)
> *req_table
score s Freq 1
(0, 0. 2 § 0
2 (0 . 2, 0. 4§ 0
3 (0. 4, 0. 6 0
4 (0. 6, 0. 8] 0
S (0. 8, 1] 80

> transform(freq_table,Rel_Freq=prop.table(Freq),cum_Freq=cumsum(Freq)) scores Freq Rel_Freq


cum_Freq
1 (0,0.2] 0 0 0
2 (0.Z,0.4] 0 0 0
3 (0.4,0.6] 0 0 0
4 (0.6,0.8] 0 0 0
S (0.8,1] 80 l 80
> #Histogram ofAutomatic
> h st(var
> h st(var , breaks=b1 ns , mat n= ”Au tomatl c Car s ” , xl ab= "Au to nat i c” , co1= "Bl ue ")
Name: wasim chamanshaikh
Div: A
Roll no :48

Automatic Cars
1400
1200
1000
0800

0.0 0.2 0.4 0.6 0.8 1.0

Automatic

You might also like