Polikorik Korelasyon

Polikorik korelasyon, normal dağılım varsayımın yerine getirildiği, ordinal değişkenler arasındaki ilişkinin hesaplanmasında kullanılan parametrik korelasyon analizi tekniğidir. İncelenen değişkenler sürekli iken ölçme araçlarının sadece sıralı olabilecek veri sağladığı durumlarda Pearson’s korelasyon katsayısına alternatif olarak kullanılabilmektedir.Değişken değerleri -∞ ile +∞ arasında değişir. Örneğin, bir kişinin depresyon seviyesi, anlaşmazlık ya da fikir birliği seviyesi ya da mülkiyete ne kadar değer verdiği, likert tipi ölçek sonuçları. Polikorik korelasyonun yorumlanması pearson korelasyona benzemektedir.Poliklorik korelasyon katsayısı, 0 ile 1 arasındadır. Burada 0 ilişkinin olmadığını ve 1 ise mükemmel bir ilişkiyi göstermektedir.

0,00-0,19 İlişki yok ya da önemsenmeyecek derecede düşük ilişki, 0,20-0,39 Zayıf ilişki, 0,40-0,69 Orta düzeyde ilişki, 0,70-0,89 Kuvvetli ilişki, 0,90-1,00 Çok kuvvetli ilişki olduğunu göstermektedir.Pearson korelasyonda olduğu gibi amaç, iki değişken arasındaki doğrusal ilişkinin yönünü ve gücünü hesaplamaktır.

2020 Yılı Kadın Sağlığı COVID-19 Sağlık Hizmetlerinde Kesinti Anketi (Premise Women’s Health COVID-19 Health Services Disruption Survey 2020) çalışması veri seti kullanılmış olup, çalışma kapsamında belirlenen değişkenler: “age”, “education”, “financial_situation”, “employment_status” , “wmn_pregnancy_change_how”, “wmn_post_con_needed”. Veri setinin kaynağı http://ghdx.healthdata.org/us-data web sitesidir.

Yüklenen Kütüphaneler

