This study observes the growth of the United States population between the years of 1790 - 1850. Each data point represents a recorded population in a given year, where 1790 is normalized to 0 to view the upward trend and avoid complication (as all numbers are in millions). The graph generated using the dataset represents an exponential curve between the data span. It demonstrates a clear exponential growth within the population with an upward trajectory.
#United States population growth from years 1790 - 1850
#Given data of population size in relation with the given year
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)
#Plot of given data
plot(year, pop, main="United States Population Growth (1790-1850)",
xlab="Years since 1790", ylab="Population (in millions)", pch=19)
#Load 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
#Fitted exponential curve
lines (year,predict (fitline), col = "black")