R Question

1. The file Taillite.txt contains data on a study to investigate the usefulness of using centerhigh-mounted stop lamps (CHMSL) on trucks . The data and description of variables arein http://www.stat.wmich.edu/naranjo/EMdatasets/. The primary variable of interest is re-sponse time, the time it took a driver to brake after seeing the test vehicle brake. Using R,do the following(a) Read the data into an R data frame called taillite. For uniformity, use the following(10 pts)variable names:id type group position speed rtime ftime ftimecat;Print the id, vehicle type, group, position, speed zone, and response time for the first 10observations only.(b) Print the the id, vehicle type, group, position, speed zone, and response time for thefirst 10 observations only, but this time print the verbal descriptions instead of coded(10 pts)numbers for the variables vehicle type, group, and position. For example, vehicle typeshould print ”pickup”, ”cargovan”, ”minivan”, and ”truck” instead of ”1”, ”2”, ”3”, or”4”, and group should print ”Experiment” and Control” instead of ”1” or ”2”. Positionshould print as ”Higher” and ”Lower”.(c) Print the sample size, sample mean, standard deviation, minimum, and maximum values(10 pts)of response time and following time.(d) Create a histogram (with a superimposed normal curve) for the response time variable.(10 pts)Describe the distribution (i.e., “shape”) of this variable.(e) Print the sample size, sample mean, standard deviation, minimum, and maximum(10 pts)values of response time and following time for the two categories of the group variable(i.e. ”Experiment” and ”Control”).(f) Create a graph that contains comparison boxplots of response time for the experimental(10 pts)and control groups. Do the boxplots seem to agree with the summary statistics in theprevious question ?(g) Conduct a test of whether the mean response times for experimental and control groups(10 pts)are significantly different, using the pooled version of the t-test. State the conclusion ofthe test in terms of the context of the problem. Use α = .05.(h) Suppose that response time can be categorized into three types.(10 pts)•Fast if rtime 50Create a new factor variable called ”rtime.cat” that has values Fast, Normal, or Slow.Create a table that displays the joint probability distribution (i.e., relative frequencydistribution) for ”group” and ”rtime.cat”.2(i) Test the null hypothesis that response time category (” rtime.cat”) is independent of(10 pts)group using a chi-square test of independence. Be sure to state your overall conclusionin terms of the context of the problem. Assume α = .05.(j) Plot response time (on the y-axis) versus following time (on the x-axis). The graph must(10 pts)have different point characters for experiment and control groups (use ” ” to denoteexperiment and ”o” to denote control). Also, include a corresponding legend in the topleft corner of your graph that clearly articulates which symbols represent which group.Describe the overall relationship between the two variabes. Does the relationship appearto be the same for experiment and control? 