Future Wisdom Institute - Informatics-based interdisciplinary research group

Lectures

Introduction to Information Systems

Fall semester, 2022 lectures 1-8 infosys-08.pdf

Introduction to Operations Research

Academic Year 2022

#####################################################################
# regression.R: A demo R script for Introduction to OR
# version: 1.0 (2022/07/19), liangz
# data source:
#  1. United States House of Representatives, Representatives
#     Apportioned to Each State (1st to 23rd Census, 1790–2010),
#     https://history.house.gov/Institution/Apportionment/state_apportionment/
#     (Accessed: Jan 10, 2021).
#  2. United States Census Bureau, CPH-2, Table-4. Population: 1790–1990.
#     https://www2.census.gov/programs-surveys/decennial/1990/tables/cph-2/table-4.pdf
#     (Accessed: Jan 10, 2021)
#####################################################################

data <- data.frame(
   Year = c(1790,1800,1810,1820,1830,1840,1850,1860,1870,1880,1890,1900,1910,1920),
   Population = c(3929214,5308483,7239881,9638453,12866020,17069453,23191876,31443321,38558371,50189209,62979766,76212168,92228531,106021568),
   Representatives = c(105,141,181,213,240,223,234,241,292,325,356,386,435,435),
   Senates = c(30,32,34,48,48,52,62,68,74,76,88,90,96,96)
)

# First, try the linear regression

X <- data$Population
Y <- data$Representatives

model <- lm(Y ~ X)
summary(model)

plot(X,Y)
abline(model)

# => Y = 2.917e-06 X + 1.601e+02 with Adjusted R^2 = 0.9185, p-value = 4.229e-08

# Next, try the log-log regression

X <- log10(X)
Y <- log10(Y)

model <- lm(Y ~ X)
summary(model)

plot(X,Y)
abline(model)

# => Y = 10^-0.32149 X^0.36902 with Adjusted R^2 = 0.9299, p-value = 1.703e-08