Answered>Order 6583

R programming question

a) Read the data file transform_data.txt from the course website into R, and make a scatterplot of y versus x. Clearly, the relationship is nonlinear and monotonic. I can tell you that a good transformation that linearizes the relationship is to take the sqrt of both and x and y. Make a scatterplot of the transformed data.

dat <- read.table(“http:// header=T) <<<< this is the course website

b) Perform regression on the transformed data, and overlay the regression line on the scatterplot of the transformed data in part a). Call the model lm.1 .

c) It appears that a good model for this data is sqrt(y) = alpha + beta sqrt(x). Using algebra alone (i.e. no R) show that this model is equivalent to the following model: y = alpha +beta_1 sqrt(x) + beta_2 x .

d) Fit a regression model of the form y = alpha + beta_1 sqrt(x) + beta_2 x to the data. Call it lm.2 .

e) To check that the two models (lm.1 and lm.2) are similar, make a scatterplot of their predictions. Just keep in mind that the second model predicts y, but the first model predicts sqrt(y)

 
"Not answered?"
Get the Answer