library<-c("reactable","crosstalk","dplyr","tibble","tidyr","ggplot2","formattable","ggthemes","readr","readxl","ggpubr","formattable", "ggstance", "stringr","explore", "lubridate","leaflet", "tidytext", "scales", "data.table", "CCA", "pastecs", "gtools", "rmarkdown", "knitr", "gtsummary", "writexl", "ppcor", "reshape2", "GGally", "CCP", "Hmisc", "VIM", "philentropy", "haven","mice", "corrplot","factoextra","dendextend", "correlation", "mvtnorm", "MVN")
loading<-sapply(library, require, character.only = TRUE)
## Loading required package: reactable
## Loading required package: crosstalk
## Loading required package: 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
## Loading required package: tibble
## Loading required package: tidyr
## Loading required package: ggplot2
## Loading required package: formattable
## Loading required package: ggthemes
## Loading required package: readr
## Loading required package: readxl
## Loading required package: ggpubr
## Loading required package: ggstance
## 
## Attaching package: 'ggstance'
## The following objects are masked from 'package:ggplot2':
## 
##     geom_errorbarh, GeomErrorbarh
## Loading required package: stringr
## Loading required package: explore
## Loading required package: lubridate
## 
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
## 
##     date, intersect, setdiff, union
## Loading required package: leaflet
## Loading required package: tidytext
## Loading required package: scales
## 
## Attaching package: 'scales'
## The following object is masked from 'package:readr':
## 
##     col_factor
## The following objects are masked from 'package:formattable':
## 
##     comma, percent, scientific
## Loading required package: data.table
## 
## Attaching package: 'data.table'
## The following objects are masked from 'package:lubridate':
## 
##     hour, isoweek, mday, minute, month, quarter, second, wday, week,
##     yday, year
## The following objects are masked from 'package:dplyr':
## 
##     between, first, last
## Loading required package: CCA
## Loading required package: fda
## Loading required package: splines
## Loading required package: Matrix
## 
## Attaching package: 'Matrix'
## The following objects are masked from 'package:tidyr':
## 
##     expand, pack, unpack
## Loading required package: fds
## Loading required package: rainbow
## Loading required package: MASS
## 
## Attaching package: 'MASS'
## The following object is masked from 'package:formattable':
## 
##     area
## The following object is masked from 'package:dplyr':
## 
##     select
## Loading required package: pcaPP
## Loading required package: RCurl
## 
## Attaching package: 'RCurl'
## The following object is masked from 'package:tidyr':
## 
##     complete
## 
## Attaching package: 'fda'
## The following object is masked from 'package:graphics':
## 
##     matplot
## Loading required package: fields
## Loading required package: spam
## Loading required package: dotCall64
## Loading required package: grid
## Spam version 2.5-1 (2019-12-12) is loaded.
## Type 'help( Spam)' or 'demo( spam)' for a short introduction 
## and overview of this package.
## Help for individual functions is also obtained by adding the
## suffix '.spam' to the function name, e.g. 'help( chol.spam)'.
## 
## Attaching package: 'spam'
## The following object is masked from 'package:Matrix':
## 
##     det
## The following objects are masked from 'package:base':
## 
##     backsolve, forwardsolve
## See https://github.com/NCAR/Fields for
##  an extensive vignette, other supplements and source code
## 
## Attaching package: 'fields'
## The following object is masked from 'package:explore':
## 
##     describe
## Loading required package: pastecs
## 
## Attaching package: 'pastecs'
## The following objects are masked from 'package:data.table':
## 
##     first, last
## The following object is masked from 'package:tidyr':
## 
##     extract
## The following objects are masked from 'package:dplyr':
## 
##     first, last
## Loading required package: gtools
## Loading required package: rmarkdown
## Loading required package: knitr
## Loading required package: gtsummary
## 
## Attaching package: 'gtsummary'
## The following object is masked from 'package:MASS':
## 
##     select
## Loading required package: writexl
## Loading required package: ppcor
## Loading required package: reshape2
## 
## Attaching package: 'reshape2'
## The following objects are masked from 'package:data.table':
## 
##     dcast, melt
## The following object is masked from 'package:tidyr':
## 
##     smiths
## Loading required package: GGally
## Registered S3 method overwritten by 'GGally':
##   method from   
##   +.gg   ggplot2
## 
## Attaching package: 'GGally'
## The following object is masked from 'package:explore':
## 
##     rescale01
## Loading required package: CCP
## Loading required package: Hmisc
## Loading required package: lattice
## 
## Attaching package: 'lattice'
## The following object is masked from 'package:fda':
## 
##     melanoma
## Loading required package: survival
## Loading required package: Formula
## 
## Attaching package: 'Hmisc'
## The following object is masked from 'package:fields':
## 
##     describe
## The following object is masked from 'package:explore':
## 
##     describe
## The following objects are masked from 'package:dplyr':
## 
##     src, summarize
## The following objects are masked from 'package:base':
## 
##     format.pval, units
## Loading required package: VIM
## Loading required package: colorspace
## VIM is ready to use.
## Suggestions and bug-reports can be submitted at: https://github.com/statistikat/VIM/issues
## 
## Attaching package: 'VIM'
## The following object is masked from 'package:datasets':
## 
##     sleep
## Loading required package: philentropy
## Loading required package: haven
## Loading required package: mice
## 
## Attaching package: 'mice'
## The following object is masked from 'package:CCA':
## 
##     cc
## The following objects are masked from 'package:spam':
## 
##     cbind, rbind
## The following object is masked from 'package:RCurl':
## 
##     complete
## The following object is masked from 'package:stats':
## 
##     filter
## The following objects are masked from 'package:base':
## 
##     cbind, rbind
## Loading required package: corrplot
## corrplot 0.84 loaded
## Loading required package: factoextra
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
## Loading required package: dendextend
## 
## ---------------------
## Welcome to dendextend version 1.14.0
## Type citation('dendextend') for how to cite the package.
## 
## Type browseVignettes(package = 'dendextend') for the package vignette.
## The github page is: https://github.com/talgalili/dendextend/
## 
## Suggestions and bug-reports can be submitted at: https://github.com/talgalili/dendextend/issues
## Or contact: <tal.galili@gmail.com>
## 
##  To suppress this message use:  suppressPackageStartupMessages(library(dendextend))
## ---------------------
## 
## Attaching package: 'dendextend'
## The following object is masked from 'package:data.table':
## 
##     set
## The following object is masked from 'package:ggpubr':
## 
##     rotate
## The following object is masked from 'package:stats':
## 
##     cutree
## Loading required package: correlation
## 
## Attaching package: 'correlation'
## The following object is masked from 'package:spam':
## 
##     display
## Loading required package: mvtnorm
## Loading required package: MVN
## sROC 0.1-2 loaded
loading
##   reactable   crosstalk       dplyr      tibble       tidyr     ggplot2 
##        TRUE        TRUE        TRUE        TRUE        TRUE        TRUE 
## formattable    ggthemes       readr      readxl      ggpubr formattable 
##        TRUE        TRUE        TRUE        TRUE        TRUE        TRUE 
##    ggstance     stringr     explore   lubridate     leaflet    tidytext 
##        TRUE        TRUE        TRUE        TRUE        TRUE        TRUE 
##      scales  data.table         CCA     pastecs      gtools   rmarkdown 
##        TRUE        TRUE        TRUE        TRUE        TRUE        TRUE 
##       knitr   gtsummary     writexl       ppcor    reshape2      GGally 
##        TRUE        TRUE        TRUE        TRUE        TRUE        TRUE 
##         CCP       Hmisc         VIM philentropy       haven        mice 
##        TRUE        TRUE        TRUE        TRUE        TRUE        TRUE 
##    corrplot  factoextra  dendextend correlation     mvtnorm         MVN 
##        TRUE        TRUE        TRUE        TRUE        TRUE        TRUE

