In: Statistics and Probability
The population of a culture of bacteria is calculated and recorded after each hour, for a six-hour period.
0 | 98 |
1 | 206 |
2 | 405 |
3 | 783 |
4 | 1550 |
5 | 2520 |
6 | 5630 |
The R code given below.
X <- 0:6
Y <- c(98, 206, 405,
783, 1550, 2520, 5630)
linear.model <- lm(Y ~ X)
print(summary(linear.model))
X2 <- X^2
quadratic.model <- lm(Y ~ X+X2)
print(summary(quadratic.model))
exponential.model <- nls(Y ~ exp(a + b * X),start = list(a = 1,
b = 1))
print(summary(exponential.model))
plot(1:1)
dev.new()
plot(X,Y, col="blue", lwd=2, xlab="X", ylab = "Y",
main="Scatterplot & Regression lines")
curve( 798.9*x-797.8, xlim=c(0,6), lwd=2, col = "red",
add=TRUE)
curve(233.8 *x^2-604.2*x+371.4, lwd=2, col = "violet",
add=TRUE)
curve(exp(4.4729+ 0.6916*x), lwd=2, col = "green",
add=TRUE)
a,b) The scatter plot and regression lines are plotted on the same window.
The linear model is : and Multiple R-squared: 0.7642
The quadratic model is :
and Multiple R-squared: 0.9606
The exponential model is :
The exponential model is the best fit and the linear model is the least fit.
c) The initial number of bacteria at the beginning of the study
are calculated below.
For the linear model,
For The quadratic model is :
:
d) From the plots, The exponential model is the best fit.