Professional Documents
Culture Documents
19BEE1198 Shini Gupta Fat Lab Exam: Output
19BEE1198 Shini Gupta Fat Lab Exam: Output
Shini Gupta
Fat lab exam
Question 1
Create your own (Student Record) dataset and do the summary statistics and graphs with interpretation.
Use atleast 10 observations with five variables. Also find the correlation coefficient between any two
variables along with their regression line.
Code
#19BEE1198
#Shini Gupta
x=c(1,2,3,4,5,6,7,8,9,10)
r=c("19BEE1011","19BEE1012","19BEE1013","19BEE1014","19BEE1015","19BEE1016","19BEE1017","19
BEE1018","19BEE1019","19BEE1020")
n=c("B","S","C","S","A","A","B","A","S","S")
y=c(490,486,492,350,300,345,164,232,321,123)
f=c(1,1,2,3,3,7,2,32,23,12)
df=data.frame(s,r,n,f,m)
df
cor(x,y)
relation=lm(x~y)
relation
plot(x, y)
abline(lm(x~y))
plot(y, x)
abline(lm(x~y))
output
> #19BEE1198
> #Shini Gupta
> x=c(1,2,3,4,5,6,7,8,9,10)
>
r=c("19BEE1011","19BEE1012","19BEE1013","19BEE1014","19BEE1015","19BEE1016","19BE
E1017","19BEE1018","19BEE1019","19BEE1020")
> n=c("B","S","C","S","A","A","B","A","S","S")
> y=c(490,486,492,350,300,345,164,232,321,123)
> f=c(1,1,2,3,3,7,2,32,23,12)
> df=data.frame(s,r,n,f,m)
> df
s r n f m
1 1 19BEE1011 B 1 490
2 2 19BEE1012 S 1 486
3 3 19BEE1013 C 2 492
4 4 19BEE1014 S 3 350
5 5 19BEE1015 A 3 300
6 6 19BEE1016 A 7 345
7 7 19BEE1017 B 2 164
8 8 19BEE1018 A 32 232
9 9 19BEE1019 S 23 321
10 10 19BEE1020 S 12 123
> cor(x,y)
[1] -0.8690294
> relation=lm(x~y)
> relation
Call:
lm(formula = x ~ y)
Coefficients:
(Intercept) y
12.06334 -0.01987
> plot(x, y)
> abline(lm(x~y))
> plot(y, x)
> abline(lm(x~y))
Plot
Question 2
#19BEE1198
#Shini Gupta
mean=1.5
#(a)P(x=0)
d=dpois(0,1.5)
c=1-ppois(2,1.5)
day1=d*100
#Other prob
day2=c*100
day1
day2
Output
> #19BEE1198
> #Shini Gupta
> mean=1.5
> #(a)P(x=0)
> d=dpois(0,1.5)
> #P(Some demand is refused ) = P(Demand is more than 2 cars per days)
> c=1-ppois(2,1.5)
> d
[1] 0.2231302
> c
[1] 0.1911532
> #propotion of days when nither car is used
> day1=d*100
> #Other prob
> day2=c*100
> day1
[1] 22.31302
> day2
[1] 19.11532
>
Question 3
Assume that the mean height of soldiers is 68.22inches with a variance of 10.8inches. How many
soldiers in a regiment of 1000 would you expect to be over 6 feet tall?
#19bee1198
#shini gupta
x1=68.22
sd1=10.8
#6f=72inches
z=(72-x1)/sd1
#p(z>0.35)
a=pnorm(68.22,72,10.8)
a
#number of soldiers
b=a*1000
output
> #19bee1198
> #shini gupta
> x1=68.22
> sd1=10.8
> #6f=72inches
> z=(72-x1)/sd1
> z
[1] 0.35
> #p(z>0.35)
> a=pnorm(68.22,72,10.8)
> a
[1] 0.3631693
> #number of soldiers
> b=a*1000
> b
[1] 363.1693
>
Question 4
#19bee1198
#shini gupta
x=c(9,11,13,11,15,9,12,14)
y=c(10,12,10,14,9,8,10)
t.test(x,y)
Output
> #19bee1198
> #shini gupta
> x=c(9,11,13,11,15,9,12,14)
> y=c(10,12,10,14,9,8,10)
> t.test(x,y)
data: x and y
t = 1.2254, df = 12.97, p-value = 0.2422
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-1.008756 3.651613
sample estimates:
mean of x mean of y
11.75000 10.42857