#Data
library(readxl)
Numeric <- read_excel("D:/NURSING/2021/Dan/DataDan.xlsx")
## New names:
## * `` -> ...25
## * `` -> ...26
## * `` -> ...27
## * `` -> ...28
Numeric
## # A tibble: 100 x 28
## Timestamp `I have read, understood ~` `Name (Optiona~` Age Gender
## <dttm> <chr> <lgl> <dbl> <chr>
## 1 2021-05-12 17:41:46 Agree NA 18 Female
## 2 2021-05-18 07:57:59 Agree NA 17 Female
## 3 2021-05-18 08:19:13 Agree NA 18 Female
## 4 2021-05-18 08:22:07 Agree NA 16 Female
## 5 2021-05-18 08:37:43 Agree NA 17 Female
## 6 2021-05-18 08:48:36 Agree NA 18 Female
## 7 2021-05-18 08:54:00 Agree NA 19 Female
## 8 2021-05-18 08:56:50 Agree NA 17 Female
## 9 2021-05-18 08:57:40 Agree NA 17 Female
## 10 2021-05-18 08:58:19 Agree NA 18 Female
## # ... with 90 more rows, and 23 more variables: `Social support` <chr>,
## # `Living condition1` <chr>, `Family income per month` <chr>,
## # `1. Feeling nervous, anxious, or on edge` <dbl>,
## # `2. Not being able to stop or control worrying` <dbl>,
## # `3. Worrying too much about different things` <dbl>,
## # `4. Trouble relaxing` <dbl>,
## # `5. Being so restless that it is hard to sit still` <dbl>, ...
#Demographic Profice
Socio-demographic profile of the respondents in terms of: 1.1 Age 1.2 Gender 1.3 Social Support 1.4 Living Condition 1.5 Family Income
summary(Numeric$Age)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 16.00 17.00 18.00 17.83 18.00 24.00 1
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
AgeComplete<-Numeric %>%
filter(!is.na(Age))
#Age of the Respondents
summary(AgeComplete$Age)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 16.00 17.00 18.00 17.83 18.00 24.00
dim(Numeric)
## [1] 100 28
#Gender of the Respondents
Gender= Numeric$Gender
Gender.freq = table(Gender)
Gender.relfreq = Gender.freq
Gender.freq
## Gender
## Female Male
## 56 44
Gender.relfreq = Gender.freq / nrow(Numeric)
cbind(Gender.relfreq)
## Gender.relfreq
## Female 0.56
## Male 0.44
prop.table(table(Numeric$Gender))
##
## Female Male
## 0.56 0.44
table(Numeric$Gender)
##
## Female Male
## 56 44
#Social Support
SocialSupport= Numeric$`Social support`
SocialSupport.freq = table(SocialSupport)
SocialSupport.relfreq = SocialSupport.freq
SocialSupport.freq
## SocialSupport
## Family Friends People
## 96 3 1
SocialSupport.relfreq = SocialSupport.freq / nrow(Numeric)
cbind(SocialSupport.relfreq)
## SocialSupport.relfreq
## Family 0.96
## Friends 0.03
## People 0.01
prop.table(table(Numeric$`Social support`))
##
## Family Friends People
## 0.96 0.03 0.01
#Living Condition
LivingCondition= Numeric$`Living condition1`
LivingCondition.freq = table(LivingCondition)
LivingCondition.relfreq = LivingCondition.freq
LivingCondition.freq
## LivingCondition
## Live in boarding house/dormitory Live with Family
## 1 91
## Live with Relatives Live with siblings
## 5 1
## People siblings
## 1 1
LivingCondition.relfreq = LivingCondition.freq / nrow(Numeric)
cbind(LivingCondition.relfreq)
## LivingCondition.relfreq
## Live in boarding house/dormitory 0.01
## Live with Family 0.91
## Live with Relatives 0.05
## Live with siblings 0.01
## People 0.01
## siblings 0.01
prop.table(table(Numeric$`Living condition1`))
##
## Live in boarding house/dormitory Live with Family
## 0.01 0.91
## Live with Relatives Live with siblings
## 0.05 0.01
## People siblings
## 0.01 0.01
library(dplyr)
LC<- Numeric %>%
mutate(Livingconditionrecode = ifelse(Livingconditionrecode == "Live with Family","With Parents","Away from Parents"))%>%
mutate(SocialSupport = ifelse(`Social support`== "Family", "Family", "Others"))%>%
mutate(Income = ifelse(`Family income per month` == "Below 5,000 Php","Below Php 5,000.00","More than Php 5,000.00"))
Numeric
## # A tibble: 100 x 28
## Timestamp `I have read, understood ~` `Name (Optiona~` Age Gender
## <dttm> <chr> <lgl> <dbl> <chr>
## 1 2021-05-12 17:41:46 Agree NA 18 Female
## 2 2021-05-18 07:57:59 Agree NA 17 Female
## 3 2021-05-18 08:19:13 Agree NA 18 Female
## 4 2021-05-18 08:22:07 Agree NA 16 Female
## 5 2021-05-18 08:37:43 Agree NA 17 Female
## 6 2021-05-18 08:48:36 Agree NA 18 Female
## 7 2021-05-18 08:54:00 Agree NA 19 Female
## 8 2021-05-18 08:56:50 Agree NA 17 Female
## 9 2021-05-18 08:57:40 Agree NA 17 Female
## 10 2021-05-18 08:58:19 Agree NA 18 Female
## # ... with 90 more rows, and 23 more variables: `Social support` <chr>,
## # `Living condition1` <chr>, `Family income per month` <chr>,
## # `1. Feeling nervous, anxious, or on edge` <dbl>,
## # `2. Not being able to stop or control worrying` <dbl>,
## # `3. Worrying too much about different things` <dbl>,
## # `4. Trouble relaxing` <dbl>,
## # `5. Being so restless that it is hard to sit still` <dbl>, ...
LC
## # A tibble: 100 x 30
## Timestamp `I have read, understood ~` `Name (Optiona~` Age Gender
## <dttm> <chr> <lgl> <dbl> <chr>
## 1 2021-05-12 17:41:46 Agree NA 18 Female
## 2 2021-05-18 07:57:59 Agree NA 17 Female
## 3 2021-05-18 08:19:13 Agree NA 18 Female
## 4 2021-05-18 08:22:07 Agree NA 16 Female
## 5 2021-05-18 08:37:43 Agree NA 17 Female
## 6 2021-05-18 08:48:36 Agree NA 18 Female
## 7 2021-05-18 08:54:00 Agree NA 19 Female
## 8 2021-05-18 08:56:50 Agree NA 17 Female
## 9 2021-05-18 08:57:40 Agree NA 17 Female
## 10 2021-05-18 08:58:19 Agree NA 18 Female
## # ... with 90 more rows, and 25 more variables: `Social support` <chr>,
## # `Living condition1` <chr>, `Family income per month` <chr>,
## # `1. Feeling nervous, anxious, or on edge` <dbl>,
## # `2. Not being able to stop or control worrying` <dbl>,
## # `3. Worrying too much about different things` <dbl>,
## # `4. Trouble relaxing` <dbl>,
## # `5. Being so restless that it is hard to sit still` <dbl>, ...
LC$Livingconditionrecode<-as.factor(LC$Livingconditionrecode)
table(LC$Livingconditionrecode)
##
## Away from Parents With Parents
## 9 91
library(dplyr)
LC%>%
group_by(Livingconditionrecode)%>%
summarize(count = n())
## # A tibble: 2 x 2
## Livingconditionrecode count
## <fct> <int>
## 1 Away from Parents 9
## 2 With Parents 91
table(LC$SocialSupport)
##
## Family Others
## 96 4
LivingCondition= LC$Livingconditionrecode
LivingCondition.freq = table(LivingCondition)
LivingCondition.relfreq = LivingCondition.freq
LivingCondition.freq
## LivingCondition
## Away from Parents With Parents
## 9 91
LivingCondition.relfreq = LivingCondition.freq / nrow(Numeric)
cbind(LivingCondition.relfreq)
## LivingCondition.relfreq
## Away from Parents 0.09
## With Parents 0.91
prop.table(table(LC$Livingconditionrecode))
##
## Away from Parents With Parents
## 0.09 0.91
#Family Income Per Month
FamilyIncome= LC$Income
FamilyIncome.freq = table(FamilyIncome)
FamilyIncome.relfreq = FamilyIncome.freq
FamilyIncome.freq
## FamilyIncome
## Below Php 5,000.00 More than Php 5,000.00
## 47 53
FamilyIncome.relfreq = FamilyIncome.freq / nrow(LC)
cbind(FamilyIncome.relfreq)
## FamilyIncome.relfreq
## Below Php 5,000.00 0.47
## More than Php 5,000.00 0.53
prop.table(table(LC$Income))
##
## Below Php 5,000.00 More than Php 5,000.00
## 0.47 0.53
aggregate(combine[, 2:3], list(combine$student), quantile, c(0.6,0.8))
aggregate(LC[, 9:10], list(LC$SHS), quantile, c(0.2,0.4))
## Group.1 1. Feeling nervous, anxious, or on edge.20%
## 1 jhs 0.0
## 2 SHS 0.0
## 1. Feeling nervous, anxious, or on edge.40%
## 1 0.8
## 2 1.0
## 2. Not being able to stop or control worrying.20%
## 1 0.0
## 2 0.2
## 2. Not being able to stop or control worrying.40%
## 1 1.0
## 2 1.0
Summary of Anxiety Level
AnxietyLevel= Numeric$`Anxiety Level Equivalent`
AnxietyLevel.freq = table(AnxietyLevel)
AnxietyLevel.relfreq = AnxietyLevel.freq
AnxietyLevel.freq
## AnxietyLevel
## Mild anxiety Minimal anxiety Moderate anxiety Severe anxiety
## 42 27 17 14
AnxietyLevel.relfreq = AnxietyLevel.freq / nrow(Numeric)
cbind(AnxietyLevel.relfreq)
## AnxietyLevel.relfreq
## Mild anxiety 0.42
## Minimal anxiety 0.27
## Moderate anxiety 0.17
## Severe anxiety 0.14
prop.table(table(AnxietyLevel))
## AnxietyLevel
## Mild anxiety Minimal anxiety Moderate anxiety Severe anxiety
## 0.42 0.27 0.17 0.14
##2. Is there a significant relationship between senior high school students’ level of anxiety and its demographic profile?
library(dplyr)
RecodeData<- LC %>%
mutate(GenderCode = ifelse(Gender == "Female",0,1))%>%
mutate(SocialSupportCode= ifelse(SocialSupport == "Others", 0,1))%>%
mutate(IncomeRecode = ifelse(Income == "Below Php 5,000.00",0,1))%>%
mutate(Livingcontionfinal = ifelse(Livingconditionrecode == "Away from Parents", 0,1))
RecodeData
## # A tibble: 100 x 34
## Timestamp `I have read, understood ~` `Name (Optiona~` Age Gender
## <dttm> <chr> <lgl> <dbl> <chr>
## 1 2021-05-12 17:41:46 Agree NA 18 Female
## 2 2021-05-18 07:57:59 Agree NA 17 Female
## 3 2021-05-18 08:19:13 Agree NA 18 Female
## 4 2021-05-18 08:22:07 Agree NA 16 Female
## 5 2021-05-18 08:37:43 Agree NA 17 Female
## 6 2021-05-18 08:48:36 Agree NA 18 Female
## 7 2021-05-18 08:54:00 Agree NA 19 Female
## 8 2021-05-18 08:56:50 Agree NA 17 Female
## 9 2021-05-18 08:57:40 Agree NA 17 Female
## 10 2021-05-18 08:58:19 Agree NA 18 Female
## # ... with 90 more rows, and 29 more variables: `Social support` <chr>,
## # `Living condition1` <chr>, `Family income per month` <chr>,
## # `1. Feeling nervous, anxious, or on edge` <dbl>,
## # `2. Not being able to stop or control worrying` <dbl>,
## # `3. Worrying too much about different things` <dbl>,
## # `4. Trouble relaxing` <dbl>,
## # `5. Being so restless that it is hard to sit still` <dbl>, ...
cor.test(RecodeData$Age, RecodeData$`Anxiety Level`, method="spearman")
## Warning in cor.test.default(RecodeData$Age, RecodeData$`Anxiety Level`, : Cannot
## compute exact p-value with ties
##
## Spearman's rank correlation rho
##
## data: RecodeData$Age and RecodeData$`Anxiety Level`
## S = 171698, p-value = 0.5432
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## -0.06183221
mylogit<-glm(RecodeData$GenderCode~RecodeData$`Anxiety Level`,family="binomial")
summary(mylogit)
##
## Call:
## glm(formula = RecodeData$GenderCode ~ RecodeData$`Anxiety Level`,
## family = "binomial")
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.4306 -1.0593 -0.7607 1.1723 1.8313
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.57798 0.39132 1.477 0.1397
## RecodeData$`Anxiety Level` -0.10778 0.04498 -2.396 0.0166 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 137.19 on 99 degrees of freedom
## Residual deviance: 130.90 on 98 degrees of freedom
## AIC: 134.9
##
## Number of Fisher Scoring iterations: 4
mylogit<-glm(RecodeData$Livingcontionfinal~RecodeData$`Anxiety Level`, family="binomial")
summary(mylogit)
##
## Call:
## glm(formula = RecodeData$Livingcontionfinal ~ RecodeData$`Anxiety Level`,
## family = "binomial")
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.2172 0.4203 0.4288 0.4403 0.4672
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.42400 0.66510 3.645 0.000268 ***
## RecodeData$`Anxiety Level` -0.01390 0.07004 -0.198 0.842669
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 60.508 on 99 degrees of freedom
## Residual deviance: 60.468 on 98 degrees of freedom
## AIC: 64.468
##
## Number of Fisher Scoring iterations: 5
mylogit<-glm(RecodeData$IncomeRecode~RecodeData$`Anxiety Level`, family="binomial")
summary(mylogit)
##
## Call:
## glm(formula = RecodeData$IncomeRecode ~ RecodeData$`Anxiety Level`,
## family = "binomial")
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.4154 -1.1881 0.9934 1.1232 1.2516
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.17287 0.37658 -0.459 0.646
## RecodeData$`Anxiety Level` 0.03773 0.04120 0.916 0.360
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 138.27 on 99 degrees of freedom
## Residual deviance: 137.42 on 98 degrees of freedom
## AIC: 141.42
##
## Number of Fisher Scoring iterations: 4
Social Supportand Anxiety