# Import the Data

library(readxl)
Data <- read_excel("D:/COLLEGE 4TH YEAR/2nd SEMESTER/STAT 54 NONPARAMETRIC STATISTICS/MIDTERM/MIDTERM PART 2/Data.xlsx")
New names:
• `` -> `...51`
• `` -> `...89`
• `` -> `...96`
paged_table(Data)

1. What is the socio- demographic profile of the respondents in terms of:

1.1 Age

str(Data$Age)
 num [1:47] 23 22 20 19 22 20 21 23 22 23 ...
library(dplyr)
ian <- Data%>%
  group_by(Age)%>%
  summarise(count=n())%>%
  mutate(Percentage =round((count/sum(count)*100),2))
paged_table(ian)

1.2 Sex

str(Data$Sex)
 chr [1:47] "Female" "Female" "Female" "Female" "Female" "Male" "Male" ...
Data$Sex <- as.factor(Data$Sex)
Data
library(dplyr)
ian1 <- Data%>%
  group_by(Sex)%>%
  summarise(count=n())%>%
  mutate(Percentage =round((count/sum(count)*100),2))
paged_table(ian1)

1.3 Number of years

str(Data$`# of years`)
 chr [1:47] "10 years" "5 years" "20 years" "13 years" "7 Years" "6 years" ...
library(dplyr)
ian2 <- Data%>%
  group_by(`# of years`)%>%
  summarise(count=n())%>%
  mutate(Percentage =round((count/sum(count)*100),2))
paged_table(ian2)

1.4 Socio-economic status

str(Data$`Socio Economic Status`)
 chr [1:47] "Mababa" "Mababa" "Mababa" "Mababa" "Katamtaman" "Mababa" ...
Data$`Socio Economic Status` <- as.factor(Data$`Socio Economic Status`)
Data
library(dplyr)
ian3 <- Data%>%
  group_by(`Socio Economic Status`)%>%
  summarise(count=n())%>%
  mutate(Percentage =round((count/sum(count)*100),2))
paged_table(ian3)

2. What is the psychological well-being of the students raised by single parents in terms of:

a. Autonomy

b. Environmental Mastery

c. Personal growth

d. Positive relations

e. Purpose in life

f. Self-acceptance

library(rstatix)
ian4 <- Data%>%
  gather(key ="Psychological", value = "Score",AutonomyMean, EnvironmentalMasteryMean, PersonalGrowthMean, PositiveRelationsMean, PurposeinLifeMean, SelfAcceptanceMean)%>%
  convert_as_factor(Psychological)
paged_table(ian4)
#Summary statistics
ian4.1 <- ian4%>%
  group_by(Psychological) %>%
   get_summary_stats(Score, type = "mean_sd")
paged_table(ian4.1)

3. How do the students raised by single parents cope up with their struggles and experiences as measured by Filipino Coping Strategies Inventory?

library(rstatix)
ian5 <- Data%>%
  gather(key ="FCS", value = "Score",CognitiveReappraisalMean, SocialSupportMean, ProblemSolvingMean, ReligiosityMean, ToleranceMean, EmotionalReleaseMean, OveractivityMean, RelaxationMean, SubstanceUseMean)%>%
  convert_as_factor(FCS)
paged_table(ian5)
#Summary statistics
ian5.1 <- ian5%>%
  group_by(FCS)%>%
   get_summary_stats(Score, type = "mean_sd")
paged_table(ian5.1)

4. Is there a significant relationship between coping strategies and psychological well-being of students raised by single parents?

a. Cognitive Reappraisal - Autonomy, Environmental Mastery, Personal Growth, Positive Relations, Purpose in Life, Self-Acceptance

