DATA 352/551: Homework 6

  1. In class, we used the nCoV_simple dataset and fit normal, lognormal and gamma models. Fit a Weibull model to the same dataset and answer the following questions.

    1. What are the parameter estimates of the Weibull model?

    2. What is the log likelihood of the Weibull model? Calculate this likelihood using the formula first and then verify your result with the value given by fitdistr.

    3. Write down the log likelihood of the normal, lognormal, and gamma models we used in class. Based on the log likelihood, which model is the best fit?

    4. Using the Weibull model and the estimated parameters, what is the probability that the incubation period is shorter than 14 days? What is the probability that the incubation period is longer than 5 days?

Show solution
library('MASS')
ncov_simple <- read.csv('../all_lectures/nCoV_simple.csv')
result <- fitdistr(ncov_simple$incubation,'weibull')
result$estimate
   shape    scale 
1.819250 4.611153 
result$loglik
[1] -109.5789
log(prod(dweibull(ncov_simple$incubation,
               shape=result$estimate[1],
               scale=result$estimate[2]))) #by hand
[1] -109.5789
pweibull(14,shape=result$estimate[1],scale=result$estimate[2])
[1] 0.9994694
1-pweibull(5,shape=result$estimate[1],scale=result$estimate[2])
[1] 0.3138984

For (c): The loglikelihoods are (rounded): normal (-113); lognormal (-116); gamma (-111); weibull (-110). The Weibull model is a slightly better fit based on the log-likelihood.

  1. Skim through the incubation period paper and answer the following questions. You should be able to find the answers within the paper, so a solution is not provided here. You should have a basic familiarity with the paper (at least to the extent of these questions) for next week’s quiz.

    1. Based on results of this paper, what is the estimated median incubation period? Why do you think the the paper uses the median instead of the mean?

    2. What is the sample size of the dataset used? Discuss at least one reason that the dataset might be biased and not a representative sample.

    3. For the main results of the paper, what distribution is used to model the incubation period? Why is this model chosen? Name another model mentioned as a comparison to the main model.