This is the 4rd assignment of the course Advanced Programming in R at Linköping University in 2018.
Course information and all assignments can be found at https://www.ida.liu.se/~732A94/info/courseinfo.en.shtml.
The exercise for the 4rd assignment is to implement a linear regression and create some plots.
The package can be downloaded from GitHub via R with:
```{r installation, eval = FALSE} devtools::install_github("AnnalenaE/advanced-r-4")
## Vignette
After installing, run:
```{r installation, eval = FALSE}
browseVignettes("linear.regression")
A method call that gives back the formula along with the coeficients.
This one method call returns two plots containning the residuals in relation to the fitted values. the first one gives the Residuals vs Fitted, while the seccond one gives the Scale - Location.
A method to call on the residuals
$$\hat{e} = y - \hat{y} = y - X\hat{\beta}$$
A method call to get the predicted values $\hat{y}$.`
A method call to get the coefficients as a named vector.
This returns a printout presenting the coefficients with their standard error, t-value and p-value as well as the estimate of $\hat{\sigma}$ along with the degrees of freedom in the model.
```{r installation, eval = FALSE} linreg_mod = linreg$new(Petal.Length~Sepal.Width+Sepal.Length, data=iris) linreg_mod$print()
linreg_mod$summary()
```
Matrix decompositions for regression analysis
Some Notes on Least Squares, QR-factorization, SVD and Fitting
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.