Question

In R please

Problem 6.4 Water in a cylindrical object will be ejected out the side of the water in the cylinder is above the hole. We exp

0 0
Add a comment Improve this question Transcribed image text
Answer #1

R-commands and outputs:

x=15:6
x
length(x)
xx=rep(x,each=3)
xx

[1] 15 15 15 14 14 14 13 13 13 12 12 12 11 11 11 10 10 10 9 9 9 8 8 8 7 7 7 6 6 6
y=c(16.4,16.4,16.2,14.4,15.3,15,13,14,14.3,12.7,14,13.5,12,11.8,12.2,10.8,12,12,10.8,10.5,11,11.2,10,10,6.7,4.2,6.5,3.4,5,5.5)

# 'lm()' command is used to fit linear model in R.

fit=lm(y~xx)
fit

Call:
lm(formula = y ~ xx)
Coefficients:
(Intercept) xx
-0.9939 1.1766

summary(fit)
Call:
lm(formula = y ~ xx)
Residuals:
Min 1Q Median 3Q Max
-3.0420 -0.5260 -0.1631 0.8974 2.7814
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.99394 0.86123 -1.154 0.258
xx 1.17657 0.07911 14.872 8.09e-15 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.245 on 28 degrees of freedom
Multiple R-squared: 0.8876, Adjusted R-squared: 0.8836
F-statistic: 221.2 on 1 and 28 DF, p-value: 8.09e-15

#From the output of 'lm()' command, we get, intercept= -0.9939 and slope=1.1766
#Regression equation is: yhat= -0.9939 + 1.1766*(xx)

par(mfrow=c(2,2))
plot(fit)


Normal Q-Q Residuals vs Fitted 220 3 2 1 1 Residuals Standardized residuals 0 1 -2 -1 3 тттттт 6 8 10 12 14 16 -2 -1 0 1 2 Fi

#From Residuals VS Leverage graph, observation number '22,26,28' appears to be outliers.

#Model value when xx=depth=1 cm
ypred=-0.9939+1.1766*(1)
ypred

#[1] 0.1827
#Yes this model makes physical sense.

####### MODEL WITHOUT INTERCEPT
fit1=lm(y~xx-1)
fit1

Call:
lm(formula = y ~ xx - 1)
Coefficients:
xx
1.088

summary(fit1)
Call:
lm(formula = y ~ xx - 1)

Residuals:
Min 1Q Median 3Q Max
-3.4195 -0.7197 0.0438 0.8794 2.4920
Coefficients:
Estimate Std. Error t value Pr(>|t|)
xx 1.08850 0.02099 51.85 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.252 on 29 degrees of freedom
Multiple R-squared: 0.9893, Adjusted R-squared: 0.989
F-statistic: 2688 on 1 and 29 DF, p-value: < 2.2e-16

#From the output of 'lm()' command, we get,slope=1.088
#Regression equation is: yhat= 1.088*(xx)

y1pred=1.088*(1)
y1pred

#[1] 1.088par(mfrow=c(2,2))
plot(fit1)

Normal Q-Q Residuals vs Fitted 220 2 - 2 29 207 1 - 0 0 - Residuals Standardized residuals - -2 -2 -1 ...o Presentacdoo 7°280

#From Residuals VS Leverage graph, observation number '22,26,28' appears to be outliers.

### Comparing Models
# We get values of R-square and Residual standard error from output of 'summary()' command.
# Residual error is almost similar. [Residual error for Model with Intercept=1.245 and that for model without intercept= 1.252]

# R-squared is the proportion of variance explained by the regressor(s) in the model.
# R-square (Model With Intercept)=0.8876
# R-square (Model WithOUT Intercept)= 0.9893 [98.93% i.e. about 99% of variation is explained by the regressor (xx) in the model.]
# The model with Higher value of R-square is preferred. [Higher the value of R-square, BETTER is the model].
# Thus, model without intercept is better.

Add a comment
Know the answer?
Add Answer to:
In R please Problem 6.4 Water in a cylindrical object will be ejected out the side...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please include the R code for each individual question. Save PDF to My Note The article...

    Please include the R code for each individual question. Save PDF to My Note The article "The Undrained Strength of Some Thawed Permafrost Soils" (Canadian Geotech. J., 1979: 420-427) contained the accompanying data on y shear strength of sandy soil (kPa), xl depth (m), and x2 water content (%) Obs Depth Content Strength 8.9 31.5 14.7 2 36.6 27.0 48.0 3 36.8 25.9 25.6 46.1 39.1 10.0 56.9 39.216.0 66.9 38.3 16.8 77.3 33.9 20.7 88.4 33.8 38.8 9 6.5...

  • box in answer please 18. 0/10 points I Previous Answers SerPSET9 13.P065 My Notes Ask Your...

    box in answer please 18. 0/10 points I Previous Answers SerPSET9 13.P065 My Notes Ask Your Teacl As an astronaut, you observe a small planet to be spherical. After landing on the planet, you set of, walking always straight ahead, and find yourself returning to your spacecraft from the opposite side after completing a lap of 24.2 km. You hold a hammer and a falcon feather at a height of 1.37 m, release them, and Determine the mass of the...

  • Please answer all the blanks (volume if H2 and everything in analysis). TIA! Data 5 1...

    Please answer all the blanks (volume if H2 and everything in analysis). TIA! Data 5 1 oong 0.00 10.5ml 2 o.olag 0.00 11.0 Trial 3 o.org 0.00 12.00 o Daag o.albg 0.00 10.0 ml 11.5ml Mass of Mg (g) Initial volume of Syringe (mL) Final volume of Syringe (mL) Volume of H (mL) Barometric pressure (torr) Ambient temperature (°C) Vapor pressure of H2O (torr) 779.314har 23. Oi 21.0 forr TA.314tar 23.0c 179.3 14ton 23.0¢ 779.314 ton 23.0c 779.31472 23.0c 21.0...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT