In: Statistics and Probability
pl use R code to do that and show me the program
Use a linear regression of Y~log(X) using the labtestdata.csv data to predict Y (2dp) when x = 250 on the unlogged scale?
Calculate the F-value (1 dp) from an ANOVA on the regression of Y~log(X) using the data contained in labtestdata.csv
abtestdata.csv
y | x |
1.018746 | 1 |
1.508895 | 2 |
0.727282 | 3 |
1.787127 | 4 |
2.903983 | 5 |
3.181554 | 6 |
1.737834 | 7 |
2.715766 | 8 |
1.570552 | 9 |
3.046107 | 10 |
4.499675 | 11 |
4.240688 | 12 |
3.326716 | 13 |
4.626502 | 14 |
4.44944 | 15 |
3.861936 | 16 |
As requested, the R code with commented explanation is provided to solve the given problem,
_____________________________________________________________________________________________
> d = read.csv("labtestdata.csv",header = T) ## importing the data > d
> fit = lm(y~I(log(x)),data=d) ## fitting the required regression model > summary(fit) ## details of the fitted model
> predict(fit,data.frame(x=c(250))) ## value of Y for X = 250
> summary(aov(fit)) ## Details on Anova of the fitted model
##### Please note : the above F Value is the required solution.####