Kadın Sağlığı COVID-19 Sağlık Hizmetlerinde Kesinti Anketi 2020 (Premise Women’s Health COVID-19 Health Services Disruption Survey 2020)

Verinin Kaynağı: http://ghdx.healthdata.org/us-data

veri<-read_csv("IHME_PREM_WMN_HEALTH_2020_Y2020M11D05.csv")
## 
## -- Column specification --------------------------------------------------------
## cols(
##   .default = col_character(),
##   wmn_pre_injectable_missed = col_double(),
##   wmn_pre_iud_missed = col_double(),
##   wmn_post_injectable_missed = col_double(),
##   wmn_post_iud_missed = col_double()
## )
## i Use `spec()` for the full column specifications.
#write_xlsx(veri, "kadinsaglik.xlsx")

Veri setinin yapısı

**Veri seti 12354 gözlem ve 45 değişkenden oluşmaktadır.

glimpse(veri)
## Rows: 12,354
## Columns: 45
## $ observation_id                 <chr> "wmn_6722233235144704", "wmn_5366769...
## $ submitted_time                 <chr> "2020-07-13 17:40:28.037 UTC", "2020...
## $ gender                         <chr> "Female", "Female", "Female", "Femal...
## $ age                            <chr> "36 to 45 years old", "36 to 45 year...
## $ geography                      <chr> "City center or metropolitan area", ...
## $ financial_situation            <chr> "I can afford food and regular expen...
## $ education                      <chr> "College or university", "Post gradu...
## $ employment_status              <chr> "Employed part-time", "Student and w...
## $ ethnicity                      <chr> "South Asian", "South Asian", "Arab ...
## $ religion                       <chr> "Muslim (Sunni)", "Christianity", "M...
## $ wmn_hh                         <chr> "4", "6", "1", "1", "4", "6", "6", "...
## $ wmn_pregnancy_desire           <chr> "I want to have a/another child late...
## $ wmn_pregnancy_change           <chr> "No", "No", NA, "No", "No", "No", "Y...
## $ wmn_pregnancy_change_how       <chr> NA, NA, NA, NA, NA, NA, "I want to h...
## $ wmn_con                        <chr> "No", "Yes", "Yes", "Yes", "Yes", "Y...
## $ wmn_con_type                   <chr> NA, "Male Condom", "Male Condom", "F...
## $ wmn_pre_con_access_difficulty  <chr> NA, "No", "No", NA, "No", "No", NA, ...
## $ wmn_pre_missed_dose_pills      <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ wmn_pre_con_needed             <chr> NA, "7 or more", "2", NA, "0", "1", ...
## $ wmn_pre_con_accessed           <chr> NA, "7 or more", "0", NA, "0", NA, N...
## $ wmn_pre_injectable_missed      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ wmn_pre_iud_missed             <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ wmn_pre_con_missed_why         <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ wmn_pre_con_missed_why_other   <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ wmn_post_con_access_difficulty <chr> NA, "No", "No", NA, "No", "No", NA, ...
## $ wmn_post_missed_dose_pills     <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ wmn_post_con_needed            <chr> NA, "7 or more", "0", NA, "0", "1", ...
## $ wmn_post_con_accessed          <chr> NA, "7 or more", "0", NA, "0", NA, N...
## $ wmn_post_injectable_missed     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ wmn_post_iud_missed            <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ wmn_post_con_missed_why        <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ wmn_post_con_missed_why_other  <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ wmn_alone                      <chr> "No", "Yes", "Yes", "Yes", "Yes", "Y...
## $ wmn_how_safe                   <chr> "Very safe", NA, NA, NA, NA, NA, "Ve...
## $ wmn_safe_change                <chr> "Less safe", NA, NA, NA, NA, NA, "Mo...
## $ wmn_safe_place                 <chr> "Yes", NA, NA, NA, NA, NA, "Yes", NA...
## $ wmn_pre_safe_place             <chr> "Never", NA, NA, NA, NA, NA, "Don't ...
## $ wmn_post_safe_place            <chr> "Never", NA, NA, NA, NA, NA, "Don't ...
## $ wmn_safe_place_no_access       <chr> "No", NA, NA, NA, NA, NA, "Yes", NA,...
## $ wmn_safe_place_no_access_why   <chr> NA, NA, NA, NA, NA, NA, "Unable to a...
## $ wmn_pre_help                   <chr> "No", NA, NA, NA, NA, NA, "No", NA, ...
## $ wmn_post_help                  <chr> "No", NA, NA, NA, NA, NA, "No", NA, ...
## $ wmn_post_no_help               <chr> "No", NA, NA, NA, NA, NA, "Don't kno...
## $ wmn_no_help_why                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ country                        <chr> "United Arab Emirates", "United Arab...

