讲解data设计、辅导R程序设计、讲解R语言、讲解linear model
辅导R语言编程|解析C/C++编程
Problem A
Consider the modelling of house selling price. The data can be downloaded into R using:
read.table(url(“http://pages.uwf.edu/acohen/teaching/glm/house.txt”))
The data contains the following variables: price (in $1000), new (0=old, 1=new), size (sq ft),
beds (number of bedrooms), baths (number of bathrooms), and taxes (annual tax bill in $). We consider price as the response variable. The goal is to fit a linear model to explore the house selling
price variability.
Consider this model with interaction price~new+size+new:size, and the following steps in your modeling process:
Plot data: price vs. size while marking observations where new=1 and new=0.
Discuss linearity, normality and constant-variance.
Consider a transformation, if needed.
Compare the model with and without interactions.
Identify if any influential observations exist. If yes, remove at most 2 observations and redo
the modeling. Comment on the results.
Plot the regression lines and interpret the final model.
Now consider adding the number of beds to the model:
price~new+size+new:size+beds.
1. Before you fit this model, find the correlation (function corin R) between the price and beds.
Comment.
2. Fit the model and interpret the coefficient of beds.
3. Comment on the contradiction you observed.