Example of robust regression

In class, we talked about how robust regression can be used to detect the main trend in the data without being overly influenced by outliers. For this assignment, I would like you to:

  1. using the robust regression model that I described in class, fit this model to simulated data without outliers.

a - How similar or different are the results from the robust regression model from what the function “lm” would give you?

b - Do the results for \(\tau_i\) match what you expect? What about the results for \(v\)?

  1. using the robust regression model that I described in class, fit this model to simulated data with outliers.

a - How similar or different are the results from the robust regression model from what the function “lm” would give you?

b - Do the results for \(\tau_i\) match what you expect? What about the results for \(v\)?

  1. We could also try to create a different type of robust regression model. This model would explicitly represent two types of data points: outliers and valid observations. It would then create a latent group membership variable for each observation (say \(z_i\)), which would indicate if the corresponding observation falls into the outlier group (\(z_i=1\)) or into the valid group (\(z_i=0\)). The likelihood for the observations that fell into the outlier group would be something like \(y_i \sim N(\beta_0+\beta_1 x_i,\sigma^2 +1000)\) whereas the likelihood for the observations that fell into the valid group would be \(y_i \sim N(\beta_0+\beta_1 x_i,\sigma^2)\).

a - Can you write down the mathematical description of this model?

b - Fit this model using JAGS. Does it work better, worse, or the same as our original robust regression model?