7 Practical One
NOTE: the answers to the questions below should be placed into their own qmd file in a Quarto project on GitHub. This Quarto project (the rendered document itself, as well as the source code on GitHub) will be peer-assessed next week.
- Find all rows in “airquality” that have missing values. Note that the
airqualitydataset inRis always available (just typeairqualityin the console to see it). - Find mean, sd, min, max for each of temperature and ozone level.
- For linear regression, parameter estimates can be found as follows. \(\hat{\beta} = (X^TX)^{-1}X^TY\) Here, Y is the response variable, and X is the design matrix. The cars data (an R data set, also always available in
R) contains two variables: speed and distance to stop. Fit a simple linear regression model to these data, i.e. find the \(\beta\) estimates, using the equation above, and matrix calcuations in R. - Check that you get the same \(\beta\) estimates as when fitting the linear regression model using lm() in R.