cor.test(Data$CognitiveReappraisalMean, Data$AutonomyMean, method = "spearman")
Warning in cor.test.default(Data$CognitiveReappraisalMean, Data$AutonomyMean, :
Cannot compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$CognitiveReappraisalMean and Data$AutonomyMean
S = 8668.3, p-value = 0.0003586
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.4988283 
cor.test(Data$CognitiveReappraisalMean, Data$EnvironmentalMasteryMean, method = "spearman")
Warning in cor.test.default(Data$CognitiveReappraisalMean,
Data$EnvironmentalMasteryMean, : Cannot compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$CognitiveReappraisalMean and Data$EnvironmentalMasteryMean
S = 6241.4, p-value = 1.33e-06
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.6391419 
cor.test(Data$CognitiveReappraisalMean, Data$PersonalGrowthMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$CognitiveReappraisalMean and Data$PersonalGrowthMean
S = 4626, p-value = 3.729e-08
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.7325393 
cor.test(Data$CognitiveReappraisalMean, Data$PositiveRelationsMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$CognitiveReappraisalMean and Data$PositiveRelationsMean
S = 5382, p-value = 2.771e-07
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.6888298 
cor.test(Data$CognitiveReappraisalMean, Data$PurposeinLifeMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$CognitiveReappraisalMean and Data$PurposeinLifeMean
S = 5604, p-value = 4.864e-07
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.6759944 
cor.test(Data$CognitiveReappraisalMean, Data$SelfAcceptanceMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$CognitiveReappraisalMean and Data$SelfAcceptanceMean
S = 2522, p-value < 2.2e-16
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.8541859 

b. Social Support - Autonomy, Environmental Mastery, Personal Growth, Positive Relations, Purpose in Life, Self-Acceptance

cor.test(Data$SocialSupportMean, Data$AutonomyMean, method = "spearman")
Warning in cor.test.default(Data$SocialSupportMean, Data$AutonomyMean, method =
"spearman"): Cannot compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$SocialSupportMean and Data$AutonomyMean
S = 8659.3, p-value = 0.0003527
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.4993492 
cor.test(Data$SocialSupportMean, Data$EnvironmentalMasteryMean, method = "spearman")
Warning in cor.test.default(Data$SocialSupportMean,
Data$EnvironmentalMasteryMean, : Cannot compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$SocialSupportMean and Data$EnvironmentalMasteryMean
S = 16872, p-value = 0.8701
alternative hypothesis: true rho is not equal to 0
sample estimates:
       rho 
0.02451788 
cor.test(Data$SocialSupportMean, Data$PersonalGrowthMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$SocialSupportMean and Data$PersonalGrowthMean
S = 10652, p-value = 0.008049
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.3841351 
cor.test(Data$SocialSupportMean, Data$PositiveRelationsMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$SocialSupportMean and Data$PositiveRelationsMean
S = 13492, p-value = 0.1372
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.2199352 
cor.test(Data$SocialSupportMean, Data$PurposeinLifeMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$SocialSupportMean and Data$PurposeinLifeMean
S = 17624, p-value = 0.8992
alternative hypothesis: true rho is not equal to 0
sample estimates:
        rho 
-0.01896392 
cor.test(Data$SocialSupportMean, Data$SelfAcceptanceMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$SocialSupportMean and Data$SelfAcceptanceMean
S = 12598, p-value = 0.06503
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.2716235 

c. Problem-Solving - Autonomy, Environmental Mastery, Personal Growth, Positive Relations, Purpose in Life, Self-Acceptance

cor.test(Data$ProblemSolvingMean, Data$AutonomyMean, method = "spearman")
Warning in cor.test.default(Data$ProblemSolvingMean, Data$AutonomyMean, : Cannot
compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$ProblemSolvingMean and Data$AutonomyMean
S = 6129.7, p-value = 9.588e-07
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.6456004 
cor.test(Data$ProblemSolvingMean, Data$EnvironmentalMasteryMean, method = "spearman")
Warning in cor.test.default(Data$ProblemSolvingMean,
Data$EnvironmentalMasteryMean, : Cannot compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$ProblemSolvingMean and Data$EnvironmentalMasteryMean
S = 9405.9, p-value = 0.00127
alternative hypothesis: true rho is not equal to 0
sample estimates:
     rho 
0.456183 
cor.test(Data$ProblemSolvingMean, Data$PersonalGrowthMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$ProblemSolvingMean and Data$PersonalGrowthMean
S = 8100, p-value = 0.0001516
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.5316836 
cor.test(Data$ProblemSolvingMean, Data$PositiveRelationsMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$ProblemSolvingMean and Data$PositiveRelationsMean
S = 9872, p-value = 0.002831
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.4292322 
cor.test(Data$ProblemSolvingMean, Data$PurposeinLifeMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$ProblemSolvingMean and Data$PurposeinLifeMean
S = 10246, p-value = 0.00475
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.4076087 
cor.test(Data$ProblemSolvingMean, Data$SelfAcceptanceMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$ProblemSolvingMean and Data$SelfAcceptanceMean
S = 8190, p-value = 0.0001797
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.5264801 

d. Religiosity - Autonomy, Environmental Mastery, Personal Growth, Positive Relations, Purpose in Life, Self-Acceptance

cor.test(Data$ReligiosityMean, Data$AutonomyMean, method = "spearman")
Warning in cor.test.default(Data$ReligiosityMean, Data$AutonomyMean, method =
"spearman"): Cannot compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$ReligiosityMean and Data$AutonomyMean
S = 7800.4, p-value = 6.442e-05
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.5490063 
cor.test(Data$ReligiosityMean, Data$EnvironmentalMasteryMean, method = "spearman")
Warning in cor.test.default(Data$ReligiosityMean,
Data$EnvironmentalMasteryMean, : Cannot compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$ReligiosityMean and Data$EnvironmentalMasteryMean
S = 11498, p-value = 0.02126
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.3352127 
cor.test(Data$ReligiosityMean, Data$PersonalGrowthMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$ReligiosityMean and Data$PersonalGrowthMean
S = 8680, p-value = 0.0004344
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.4981499 
cor.test(Data$ReligiosityMean, Data$PositiveRelationsMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$ReligiosityMean and Data$PositiveRelationsMean
S = 12048, p-value = 0.03857
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.3034228 
cor.test(Data$ReligiosityMean, Data$PurposeinLifeMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$ReligiosityMean and Data$PurposeinLifeMean
S = 14106, p-value = 0.2139
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.1844357 
cor.test(Data$ReligiosityMean, Data$SelfAcceptanceMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$ReligiosityMean and Data$SelfAcceptanceMean
S = 8844, p-value = 0.0005747
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.4886679 

e. Tolerance - Autonomy, Environmental Mastery, Personal Growth, Positive Relations, Purpose in Life, Self-Acceptance

cor.test(Data$ToleranceMean, Data$AutonomyMean, method = "spearman")
Warning in cor.test.default(Data$ToleranceMean, Data$AutonomyMean, method =
"spearman"): Cannot compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$ToleranceMean and Data$AutonomyMean
S = 8796.4, p-value = 0.000452
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.4914202 
cor.test(Data$ToleranceMean, Data$EnvironmentalMasteryMean, method = "spearman")
Warning in cor.test.default(Data$ToleranceMean, Data$EnvironmentalMasteryMean, :
Cannot compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$ToleranceMean and Data$EnvironmentalMasteryMean
S = 15512, p-value = 0.4902
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.1031601 
cor.test(Data$ToleranceMean, Data$PersonalGrowthMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$ToleranceMean and Data$PersonalGrowthMean
S = 11742, p-value = 0.02821
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.3211147 
cor.test(Data$ToleranceMean, Data$PositiveRelationsMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$ToleranceMean and Data$PositiveRelationsMean
S = 14996, p-value = 0.3717
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.1329787 
cor.test(Data$ToleranceMean, Data$PurposeinLifeMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$ToleranceMean and Data$PurposeinLifeMean
S = 15708, p-value = 0.5382
alternative hypothesis: true rho is not equal to 0
sample estimates:
       rho 
0.09181314 
cor.test(Data$ToleranceMean, Data$SelfAcceptanceMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$ToleranceMean and Data$SelfAcceptanceMean
S = 13582, p-value = 0.1469
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.2147317 

f. Emotional Release - Autonomy, Environmental Mastery, Personal Growth, Positive Relations, Purpose in Life, Self-Acceptance

cor.test(Data$EmotionalReleaseMean, Data$AutonomyMean, method = "spearman")
Warning in cor.test.default(Data$EmotionalReleaseMean, Data$AutonomyMean, :
Cannot compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$EmotionalReleaseMean and Data$AutonomyMean
S = 4518.1, p-value = 3.056e-09
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.7387798 
cor.test(Data$EmotionalReleaseMean, Data$EnvironmentalMasteryMean, method = "spearman")
Warning in cor.test.default(Data$EmotionalReleaseMean,
Data$EnvironmentalMasteryMean, : Cannot compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$EmotionalReleaseMean and Data$EnvironmentalMasteryMean
S = 12194, p-value = 0.04414
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.2949663 
cor.test(Data$EmotionalReleaseMean, Data$PersonalGrowthMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$EmotionalReleaseMean and Data$PersonalGrowthMean
S = 10912, p-value = 0.01108
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.3691027 
cor.test(Data$EmotionalReleaseMean, Data$PositiveRelationsMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$EmotionalReleaseMean and Data$PositiveRelationsMean
S = 13630, p-value = 0.1523
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.2119565 
cor.test(Data$EmotionalReleaseMean, Data$PurposeinLifeMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$EmotionalReleaseMean and Data$PurposeinLifeMean
S = 17626, p-value = 0.8986
alternative hypothesis: true rho is not equal to 0
sample estimates:
        rho 
-0.01907956 
cor.test(Data$EmotionalReleaseMean, Data$SelfAcceptanceMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$EmotionalReleaseMean and Data$SelfAcceptanceMean
S = 11896, p-value = 0.03308
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.3122109 

g. Overactivity - Autonomy, Environmental Mastery, Personal Growth, Positive Relations, Purpose in Life, Self-Acceptance

cor.test(Data$OveractivityMean, Data$AutonomyMean, method = "spearman")
Warning in cor.test.default(Data$OveractivityMean, Data$AutonomyMean, method =
"spearman"): Cannot compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$OveractivityMean and Data$AutonomyMean
S = 4161.7, p-value = 6.114e-10
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.7593834 
cor.test(Data$OveractivityMean, Data$EnvironmentalMasteryMean, method = "spearman")
Warning in cor.test.default(Data$OveractivityMean,
Data$EnvironmentalMasteryMean, : Cannot compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$OveractivityMean and Data$EnvironmentalMasteryMean
S = 14284, p-value = 0.2417
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.1741695 
cor.test(Data$OveractivityMean, Data$PersonalGrowthMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$OveractivityMean and Data$PersonalGrowthMean
S = 14566, p-value = 0.2883
alternative hypothesis: true rho is not equal to 0
sample estimates:
    rho 
0.15784 
cor.test(Data$OveractivityMean, Data$PositiveRelationsMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$OveractivityMean and Data$PositiveRelationsMean
S = 16254, p-value = 0.6866
alternative hypothesis: true rho is not equal to 0
sample estimates:
       rho 
0.06024514 
cor.test(Data$OveractivityMean, Data$PurposeinLifeMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$OveractivityMean and Data$PurposeinLifeMean
S = 18424, p-value = 0.6623
alternative hypothesis: true rho is not equal to 0
sample estimates:
        rho 
-0.06521739 
cor.test(Data$OveractivityMean, Data$SelfAcceptanceMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$OveractivityMean and Data$SelfAcceptanceMean
S = 15480, p-value = 0.4812
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.1049954 

h. Relaxation/Recreation - Autonomy, Environmental Mastery, Personal Growth, Positive Relations, Purpose in Life, Self-Acceptance

cor.test(Data$RelaxationMean, Data$AutonomyMean, method = "spearman")
Warning in cor.test.default(Data$RelaxationMean, Data$AutonomyMean, method =
"spearman"): Cannot compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$RelaxationMean and Data$AutonomyMean
S = 5598.2, p-value = 1.81e-07
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.6763322 
cor.test(Data$RelaxationMean, Data$EnvironmentalMasteryMean, method = "spearman")
Warning in cor.test.default(Data$RelaxationMean,
Data$EnvironmentalMasteryMean, : Cannot compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$RelaxationMean and Data$EnvironmentalMasteryMean
S = 10438, p-value = 0.005794
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.3965074 
cor.test(Data$RelaxationMean, Data$PersonalGrowthMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$RelaxationMean and Data$PersonalGrowthMean
S = 7750, p-value = 7.633e-05
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.5519195 
cor.test(Data$RelaxationMean, Data$PositiveRelationsMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$RelaxationMean and Data$PositiveRelationsMean
S = 11106, p-value = 0.01395
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.3578862 
cor.test(Data$RelaxationMean, Data$PurposeinLifeMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$RelaxationMean and Data$PurposeinLifeMean
S = 13154, p-value = 0.1049
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.2394773 
cor.test(Data$RelaxationMean, Data$SelfAcceptanceMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$RelaxationMean and Data$SelfAcceptanceMean
S = 7552, p-value = 5.085e-05
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.5633673 

i. Substance Use - Autonomy, Environmental Mastery, Personal Growth, Positive Relations, Purpose in Life, Self-Acceptance

cor.test(Data$SubstanceUseMean, Data$AutonomyMean, method = "spearman")
Warning in cor.test.default(Data$SubstanceUseMean, Data$AutonomyMean, method =
"spearman"): Cannot compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$SubstanceUseMean and Data$AutonomyMean
S = 2023.5, p-value < 2.2e-16
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.8830053 
cor.test(Data$SubstanceUseMean, Data$EnvironmentalMasteryMean, method = "spearman")
Warning in cor.test.default(Data$SubstanceUseMean,
Data$EnvironmentalMasteryMean, : Cannot compute exact p-value with ties

    Spearman's rank correlation rho

data:  Data$SubstanceUseMean and Data$EnvironmentalMasteryMean
S = 13639, p-value = 0.1537
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.2114089 
cor.test(Data$SubstanceUseMean, Data$PersonalGrowthMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$SubstanceUseMean and Data$PersonalGrowthMean
S = 11358, p-value = 0.0186
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.3433164 
cor.test(Data$SubstanceUseMean, Data$PositiveRelationsMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$SubstanceUseMean and Data$PositiveRelationsMean
S = 12572, p-value = 0.06351
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.2731267 
cor.test(Data$SubstanceUseMean, Data$PurposeinLifeMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$SubstanceUseMean and Data$PurposeinLifeMean
S = 16704, p-value = 0.8189
alternative hypothesis: true rho is not equal to 0
sample estimates:
       rho 
0.03422757 
cor.test(Data$SubstanceUseMean, Data$SelfAcceptanceMean, method = "spearman")

    Spearman's rank correlation rho

data:  Data$SubstanceUseMean and Data$SelfAcceptanceMean
S = 11722, p-value = 0.02762
alternative hypothesis: true rho is not equal to 0
sample estimates:
     rho 
0.322271 

5. Is there a significant difference on the psychological well-being of students raised by single parents when they are grouped according to the variable “# of years?” (Note: # of years is grouped by this: 5 to 10 years, and 11 to 21 years)

ian6 <- Data%>%
  mutate(psychmean = (AutonomyMean+EnvironmentalMasteryMean+PersonalGrowthMean+PositiveRelationsMean+PurposeinLifeMean+SelfAcceptanceMean/6))
ian6.1 <- Data%>%
  mutate(NumberofYearsCode = ifelse(`# of years` <= 21, "5 to 10 years", "11 to 21 years"))%>%
  group_by(NumberofYearsCode)
table(ian6.1$NumberofYearsCode)

11 to 21 years  5 to 10 years 
            22             25 
res_aov <- aov(ian6$psychmean ~ ian6.1$NumberofYearsCode,  var.equal = TRUE)
Warning: In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
 extra argument 'var.equal' will be disregarded
res_aov
Call:
   aov(formula = ian6$psychmean ~ ian6.1$NumberofYearsCode, var.equal = TRUE)

Terms:
                ian6.1$NumberofYearsCode Residuals
Sum of Squares                   4.59964 160.77839
Deg. of Freedom                        1        45

Residual standard error: 1.890199
Estimated effects may be unbalanced

Normality Test

shapiro.test(res_aov$residuals)

    Shapiro-Wilk normality test

data:  res_aov$residuals
W = 0.97686, p-value = 0.4693

Equality of Variances

a <- leveneTest(ian6$psychmean ~ ian6.1$NumberofYearsCode)
Warning in leveneTest.default(y = y, group = group, ...): group coerced to
factor.
paged_table(a)
res.kruskal <- ian6%>% 
  kruskal_test(ian6$psychmean~ian6.1$NumberofYearsCode)
paged_table(res.kruskal)

Interpretation:

There is no significant difference on the psychological well-being of students raised by single parents when they are grouped according to the variable “# of years”, where # of years is grouped by this: 5 to 10 years, and 11 to 21 years since the p-value: 0.233 > 0.05 level of significance.

6. Is there a significant difference on the psychological well-being of students raised by single parents when they are grouped according to the variable “# of years?” (Note: # of years is grouped by this: 5 to 8 years, 9 to 12 years, and 13 to 21 years)

ian7 <- Data%>%
  mutate(NumberofYearsCode = ifelse(`# of years` <= 8, "5 to 8 years",
                                     ifelse(`# of years` >= 9, "9 to 12 years","13 to 21 years")))%>%
  group_by(NumberofYearsCode)
table(ian7$NumberofYearsCode)

13 to 21 years   5 to 8 years  9 to 12 years 
             6             38              3 
res_aov <- aov(ian6$psychmean ~ ian7$NumberofYearsCode,  var.equal = TRUE)
Warning: In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
 extra argument 'var.equal' will be disregarded
res_aov
Call:
   aov(formula = ian6$psychmean ~ ian7$NumberofYearsCode, var.equal = TRUE)

Terms:
                ian7$NumberofYearsCode Residuals
Sum of Squares                 1.08993 164.28810
Deg. of Freedom                      2        44

Residual standard error: 1.93231
Estimated effects may be unbalanced

Normality Test

shapiro.test(res_aov$residuals)

    Shapiro-Wilk normality test

data:  res_aov$residuals
W = 0.9752, p-value = 0.4114

Equality of Variances

b <- leveneTest(ian6$psychmean ~ ian7$NumberofYearsCode)
Warning in leveneTest.default(y = y, group = group, ...): group coerced to
factor.
paged_table(b)
res.kruskal <- ian6%>% 
  kruskal_test(ian6$psychmean~ian7$NumberofYearsCode)
paged_table(res.kruskal)

Interpretation:

There is no significant difference on the psychological well-being of students raised by single parents when they are grouped according to the variable “# of years”, where # of years is grouped by this: 55 to 8 years, 9 to 12 years, and 13 to 21 years since the p-value: 0.747 > 0.05 level of significance.