For the following 4 datasets (numbered 1, 2, 3 and 4) assume Y=f(X) and fit the
ID: 3356732 • Letter: F
Question
For the following 4 datasets (numbered 1, 2, 3 and 4) assume Y=f(X) and fit the data with linear semi-log, log-log and quadratic plots. (use excel or matlab) What is the R2 value for each of the plots! Comment on which fit is suitable for each particular Find the 90% and 95% confidence interval for the suitable fit for each dataset. Select any one dataset and plot the Error' Plot and the Parity' Plot. How does an Error Plot and Parity' Plot help in data analysis? 9.2 2.7 0.4 5.2 3.0 Y: 3.6 14 4.7 17.3 82.9 71.6 2.0 1227.1 10.0 X: 0.5 2.9 5.1 0.14 0.5 251 2.0 15.30 5.0 63.71 10.0 Y: .3 5.87 6000 5.73 10000 4.95 4000 3.52 18000 1.08 22000 Y:Explanation / Answer
We shall analyse this using the open source statistical package R
Y <- c(2.7,3.6,4.4,5.2,9.2)
X <- c(0.4,1.1,1.9,3.5)
### fit a model ,
fit <- lm(Y ~X)
## the results of the model are
summary(fit)
### fit a model semi log
fitsemilog <- lm(Y ~log(X))
## the results of the model are
summary(fitsemilog)
### fit a model ,
fitlog <- lm(log(Y) ~log(X))
## the results of the model are
summary(fitlog)
### fit a model ,quadratic
fitq <- lm(Y ~X^2 +X)
## the results of the model are
summary(fitq)
The resutls are
> summary(fit)
Call:
lm(formula = Y ~ X)
Residuals:
1 2 3 4 5
0.2525 0.1946 -0.1000 -0.8052 0.4581
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.9002 0.4405 4.314 0.02295 *
X 1.3683 0.1578 8.673 0.00323 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.5686 on 3 degrees of freedom
Multiple R-squared: 0.9616, Adjusted R-squared: 0.9489
F-statistic: 75.22 on 1 and 3 DF, p-value: 0.003225
> summary(fitsemilog)
Call:
lm(formula = Y ~ log(X))
Residuals:
1 2 3 4 5
0.8855 -0.4948 -0.9267 -1.1563 1.6923
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.8799 0.7371 5.264 0.0134 *
log(X) 2.2541 0.7328 3.076 0.0543 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.425 on 3 degrees of freedom
Multiple R-squared: 0.7592, Adjusted R-squared: 0.679
F-statistic: 9.46 on 1 and 3 DF, p-value: 0.05432
> summary(fitlog)
Call:
lm(formula = log(Y) ~ log(X))
Residuals:
1 2 3 4 5
0.10449 -0.06023 -0.10398 -0.14119 0.20090
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.29854 0.08743 14.853 0.000662 ***
log(X) 0.44721 0.08692 5.145 0.014230 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.169 on 3 degrees of freedom
Multiple R-squared: 0.8982, Adjusted R-squared: 0.8643
F-statistic: 26.47 on 1 and 3 DF, p-value: 0.01423
> fitq <- lm(Y ~X^2 +X)
> summary(fitq)
Call:
lm(formula = Y ~ X^2 + X)
Residuals:
1 2 3 4 5
0.2525 0.1946 -0.1000 -0.8052 0.4581
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.9002 0.4405 4.314 0.02295 *
X 1.3683 0.1578 8.673 0.00323 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.5686 on 3 degrees of freedom
Multiple R-squared: 0.9616, Adjusted R-squared: 0.9489
F-statistic: 75.22 on 1 and 3 DF, p-value: 0.003225
The Rsquare value is highlighted for all the 4 fitted models
Please note that we can answer only 1 question at a time , as per the answering guidelines