Analiz için seçilen değişkenler

df<-veri[, c("age","education","financial_situation", "employment_status", "wmn_pregnancy_change_how","wmn_post_con_needed")]
head(df, 10)%>% kable() #ilk 10 gözlem
age education financial_situation employment_status wmn_pregnancy_change_how wmn_post_con_needed
36 to 45 years old College or university I can afford food and regular expenses, and buy new clothes once a year, but nothing else Employed part-time NA NA
36 to 45 years old Post graduate I can comfortably afford food, clothes, and furniture, and I have savings Student and work part-time NA 7 or more
26 to 35 years old College or university I can afford food, but nothing else Self-employed NA 0
16 to 25 years old Technical school I can afford food and regular expenses, but nothing else Employed part-time NA NA
26 to 35 years old Technical school I can afford food and regular expenses, but nothing else Self-employed NA 0
26 to 35 years old Secondary/high school I can afford food and regular expenses, but nothing else Self-employed NA 1
26 to 35 years old Post graduate I can afford food and regular expenses, and buy new clothes once a year, but nothing else Student I want to have a/another child but later than I did before NA
16 to 25 years old Post graduate I can afford food and regular expenses, but nothing else Unemployed NA NA
26 to 35 years old College or university I cannot afford enough food for my family Employed part-time NA NA
16 to 25 years old Secondary/high school I cannot afford enough food for my family Unemployed NA 7 or more

#Veri setinin recode edilmesi

# "Yaş" değişkeninin recode edilmesi

df1<- df %>% as_tibble() %>% mutate(age=recode_factor(age, "Under 16"=1, "16 to 25 years old"=2,"26 to 35 years old"=3, "36 to 45 years old"=4, "Over 45 years old"=5, "Not available"=99))
## Warning: Problem with `mutate()` input `age`.
## i Unreplaced values treated as NA as .x is not compatible. Please specify replacements exhaustively or supply .default
## i Input `age` is `recode_factor(...)`.
## Warning: Unreplaced values treated as NA as .x is not compatible. Please specify
## replacements exhaustively or supply .default
# "Eğitim" değişkeninin recode edilmesi

df1= df1 %>% mutate(education=recode_factor(education, "No formal education"=1, "Primary school"=2,"26 to 35 years old"=3, "Secondary/high school"=4, "Technical school"=5, "College or university"=6, "Post graduate"=7, "Prefer not to answer"=8, "Not available"=99))
## Warning: Problem with `mutate()` input `education`.
## i Unreplaced values treated as NA as .x is not compatible. Please specify replacements exhaustively or supply .default
## i Input `education` is `recode_factor(...)`.

## Warning: Unreplaced values treated as NA as .x is not compatible. Please specify replacements exhaustively or supply .default
# "Finansal durum" değişkeninin recode edilmesi

