首页 > > 详细

辅导R留学生、讲解data、辅导R编程语言讲解R语言编程|调试Matlab程序

Jacobs University
Applied Statistics with R – Final Exam 2020-05-22 Exam ID 00003
Name:
Student ID:
4. (a)
Applied Statistics with R – Final Exam: 00003 2
Applied Statistics with R – Final Exam: 00003 3
Applied Statistics with R – Final Exam: 00003 4
1. Load the data provided in flights.Rdata from **piazza** and select all flights that had
been scheduled for departure between 2013-03-15 and 2013-03-19.
(a) How many flights (i.e. cases) are in the resulting data set?
(b) How many variables does the resulting data set comprise?
2. Plot a box plot of the departure delays (variable dep_delay) using the departure airport
(variable origin) as grouping variable.
(a) Do the three NYC airports show a similar distribution in departure delays?
(b) Are the median departure delays for each airport close to zero?
(c) Which flight (from where to where) came the earliest (had the smallest departure delay)?
(d) Which flight (from where to where) has the largest departure delay?
3. Create a categorical variable delay with three categories:
• on time: flights with an arrival delay less than 14 minutes
• delayed: flights with an arrival delay between 14 and 41 minutes
• heavy delay: flights with an arrival delay of more than 41 minutes
Order the variable according to on time, delay, heavy delay.
(a) Compute the number of flights in category delay.
(b) Compute the number of flights in category on time.
(c) Compute the number of flights in category heavy delay.
(d) Which delay category is the most frequent one?
4. Cross-tabulate the variables origin and delay.
(a) What is the most-frequent combination of the two variables origin and delay?
(b) Which share of on time flights departed from LGA?
(c) Which share of flights departing from LGA have been in delay category on time ?
5. Assess the relationship between origin and delay using the χ
2
-statistic. Calculate the
expected frequencies under the assumption that the departure airport has no effect on
arrival delays.
(a) Is the relationship statistically significant?
(b) Report the score of the χ
2
-test statistic (round to two digits)!
(c) Which (sampling) distribution is used for the χ
2
-test to compute the p-value?
(d) For which cells are expected frequencies higher than the observed ones?
6. The IATA claims that New York City airports are delaying air traffic. In order to investigat
this claim, check whether departure delays are on average signfificantly higher than arrival
delays. Use an appropriate statistical test using the 5% significance level.
(a) Which statistical test is most appropriate here?
(b) Is the relationship statistically significant?
(c) Report the score of the test statistic (round to two digits)!
(d) Can you confirm the IATA claim?
Applied Statistics with R – Final Exam: 00003 5
7. The IATA wants to know whether all three airports in New York City operate at the same
performance level regarding departure delays. Use a suitable statistical test to check this!
(a) Is there a difference in performance regarding departure delays between the three
airports?
(b) Which statistical test did you use?
(c) Report the test statistics score!
(d) Report the total sum of squares accounted by origin!
(e) Which airports differ statistically significantly in their performance?
(f) Which airport has the best performance?
8. In the following, you restrict your analysis to flights that have an arrival delay of at least 34
minutes. Create the corresonding data subset.
(a) How many flights are in this subset?
(b) How many flights have been excluded by this procedure?
9. You are interested in the (linear) relationship between departure delay and arrival delay.
(a) Would you expect any relationship? If yes, which one? / Calculate the kendall correlation
coefficient and comment on it.
(b) Draw a scatter plot of number of arrival delay against departure delay and comment
on it. / Discuss whether this correlation coefficient is an appropriate measure in this
situation!
10. Compute a linear model for arrival delay as dependent variable using the following variables
in the data set as predictors: dep_delay, origin, air_time, carrier, dest, month,
day. Call this model flights.lm!
(a) According to the ANOVA table, is the predictor dest statistically significant (at least) at
the 10% significance level?
(b) Looking at the regression coefficients, briefly discuss what the coefficients for originJFK
and originLGA mean?
(c) How good does this model fit? On what do you base your judgment?
(d) Check whether the residuals of this model follow a normal distribution! Do they? Which
tool did you use for checking this?
11. Starting with the null model and taking the model flights.lm as upper bound, run a stepwise
model selection procedure to find the best model according to the AIC criterion. Call
the resulting model flights.lm.best!
(a) Which predictors are included in the optimal model?
(b) Report the adjusted R-squared of the final model?
(c) Report the AIC of the final model?
(d) Using an F-test check whether the final (= best according to automatic variable selection)
model is significantly different from the model using the predictors as computed
in the previous exercise?
(e) Which predictors are included in the model computed in the previous exercise that are
not included in the final model obtained by the automatic procedure?
(f) According to the final model, by how many minutes more is a flight at arrival delayed if
it departs 10 minutes later (all other things being equal).
Applied Statistics with R – Final Exam: 00003 6
(g) According to the final model, which carrier is the best to minimize arrival delays.
(h) Amend the final model by adding an interaction term between origin and air_time.
Is the interaction term significant at the 10% level? According to this model and all
other things equal, by how much will departure delays differ for two flights having a
difference in air time of 100 minutes and one leaving from EWR, the other from JFK
(all other things being equal)?
12. You now want to generate a classification model that tells you whether a flight is delayed at
arrival more than 92 minutes using the predictors in the model flights.lm.best. Use the
probit link here! Call the model flights.classbin!
(a) Which error distribution have you chosen to create this model?
(b) According to the Wald tests (Table of coefficients): which predictors are significant (at
least at the 5% level)?
(c) According to the Likelihood-Ratio Test (LR-test as given in the Deviance Table): which
predictors are significant (at least at the 5% level)?
(d) Report the residual deviance of your model?
(e) Report the Null deviance of your model?
(f) Using a χ

-test check whether your model is significantly better than the null model?
(g) According to your model, how does the air time of a flight influence the likelihood of it
being more than two hours delayed?
(h) Based on your model’s fitted probabilites for being more than two hours delayed create
an indicator for delayed/not delayed flights using the probability 0.5 as threshold.
Create a frequency table of the predicted and the observed delay indicator. Calculate
all misclassification rates.
13. Using the model flights.classbin predict the probability for being more than two hours
delayed at departure using the average scores of numeric predictors in the model for carrier
UA (United Air Lines) and destination ORD (Chicago Ohare International) and origin JFK.
14. Again using the model flights.classbin, you now want to investigate the specific dependency
on the hour of the day. In case hour is not yet included in the model, update the
model by adding this predictor. Generate new data such that you have the hours from 5 to
23 in increments of 1. The other numeric predictors enter again with their mean score into
the prediction in the model for carrier UA (United Air Lines) and destination ORD (Chicago
Ohare International). Compute the predictions and average them.
15. What is the name of the R function for multinomial logistic regression?

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!