explain the relationship between price and the other

Post New Homework

Statistical Models and Methods Linear Models

Please hand in your work by 5.00pm on Thursday 5 May. Work should be submit- ted via the coursework post boxes in the School. Please remember to complete and attach a coursework submission sheet to your report. Your report should contain all relevant plots and R output needed to justify your answers/arguments, together with appropriate discussion, but please do not include pages of irrel- evant plots/output which are not discussed in the report. The easiest way to include R output in your report is to use R Markdown to produce your report, but you do not have to do so. Your report does not need to contain your R code, though you can include it if you wish. If you are using R Markdown, and do not wish to include your R code, then you can suppress the R code using the echo =
FALSE argument, i.e. enclose the code in an {r, echo=FALSE} environment in the Markdown file.

There will be a Moodle forum specifically for answering queries about the course- work, so you may post questions and I will answer them there so that everyone receives the same assistance. Please be careful to not inadvertently give away parts of your answer if you do post a question.

Unauthorised late submission will be penalised by 5% of the full mark per day. Work submitted more than one week late will receive zero marks. You are reminded to familiarise yourself with the guidelines concerning plagiarism in assessed coursework (see the student handbook), and note that this applies equally to computer code as it does to written work.

The Data

Data are available on the recommended prices of used cars in the United States. All cars are the same age, but have done different mileages and have different specifications. You have recently been employed by a used car dealership to build models to describe the dependence of recommended prices on potential explanatory variables, in order to use these models to price your own used cars. The data, which come in two parts, are available on Moodle. They are

TrainData.txt Training data, which will be used to build models.

TestData.txt Test data, which will be used to assess predictions from the models built.

They can be read into R (after saving the file in your working directory) using

Train = read.table("TrainData.txt",header = T)

Test = read.table("TestData.txt",header = T)

A description of the variables can be found in the file description.txt.

After reading in the data, you can look at the structure of the data (number of observa- tions/variable types etc) using the str() command, e.g. str(Train). For both data sets, you should treat the covariates Cylinder, Doors, Cruise, Sound and Leather as factors (they are treated as integers by default). This can be done using, for example,

Train$Cylinder = factor(Train$Cylinder)

The Task

(a) Using the TRAINING data, investigate models to explain the relationship between Price and the other variables. That is, Price (or transformations of it) is to be the response variable, and all other variables are potential explanatory variables.

(b) Use your fitted model(s) from (a) to predict the responses for the observations in the TEST data set. That is, for each of the observations in the Test data, use the values of the explanatory variables as input to your model(s) from (a) to obtain fitted/predicted responses for these observations. Compare your predicted responses with the known observed responses from the observations in the Test data, using suitable plots/numerical summaries.

Notes

- As with any analysis, the first step should be to do some exploratory analysis using any relevant plots and numerical summaries.

- For the model fitting, you can/should use any of the techniques we have covered this semester to investigate potential models. The task is deliberately open-ended, as would be the case in real situations working with real data. As this is a realistic situation with real data, there is not necessarily one single correct answer. Your job is to investigate potential models, and provide a summary of what they tell us about the problem we are trying to solve. The important point is that you correctly use the relevant techniques in a logical and principled manner, and provide a concise but insightful summary of your findings and reasoning. (Note however that you do not have to produce a report in a formal "report" format.)

- You should pay attention as to whether the model assumptions are being met, for example using suitable diagnostic plots, and consider any transformations of the numerical variables if appropriate. Also consider whether your conclusions depend on a few outlying or influential points.

- You should (briefly and concisely) interpret your model(s) and consider whether they make sense in the context of the problem, for example via interpreting the fitted parameters.

- You do not need to include all your R output, as you will generate lots of output when experimenting with the model fitting. However, you should include the output which is relevant to the arguments that you make when describing the logical developments of your model fitting, and any diagnostic plots which justify changes you make in order to meet the modelling assumptions. Finally, at all stages please remember to explain your reasoning and describe (concisely but accurately) the action you take and why, along with the relevant output.

Price: recommended retail price of the car

Mileage: number of miles the car has been driven

Make: manufacturer of the car

Type: body type such as Hatchback, Coupe etc.

Litre: a measure of engine size

Cylinder: number of cylinders in the engine (4,6,8)

Doors: number of doors (2 or 4)

Cruise: indicator variable representing whether the car has cruise control (1 = cruise)

Sound: indicator variable representing whether the car has upgraded speakers (1 = upgraded)

Leather: indicator variable representing whether the car has leather seats (1 = leather)

NOTE: You should change the variables "Cylinder" , "Doors" , "Cruise" , "Sound" and "Leather" to factors, as described on the question sheet.

Post New Homework
Captcha

Looking tutor’s service for getting help in UK studies or college assignments? Order Now