df1= df1 %>% mutate(financial_situation=recode_factor(financial_situation, "I can afford food and regular expenses, and buy new clothes once a year, but nothing else"=1, "I can afford food and regular expenses, but nothing else"=2,"I can afford food, but nothing else"=3, "I can comfortably afford food, clothes, and furniture, and I have savings"=4, "I cannot afford enough food for my family"=5, "Not available"=99))
## Warning: Problem with `mutate()` input `financial_situation`.
## i Unreplaced values treated as NA as .x is not compatible. Please specify replacements exhaustively or supply .default
## i Input `financial_situation` is `recode_factor(...)`.

## Warning: Unreplaced values treated as NA as .x is not compatible. Please specify replacements exhaustively or supply .default
# "İstihdam durumu" değişkeninin recode edilmesi

df1<- df1 %>% mutate(employment_status=recode_factor(employment_status, "Employed full-time"=1, "Employed part-time"=2,"Self-employed"=3, "Student and work part-time"=4, "Student"=5, "Retired"=6, "Unemployed"=7,"Not available"=99))
## Warning: Problem with `mutate()` input `employment_status`.
## i Unreplaced values treated as NA as .x is not compatible. Please specify replacements exhaustively or supply .default
## i Input `employment_status` is `recode_factor(...)`.

## Warning: Unreplaced values treated as NA as .x is not compatible. Please specify replacements exhaustively or supply .default
# "2020 Mart ayından bu yana çocuk yapma isteğinin değişimi hakkındaki değişkenin" recode edilmesi

df1<- df1 %>% mutate(wmn_pregnancy_change_how=recode_factor(wmn_pregnancy_change_how, "I no longer want a/another child"=1, "I am now undecided"=2,"I now want a/another child"=3, "I want to have a/another child but later than I did before"=4, "I want to have a/another child but sooner than I did before"=5, "Decline to respond"=88))


# "Mart ayından bu yana haftalık ortalama doğum kontrölüne ihtiyaç duyulma sıklığı" değişkeninin recode edilmesi

df1<- df1 %>% mutate(wmn_post_con_needed=recode_factor(wmn_post_con_needed, "0"=0, "1"=1,"2"=2, "3"=3, "4"=4, "5"=5, "6"=6, "7 or more"=7))

# kodlanan verideki ilk 10 gözlem

head(df1, 10)%>% kable() #ilk 10 gözlem
age education financial_situation employment_status wmn_pregnancy_change_how wmn_post_con_needed
4 6 1 2 NA NA
4 7 4 4 NA 7
3 6 3 3 NA 0
2 5 2 2 NA NA
3 5 2 3 NA 0
3 4 2 3 NA 1
3 7 1 5 4 NA
2 7 2 7 NA NA
3 6 5 2 NA NA
2 4 5 7 NA 7

#Eksik veri yapısının incelenmesi 1

explore_all(df1[,1:3])

#Eksik veri yapısının incelenmesi 2

explore_all(df1[,4:6])

Tanımlayıcı istatistikler

summary(df1)
##    age         education    financial_situation employment_status
##  1   : 154   6      :5726   1   :2442           5      :2969     
##  2   :5672   4      :3707   2   :3305           1      :2897     
##  3   :4356   5      :1526   3   :2884           7      :2576     
##  4   :1850   7      : 774   4   :1237           3      :1835     
##  5   : 309   2      : 344   5   :2478           2      :1465     
##  NA's:  13   (Other): 269   NA's:   8           (Other): 604     
##              NA's   :   8                       NA's   :   8     
##  wmn_pregnancy_change_how wmn_post_con_needed
##  1   : 676                7      : 636       
##  2   : 874                1      : 632       
##  3   : 456                0      : 554       
##  4   : 550                2      : 453       
##  5   : 157                3      : 396       
##  88  : 317                (Other): 462       
##  NA's:9324                NA's   :9221

Eksik veriye değer atanması

Rastgele Orman Algortiması (RF) Kullanılarak Eksik Veri Ataması Yapma

eksikveri<-df1

rfdf1 <- mice(eksikveri, meth = "rf", ntree = 3, seed = 61)#ntree yetiştirilecek ağaç sayısını göstermektedir.
## 
##  iter imp variable
##   1   1  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   1   2  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   1   3  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   1   4  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   1   5  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   2   1  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   2   2  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   2   3  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   2   4  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   2   5  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   3   1  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   3   2  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   3   3  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   3   4  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   3   5  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   4   1  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   4   2  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   4   3  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   4   4  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   4   5  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   5   1  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   5   2  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   5   3  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   5   4  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
##   5   5  age  education  financial_situation  employment_status  wmn_pregnancy_change_how  wmn_post_con_needed
tam_veri<-mice::complete(rfdf1,1)# Atama sonrası ilk 10 gözlem

