This assignment is designed to review the materials you learn in the
lab. Be sure to comment your code to clarify what you are doing. Not
only does it help with grading, but it will also help you when you
revisit it in the future. Please use either RMarkdown or
knitr to turn in your assignment. These are fully compatible
with R and LaTeX. If your code uses random number generation,
please use set.seed(12345)
for replicability. Please post
any questions on Piazza.
Open the newhamp
dataset from the faraway
R package. This dataset contains vote counts and other
demographic information from 276 wards (i.e., voting districts) in the
2008 Democratic Party presidential primary in the U.S. state of New
Hampshire.
pObama
is the
dependent variable. Choose three other explanatory variables in your
first model, and three different explanatory variables in your
second. Report and interpret summaries of each model.pObama
as the outcome variable and everything else
except votesys
as an explanatory variable. Find and
report the \(\lambda\) that maximizes
the model performance. Donโt forget to standardize your data!