---
title: "PSYC 193R: Lecture 14 / 15"
output: html_notebook
---

# Multiple Regression

Load the data set
```{r}
# Link: http://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-red.csv

# load data
WineData = read.csv("NA")
```

Factorize / as.numeric variables
```{r}

```

Check for outliers
```{r}
# histograms

```

Check for outliers (linearity)
```{r}

```

Remove Outliers
```{r}
# remove the outliers 

# check for outliers again
```

Correlation Matrix
```{r}

```

Remove Redundant variables
```{r}

```

Build the intercept model and the full model (with 4 variables)
```{r}
# intercept model

# summary of intercept model

# full model

# summary of full model

```

Model comparison
```{r}
anova(NA, NA)
```

Prediction (optional)
```{r}
# build a data frame

# predict the output

```

Post-fit checking
```{r}
# predicted values (DV) from the IV's in the data

# calculate the residuals

# plot residuals vs fitted values
plot()
```

Check for multicollinearity
```{r}
# install / import the "car" package
library(NA)

# calculate the variance inflation factors

```

## New from here for Lecture 15
Practice: Comparing Model 1 (alcohol) with Full Model
```{r}
# lm() object for model 1

# lm() object for the full model with 4 parameters

```

Feedforward model selection
```{r}
# use the original wineData

# remove outliers 

```

Build two linear models
```{r}
# lm() for intercept model

# full model with all predictors (the "everything" model)

```

Use the step() function for selection
```{r}

```

