0% found this document useful (0 votes)
58 views4 pages

Sejal Gupta: #Question 1

The document contains code and analysis to calculate summary statistics like mean, median, and standard deviation for different data sets. It also contains code to plot data, check for normal distribution, and perform linear regression. The linear regression analysis shows a weak linear relationship between two variables x and y, with a correlation near 0, so a linear model would not be appropriate for this data.

Uploaded by

Sejal Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views4 pages

Sejal Gupta: #Question 1

The document contains code and analysis to calculate summary statistics like mean, median, and standard deviation for different data sets. It also contains code to plot data, check for normal distribution, and perform linear regression. The linear regression analysis shows a weak linear relationship between two variables x and y, with a correlation near 0, so a linear model would not be appropriate for this data.

Uploaded by

Sejal Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Sejal gupta

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)

The data is distributed normally.

#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

Residual standard error: 4.534 on 9 degrees of freedom


Multiple R-squared: 0.01983, Adjusted R-squared: -0.08908
F-statistic: 0.1821 on 1 and 9 DF, p-value: 0.6796

#since there is a weak linear relationship between x and y therefore this linear
model would not be appropriate.

You might also like