#veri setinin excele yazdırılması

#write_xlsx(tam_veri, "tamveri_xlsx")

# kodlanan tam verideki ilk 10 gözlem

head(tam_veri, 10)%>% kable() #ilk 10 gözlem
age education financial_situation employment_status wmn_pregnancy_change_how wmn_post_con_needed
4 6 1 2 2 7
4 7 4 4 2 7
3 6 3 3 88 0
2 5 2 2 1 1
3 5 2 3 1 0
3 4 2 3 1 1
3 7 1 5 4 3
2 7 2 7 2 0
3 6 5 2 4 7
2 4 5 7 3 7

Eksik verilerin olduğu veri seti üzerinde Polikorik Korelasyonun hesaplanması

# Veri setinden NA değerlerine karşılık gözlemlerin ve cevap vermeyi reddeden gözlemlerin çıkarılması

df11<-na.omit(df1, cols="99")
df11<-na.omit(df1, cols="88")

# Yaş ve eğitim arasındaki polikorik korelasyon
n<-cor_test(df11, "age", "education", method = "polychoric")
## Warning in psych::polychoric(dat): The items do not have an equal number of
## response alternatives, global set to FALSE.
## Warning in matpLower(x, nvar, gminx, gmaxx, gminy, gmaxy): 1 cells were adjusted
## for 0 values using the correction for continuity. Examine your data carefully.
kable(n)
Parameter1 Parameter2 rho CI_low CI_high t df p Method n_Obs
age education 0.2040268 0.1439444 0.2626104 6.593817 1001 0 Polychoric 1003
# Finansal durum ve eğitim arasındaki polikorik korelasyon
n1<-cor_test(df11, "age", "financial_situation", method = "polychoric")
kable(n1)
Parameter1 Parameter2 rho CI_low CI_high t df p Method n_Obs
age financial_situation -0.1325591 -0.1928768 -0.0712435 -4.231325 1001 2.54e-05 Polychoric 1003
# İstihdam durumu ve eğitim arasındaki polikorik korelasyon
n2<-cor_test(df11, "education", "financial_situation", method = "polychoric")
## Warning in psych::polychoric(dat): The items do not have an equal number of
## response alternatives, global set to FALSE.

## Warning in psych::polychoric(dat): 1 cells were adjusted for 0 values using the
## correction for continuity. Examine your data carefully.
kable(n2)
Parameter1 Parameter2 rho CI_low CI_high t df p Method n_Obs
education financial_situation -0.1019905 -0.1628626 -0.040345 -3.243751 1001 0.0012187 Polychoric 1003
# Finansal durum ve çocuk yapma isteği arasındaki polikorik korelasyon
n3<-cor_test(df11, "wmn_pregnancy_change_how", "financial_situation", method = "polychoric")
## Warning in psych::polychoric(dat): The items do not have an equal number of
## response alternatives, global set to FALSE.
kable(n3)
Parameter1 Parameter2 rho CI_low CI_high t df p Method n_Obs
wmn_pregnancy_change_how financial_situation 0.0338512 -0.028108 0.0955512 1.071618 1001 0.2841498 Polychoric 1003
# Çocuk yapma isteği ve haftalık ortalama doğum kontrölüne ihtiyaç duyulma sıklığı arasındaki polikorik korelasyon
n4<-cor_test(df11, "wmn_pregnancy_change_how", "wmn_post_con_needed", method = "polychoric")
## Warning in psych::polychoric(dat): The items do not have an equal number of
## response alternatives, global set to FALSE.

## Warning in psych::polychoric(dat): 1 cells were adjusted for 0 values using the
## correction for continuity. Examine your data carefully.
kable(n4)
Parameter1 Parameter2 rho CI_low CI_high t df p Method n_Obs
wmn_pregnancy_change_how wmn_post_con_needed -0.0042951 -0.0661778 0.0576205 -0.135892 1001 0.891934 Polychoric 1003
# Eğitim ve istihdam durumu arasındaki polikorik korelasyon
n4<-cor_test(df11, "education", "employment_status", method = "polychoric")
kable(n4)
Parameter1 Parameter2 rho CI_low CI_high t df p Method n_Obs
education employment_status -0.1194528 -0.180022 -0.0579813 -3.806574 1001 0.0001495 Polychoric 1003

