Sejal Gupta: #Question 1
Sejal Gupta: #Question 1
5074
#Question 1
a = c(7,5,9,2,1,8,4,2,4,8)
mean(a)
[1] 5
median(a)
[1] 4.5
sd(a)
[1] 2.867442
sort(a)
1224457889
#Question 2
b = scan(afile.choose())
Read 35 items
summary(b)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.000 2.500 5.000 5.286 8.000 10.000
boxplot(b)
stem(b)
The decimal point is at the |
1 | 0000
2 | 00000
3|0
4 | 00000
5 | 0000
6 | 0000
7|0
8 | 000
9 | 0000000
10 | 0
qqnorm(b)
qqline(b)
#Question 3
x =c(2,8,13,10,12,12,8,16,5,5,14)
y=c(4,16,18,13,19,16,8,5,19,6,7)
plot(x,y)
#This data set appears to have a weak linear relationship.
#correlation is near 0
cor(x,y)
[1] 0.1408112
lm_model = lm(x~y)
abline(lm_model,col="red")
summary(lm_model)
Call:
lm(formula = x ~ y)
Residuals:
Min 1Q Median 3Q Max
-6.7356 -2.9524 0.3428 2.4333 7.1620
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8.3260 3.1680 2.628 0.0274 *
y 0.1024 0.2400 0.427 0.6796
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#since there is a weak linear relationship between x and y therefore this linear
model would not be appropriate.