Documente Academic
Documente Profesional
Documente Cultură
> #load
> library("car")
> library("MASS")
> library("nortest")
> library("vcd")
> # In RStudio's Session menu, set the working directory to the source
> # file location.
>
>
> #Done
>
> #####Challenge 2:########
> # Challenge 2: Read "OR Cases 3.csv" into a data.frame.
>
> rm(list=ls())
> # Since p values, P(> X^2) << 0.01, we reject the Null Hypothesis in favor of
alternate.
> #Data does not follow a Poisson distribution.
>
>
> # (c) Plot the results.
> png(file = "Fit2Poisson_NumberofCases.png")
> plot(poissonfit)
> dev.off()
RStudioGD
2
> poissonfit2=
invisible(goodfit(Weekly_Dat$Number.of.cases[(Weekly_Dat$Number.of.cases
>=quantile(Weekly_Dat$Number.of.cases)[[2]])],
+ type ="poisson",method = "ML"))
> summary(poissonfit2)
> # Doesn't Help:Since p values, P(> X^2) << 0.01, we reject the Null Hypothesis
in favor of alternate.
> #Data does not follow a Poisson distribution.
> # Doesn't Improve the fit either:
> # poissonfit2=
invisible(goodfit(Weekly_Dat$Number.of.cases[(Weekly_Dat$Number.of.cases
>=quantile(Weekly_Dat$Number.of.cases)[[2]])
> # &
(Weekly_Dat$Number.of.cases <=quantile(Weekly_Dat$Number.of.cases)[[4]])],type
="poisson",method = "ML"))
> #
> # summary(poissonfit2)
> plot(poissonfit2)
> summary(binomfit)
> plot(binomfit)
> dev.off()
RStudioGD
2
> qqnorm(Weekly_Dat$Number.of.cases)
> qqline(Weekly_Dat$Number.of.cases)
> dev.off()
RStudioGD
2
data: Weekly_Dat$Number.of.cases
W = 0.92171, p-value = 0.00217