Eksik Gözlemlerin Olduğu Veri Setine Göre Polikorik Korelasyon Matrisi

library(psych)
## 
## Attaching package: 'psych'
## The following objects are masked from 'package:philentropy':
## 
##     manhattan, minkowski
## The following object is masked from 'package:Hmisc':
## 
##     describe
## The following object is masked from 'package:gtools':
## 
##     logit
## The following object is masked from 'package:fields':
## 
##     describe
## The following objects are masked from 'package:scales':
## 
##     alpha, rescale
## The following object is masked from 'package:explore':
## 
##     describe
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
pole<-df11[,1:4]


polychor<-polychoric(pole)
## Converted non-numeric input to numeric
## Warning in polychoric(pole): The items do not have an equal number of response
## alternatives, global set to FALSE.
## Warning in matpLower(x, nvar, gminx, gmaxx, gminy, gmaxy): 6 cells were adjusted
## for 0 values using the correction for continuity. Examine your data carefully.
polymat<-polychor$rho
colnames(polymat)<-as.vector(names(df11[,1:4]))
rownames(polymat)<-as.vector(names(df11[,1:4]))
polymat
##                            age  education financial_situation employment_status
## age                  1.0000000  0.2040268          -0.1289301        -0.2236585
## education            0.2040268  1.0000000          -0.1019905        -0.1155518
## financial_situation -0.1289301 -0.1019905           1.0000000         0.1806012
## employment_status   -0.2236585 -0.1155518           0.1806012         1.0000000
kable(polymat)
age education financial_situation employment_status
age 1.0000000 0.2040268 -0.1289301 -0.2236585
education 0.2040268 1.0000000 -0.1019905 -0.1155518
financial_situation -0.1289301 -0.1019905 1.0000000 0.1806012
employment_status -0.2236585 -0.1155518 0.1806012 1.0000000
corrplot(polymat,type = "lower", order = "hclust", tl.col = "black", tl.srt = 45, method = "number")

#Tam veri setindeki gözlemlere göre

df12<-na.omit(tam_veri, cols="99")
df12<-na.omit(tam_veri, cols="88")

pole1<-df12[,1:4]

polychor<-polychoric(pole1)
## Converted non-numeric input to numeric
## Warning in polychoric(pole1): The items do not have an equal number of response
## alternatives, global set to FALSE.
## Warning in matpLower(x, nvar, gminx, gmaxx, gminy, gmaxy): 1 cells were adjusted
## for 0 values using the correction for continuity. Examine your data carefully.
polymat<-polychor$rho
colnames(polymat)<-as.vector(names(df11[,1:4]))
rownames(polymat)<-as.vector(names(df11[,1:4]))

kable(polymat)
age education financial_situation employment_status
age 1.0000000 0.1583211 -0.1707702 -0.1830035
education 0.1583211 1.0000000 -0.1244100 -0.1583163
financial_situation -0.1707702 -0.1244100 1.0000000 0.1999861
employment_status -0.1830035 -0.1583163 0.1999861 1.0000000
corrplot(polymat,type = "lower", order = "hclust", tl.col = "black", tl.srt = 45, method = "number")

Tam veri setinde değişkenlerin dağılım yapısının incelenmesi

df13<-df12 %>% mutate_if(is.factor, as.numeric)


v1<-ggplot(df13, aes(x=age)) +
  geom_histogram(fill="brown")
v2<-ggplot(df13, aes(x=education)) +
  geom_histogram(fill="blue")
f<-ggplot(df13, aes(x=financial_situation)) +
  geom_histogram(fill="red")
g<-ggplot(df13, aes(x=employment_status)) +
  geom_histogram(fill="green")
ggarrange(v1,v2,f,g)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Yararlanılan Kaynaklar

Choi, Jaehwa & Peters, Michelle & Mueller, Ralph. (2010). Correlational analysis of ordinal data: From Pearson’s r to Bayesian polychoric correlation. Asia Pacific Education Review. 11. 459-466. 10.1007/s12564-010-9096-y.

Özdemi̇r, H , Toraman, Ç , Kutlu, Ö . (2019). The use of polychoric and Pearson correlation matrices in the determination of construct validity of Likert type scales . Turkish Journal of Education , 8 (3) , 180-195 . DOI: 10.19128/turje.519235