Summary

This analysis examines the population growth of the United States from 1790 to 1850, using data collected at ten-year intervals for sixty years. The population values are in millions and centered around 1790 for ease of model fitting to avoid issues with very large exponents. The population of each year selected was recorded, starting with the year 1790 having a population of 3.929 million, 1800 having a population of 5.308 million, 1810 having 7.240 million people, 1820 had 9.638 million people, 1830 contained a population of 12.866 million, 1840 with 17.069 million individuals, and 1850 with the final count of 23.192 million people. A nonlinear regression method was used to model the data; the exponential curve clearly reflects the accelerating growth in population over this period.

#Final's Project

#Date and Population growth
year <- c(0,10,20,30,40,50,60)
pop <- c(3.929, 5.308, 7.240, 9.638, 12.866, 17.069, 23.192)

#PLotting data
plot(year, pop, main="US Population Growth from (1790-1850)", 
xlab="Years after 1790", ylab="Population (in millions)", pch=19)

# Load the nls2 library
library(nls2)
## Loading required package: proto
# Define the exponential model
fitline <- nls2(pop ~ pop0 * exp(k * year), 
start = list(pop0 = 3.9, k = 0.05), )

# Print the model summary to see estimated parameters
summary(fitline)
## 
## Formula: pop ~ pop0 * exp(k * year)
## 
## Parameters:
##       Estimate Std. Error t value Pr(>|t|)    
## pop0 3.9744064  0.0407277   97.58 2.14e-09 ***
## k    0.0293421  0.0002023  145.02 2.96e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.09817 on 5 degrees of freedom
## 
## Number of iterations to convergence: 5 
## Achieved convergence tolerance: 5.082e-08
#Line outline
lines (year,predict (fitline), col = "blue")