Summary of Descriptive Statistics
summary(SARsData2)
## X ID SARsCOVID Delta
## Min. : 1 Min. : 1 Length:577 Length:577
## 1st Qu.:145 1st Qu.:145 Class :character Class :character
## Median :289 Median :289 Mode :character Mode :character
## Mean :289 Mean :289
## 3rd Qu.:433 3rd Qu.:433
## Max. :577 Max. :577
## Omicron Age Sex
## Length:577 Min. : 1.0 Length:577
## Class :character 1st Qu.:27.0 Class :character
## Mode :character Median :37.0 Mode :character
## Mean :37.7
## 3rd Qu.:46.0
## Max. :89.0
Inferential Statistic
table(SARsData2$SARsCOVID, SARsData2$Delta)
##
## negative positive
## negative 291 7
## positive 113 166
str(SARsData2)
## 'data.frame': 577 obs. of 7 variables:
## $ X : int 1 2 3 4 5 6 7 8 9 10 ...
## $ ID : int 1 2 3 4 5 6 7 8 9 10 ...
## $ SARsCOVID: chr "positive" "positive" "positive" "positive" ...
## $ Delta : chr "positive" "positive" "negative" "positive" ...
## $ Omicron : chr "positive" "positive" "positive" "positive" ...
## $ Age : int 50 44 36 70 52 39 67 60 45 25 ...
## $ Sex : chr "female" "female" "male" "female" ...
names(SARsData2)
## [1] "X" "ID" "SARsCOVID" "Delta" "Omicron" "Age"
## [7] "Sex"
mytable<-table(SARsData2$SARsCOVID, SARsData2$Delta)
mytable
##
## negative positive
## negative 291 7
## positive 113 166
addmargins(mytable, margin=c(1,2))
##
## negative positive Sum
## negative 291 7 298
## positive 113 166 279
## Sum 404 173 577
prop.table(mytable)
##
## negative positive
## negative 0.50433276 0.01213172
## positive 0.19584055 0.28769497
chisq.test(SARsData2$SARsCOVID, SARsData2$Delta)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: SARsData2$SARsCOVID and SARsData2$Delta
## X-squared = 221.46, df = 1, p-value < 2.2e-16
chisq.test(SARsData2$SARsCOVID, SARsData2$Sex)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: SARsData2$SARsCOVID and SARsData2$Sex
## X-squared = 5.0656, df = 1, p-value = 0.02441
chisq.test(SARsData2$SARsCOVID, SARsData2$Omicron)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: SARsData2$SARsCOVID and SARsData2$Omicron
## X-squared = 109.97, df = 1, p-value < 2.2e-16
#ANOVA
anova <- aov(Age ~ SARsCOVID, data = SARsData2)
anova
## Call:
## aov(formula = Age ~ SARsCOVID, data = SARsData2)
##
## Terms:
## SARsCOVID Residuals
## Sum of Squares 14.46 120328.67
## Deg. of Freedom 1 575
##
## Residual standard error: 14.46607
## Estimated effects may be unbalanced
summary(anova)
## Df Sum Sq Mean Sq F value Pr(>F)
## SARsCOVID 1 14 14.46 0.069 0.793
## Residuals 575 120329 209.27
anova1 <- aov(Age ~ Delta, data = SARsData2)
summary(anova1)
## Df Sum Sq Mean Sq F value Pr(>F)
## Delta 1 66 65.58 0.314 0.576
## Residuals 575 120278 209.18
anova2 <- aov(Age ~ Sex, data = SARsData2)
summary(anova2)
## Df Sum Sq Mean Sq F value Pr(>F)
## Sex 1 15 14.9 0.071 0.79
## Residuals 575 120328 209.3
Prediction Model Estimation
SARsData2$SARsCOVID<-as.factor(SARsData2$SARsCOVID)
SARsData2$Sex<-as.factor(SARsData2$Sex)
SARsData2$Delta<-as.factor(SARsData2$Delta)
SARsData2$Omicron<-as.factor(SARsData2$Omicron)
model<-glm(SARsCOVID~Delta+Omicron+Sex+Age, family = binomial, data=SARsData2)
summary(model)
##
## Call:
## glm(formula = SARsCOVID ~ Delta + Omicron + Sex + Age, family = binomial,
## data = SARsData2)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.2694 -0.7413 -0.7349 0.3672 1.7012
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -9.898e-01 3.405e-01 -2.907 0.00365 **
## Deltapositive 3.646e+00 4.096e-01 8.900 < 2e-16 ***
## Omicronpositive 1.768e+01 5.923e+02 0.030 0.97619
## Sexmale -1.930e-01 2.321e-01 -0.832 0.40563
## Age 6.878e-04 7.384e-03 0.093 0.92578
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 799.27 on 576 degrees of freedom
## Residual deviance: 489.02 on 572 degrees of freedom
## AIC: 499.02
##
## Number of Fisher Scoring iterations: 17
Visualizations
plot(SARsData2$SARsCOVID~SARsData2$Sex)
str(SARsData2)
## 'data.frame': 577 obs. of 7 variables:
## $ X : int 1 2 3 4 5 6 7 8 9 10 ...
## $ ID : int 1 2 3 4 5 6 7 8 9 10 ...
## $ SARsCOVID: Factor w/ 2 levels "negative","positive": 2 2 2 2 2 2 2 2 2 2 ...
## $ Delta : Factor w/ 2 levels "negative","positive": 2 2 1 2 1 1 1 1 1 2 ...
## $ Omicron : Factor w/ 2 levels "negative","positive": 2 2 2 2 1 2 2 2 2 2 ...
## $ Age : int 50 44 36 70 52 39 67 60 45 25 ...
## $ Sex : Factor w/ 2 levels "female","male": 1 1 2 1 2 2 1 1 2 2 ...
plot(SARsData2$Sex)
hist(SARsData2$Age)
boxplot(SARsData2$Age~SARsData2$Sex)
stem(SARsData2$Age)
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 1234
## 0 | 6788899
## 1 | 0000111112344
## 1 | 5667778888889999
## 2 | 000000000111111111222222233333333333333333334444444444444
## 2 | 55555555555555566666666666666677777777777777777778888888888888888888+1
## 3 | 00000000000001111111111111122222222222222222233333333333334444444444
## 3 | 55555555555555555666666666666666667777777777777777777777788888888888+4
## 4 | 00000000000000011111111111122222222222222222233333333333333444444444
## 4 | 55555555555555566666666666677777777777788888888889999999999
## 5 | 000000000001111222222222223333333444444
## 5 | 55566666666777788899
## 6 | 000000011111111334
## 6 | 556677778899
## 7 | 000001124
## 7 | 78
## 8 | 001
## 8 | 779
boxplot(SARsData2$Age~SARsData2$SARsCOVID)
boxplot(SARsData2$Age~SARsData2$Omicron)
boxplot(SARsData2$Age~SARsData2$Delta)
END