Including Plots
You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.
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
library(haven)
screen <- read_sav("SCREEN.sav")
summary(screen)
## SUBNO TIMEDRS ATTDRUG ATTHOUSE
## Min. : 1.0 Min. : 0.000 Min. : 5.000 Min. : 2.00
## 1st Qu.:137.0 1st Qu.: 2.000 1st Qu.: 7.000 1st Qu.:21.00
## Median :314.0 Median : 4.000 Median : 8.000 Median :24.00
## Mean :317.4 Mean : 7.901 Mean : 7.686 Mean :23.54
## 3rd Qu.:483.0 3rd Qu.:10.000 3rd Qu.: 9.000 3rd Qu.:27.00
## Max. :758.0 Max. :81.000 Max. :10.000 Max. :35.00
## NA's :1
## INCOME EMPLMNT MSTATUS RACE
## Min. : 1.00 Min. :0.000 Min. :1.000 Min. :1.000
## 1st Qu.: 2.50 1st Qu.:0.000 1st Qu.:2.000 1st Qu.:1.000
## Median : 4.00 Median :0.000 Median :2.000 Median :1.000
## Mean : 4.21 Mean :0.471 Mean :1.778 Mean :1.088
## 3rd Qu.: 6.00 3rd Qu.:1.000 3rd Qu.:2.000 3rd Qu.:1.000
## Max. :10.00 Max. :1.000 Max. :2.000 Max. :2.000
## NA's :26
library(psych)
describe(screen[,-1])
## vars n mean sd median trimmed mad min max range skew kurtosis
## TIMEDRS 1 465 7.90 10.95 4 5.61 4.45 0 81 81 3.23 12.88
## ATTDRUG 2 465 7.69 1.16 8 7.71 1.48 5 10 5 -0.12 -0.47
## ATTHOUSE 3 464 23.54 4.48 24 23.62 4.45 2 35 33 -0.45 1.51
## INCOME 4 439 4.21 2.42 4 4.01 2.97 1 10 9 0.58 -0.38
## EMPLMNT 5 465 0.47 0.50 0 0.46 0.00 0 1 1 0.12 -1.99
## MSTATUS 6 465 1.78 0.42 2 1.85 0.00 1 2 1 -1.34 -0.21
## RACE 7 465 1.09 0.28 1 1.00 0.00 1 2 1 2.90 6.40
## se
## TIMEDRS 0.51
## ATTDRUG 0.05
## ATTHOUSE 0.21
## INCOME 0.12
## EMPLMNT 0.02
## MSTATUS 0.02
## RACE 0.01
library(gtsummary)
screen %>%
select(2:6) %>%
tbl_summary(statistic=all_continuous() ~ c ("{min}, {max}"), missing = "always" )
## ! Column(s) "EMPLMNT" are class "haven_labelled".
## ℹ This is an intermediate data structure not meant for analysis.
## ℹ Convert columns with `haven::as_factor()`, `labelled::to_factor()`,
## `labelled::unlabelled()`, and `unclass()`. Failure to convert may have
## unintended consequences or result in error.
## <https://haven.tidyverse.org/articles/semantics.html>
## <https://larmarange.github.io/labelled/articles/intro_labelled.html#unlabelled>
| Characteristic |
N = 465 |
| Visits to health professionals |
0, 81 |
| Unknown |
0 |
| Attitudes toward medication |
|
| 5 |
13 (2.8%) |
| 6 |
60 (13%) |
| 7 |
126 (27%) |
| 8 |
149 (32%) |
| 9 |
95 (20%) |
| 10 |
22 (4.7%) |
| Unknown |
0 |
| Attitudes toward housework |
2.0, 35.0 |
| Unknown |
1 |
| INCOME |
1.00, 10.00 |
| Unknown |
26 |
| Whether currently employed |
|
| 0 |
246 (53%) |
| 1 |
219 (47%) |
| Unknown |
0 |
library(vtable)
## Loading required package: kableExtra
##
## Attaching package: 'kableExtra'
## The following object is masked from 'package:dplyr':
##
## group_rows
sumtable(screen, summ = c ('notNA(x)', 'min(x)', 'max(x)'))
Summary Statistics
|
Variable
|
NotNA
|
Min
|
Max
|
|
SUBNO
|
465
|
1
|
758
|
|
TIMEDRS
|
465
|
0
|
81
|
|
ATTDRUG
|
465
|
5
|
10
|
|
ATTHOUSE
|
464
|
2
|
35
|
|
INCOME
|
439
|
1
|
10
|
|
MSTATUS
|
465
|
1
|
2
|
|
RACE
|
465
|
1
|
2
|
st(screen, summ = c('notNA(x)', 'min(x)', 'max(x)'),summ.names = c('Frekans', 'minimum', 'maksimum'))
Summary Statistics
|
Variable
|
Frekans
|
minimum
|
maksimum
|
|
SUBNO
|
465
|
1
|
758
|
|
TIMEDRS
|
465
|
0
|
81
|
|
ATTDRUG
|
465
|
5
|
10
|
|
ATTHOUSE
|
464
|
2
|
35
|
|
INCOME
|
439
|
1
|
10
|
|
MSTATUS
|
465
|
1
|
2
|
|
RACE
|
465
|
1
|
2
|
kable(describe(screen[,-1]),format = 'markdown', caption = "betimsel istatistikler", digits = 2)
betimsel istatistikler
| TIMEDRS |
1 |
465 |
7.90 |
10.95 |
4 |
5.61 |
4.45 |
0 |
81 |
81 |
3.23 |
12.88 |
0.51 |
| ATTDRUG |
2 |
465 |
7.69 |
1.16 |
8 |
7.71 |
1.48 |
5 |
10 |
5 |
-0.12 |
-0.47 |
0.05 |
| ATTHOUSE |
3 |
464 |
23.54 |
4.48 |
24 |
23.62 |
4.45 |
2 |
35 |
33 |
-0.45 |
1.51 |
0.21 |
| INCOME |
4 |
439 |
4.21 |
2.42 |
4 |
4.01 |
2.97 |
1 |
10 |
9 |
0.58 |
-0.38 |
0.12 |
| EMPLMNT |
5 |
465 |
0.47 |
0.50 |
0 |
0.46 |
0.00 |
0 |
1 |
1 |
0.12 |
-1.99 |
0.02 |
| MSTATUS |
6 |
465 |
1.78 |
0.42 |
2 |
1.85 |
0.00 |
1 |
2 |
1 |
-1.34 |
-0.21 |
0.02 |
| RACE |
7 |
465 |
1.09 |
0.28 |
1 |
1.00 |
0.00 |
1 |
2 |
1 |
2.90 |
6.40 |
0.01 |
library(skimr)
skim(screen)
Data summary
| Name |
screen |
| Number of rows |
465 |
| Number of columns |
8 |
| _______________________ |
|
| Column type frequency: |
|
| numeric |
8 |
| ________________________ |
|
| Group variables |
None |
Variable type: numeric
| SUBNO |
0 |
1.00 |
317.38 |
194.16 |
1 |
137.0 |
314 |
483 |
758 |
▇▆▆▇▁ |
| TIMEDRS |
0 |
1.00 |
7.90 |
10.95 |
0 |
2.0 |
4 |
10 |
81 |
▇▁▁▁▁ |
| ATTDRUG |
0 |
1.00 |
7.69 |
1.16 |
5 |
7.0 |
8 |
9 |
10 |
▃▇▇▅▁ |
| ATTHOUSE |
1 |
1.00 |
23.54 |
4.48 |
2 |
21.0 |
24 |
27 |
35 |
▁▁▅▇▂ |
| INCOME |
26 |
0.94 |
4.21 |
2.42 |
1 |
2.5 |
4 |
6 |
10 |
▆▇▅▃▂ |
| EMPLMNT |
0 |
1.00 |
0.47 |
0.50 |
0 |
0.0 |
0 |
1 |
1 |
▇▁▁▁▇ |
| MSTATUS |
0 |
1.00 |
1.78 |
0.42 |
1 |
2.0 |
2 |
2 |
2 |
▂▁▁▁▇ |
| RACE |
0 |
1.00 |
1.09 |
0.28 |
1 |
1.0 |
1 |
1 |
2 |
▇▁▁▁▁ |
library(DataExplorer)
create_report(screen)
##
##
## processing file: report.rmd
## | | | 0% | |. | 2% | |.. | 5% [global_options] | |... | 7% | |.... | 10% [introduce] | |.... | 12% | |..... | 14% [plot_intro]
## | |...... | 17% | |....... | 19% [data_structure] | |........ | 21% | |......... | 24% [missing_profile]
## | |.......... | 26% | |........... | 29% [univariate_distribution_header] | |........... | 31% | |............ | 33% [plot_histogram]
## | |............. | 36% | |.............. | 38% [plot_density] | |............... | 40% | |................ | 43% [plot_frequency_bar] | |................. | 45% | |.................. | 48% [plot_response_bar] | |.................. | 50% | |................... | 52% [plot_with_bar] | |.................... | 55% | |..................... | 57% [plot_normal_qq]
## | |...................... | 60% | |....................... | 62% [plot_response_qq] | |........................ | 64% | |......................... | 67% [plot_by_qq] | |.......................... | 69% | |.......................... | 71% [correlation_analysis]
## | |........................... | 74% | |............................ | 76% [principal_component_analysis]
## | |............................. | 79% | |.............................. | 81% [bivariate_distribution_header] | |............................... | 83% | |................................ | 86% [plot_response_boxplot] | |................................. | 88% | |................................. | 90% [plot_by_boxplot] | |.................................. | 93% | |................................... | 95% [plot_response_scatterplot] | |.................................... | 98% | |.....................................| 100% [plot_by_scatterplot]
## output file: /Users/zarifetastan/Desktop/DOKTORA/R dersi /1. hafta/report.knit.md
## /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/aarch64/pandoc +RTS -K512m -RTS '/Users/zarifetastan/Desktop/DOKTORA/R dersi /1. hafta/report.knit.md' --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output pandoc5b81d5950d6.html --lua-filter /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library/rmarkdown/rmarkdown/lua/latex-div.lua --lua-filter /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library/rmarkdown/rmarkdown/lua/table-classes.lua --embed-resources --standalone --variable bs3=TRUE --section-divs --table-of-contents --toc-depth 6 --template /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=yeti --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /var/folders/h4/bh3sky6n2n59m0ds3_g0pzlm0000gn/T//RtmpW1VJQn/rmarkdown-str5b86d7503fe.html
##
## Output created: report.html
library(expss)
## Loading required package: maditr
##
## Use magrittr pipe '%>%' to chain several operations:
## mtcars %>%
## let(mpg_hp = mpg/hp) %>%
## take(mean(mpg_hp), by = am)
##
##
## Attaching package: 'maditr'
## The following objects are masked from 'package:data.table':
##
## copy, dcast, let, melt
## The following object is masked from 'package:skimr':
##
## to_long
## The following objects are masked from 'package:dplyr':
##
## between, coalesce, first, last
##
## Use 'expss_output_viewer()' to display tables in the RStudio Viewer.
## To return to the console output, use 'expss_output_default()'.
##
## Attaching package: 'expss'
## The following objects are masked from 'package:data.table':
##
## copy, fctr, like
## The following object is masked from 'package:DataExplorer':
##
## split_columns
## The following objects are masked from 'package:gtsummary':
##
## contains, vars, where
## The following objects are masked from 'package:haven':
##
## is.labelled, read_spss
## The following objects are masked from 'package:dplyr':
##
## compute, contains, na_if, recode, vars, where
screen <- expss::drop_var_labs(screen)
head(screen)
## # A tibble: 6 × 8
## SUBNO TIMEDRS ATTDRUG ATTHOUSE INCOME EMPLMNT MSTATUS RACE
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 1 8 27 5 1 2 1
## 2 2 3 7 20 6 0 2 1
## 3 3 0 8 23 3 0 2 1
## 4 4 13 9 28 8 1 2 1
## 5 5 15 7 24 1 1 2 1
## 6 6 3 8 25 4 0 2 1
library(naniar)
##
## Attaching package: 'naniar'
## The following object is masked from 'package:expss':
##
## is_na
## The following object is masked from 'package:skimr':
##
## n_complete
library(ggplot2)
##
## Attaching package: 'ggplot2'
## The following object is masked from 'package:expss':
##
## vars
## The following objects are masked from 'package:psych':
##
## %+%, alpha
any_na(screen)
## [1] TRUE
n_miss(screen)
## [1] 27
prop_miss(screen)
## [1] 0.007258065
screen %>% is.na() %>% colSums()
## SUBNO TIMEDRS ATTDRUG ATTHOUSE INCOME EMPLMNT MSTATUS RACE
## 0 0 0 1 26 0 0 0
miss_var_summary(screen)
## # A tibble: 8 × 3
## variable n_miss pct_miss
## <chr> <int> <num>
## 1 INCOME 26 5.59
## 2 ATTHOUSE 1 0.215
## 3 SUBNO 0 0
## 4 TIMEDRS 0 0
## 5 ATTDRUG 0 0
## 6 EMPLMNT 0 0
## 7 MSTATUS 0 0
## 8 RACE 0 0
miss_var_table(screen)
## # A tibble: 3 × 3
## n_miss_in_var n_vars pct_vars
## <int> <int> <dbl>
## 1 0 6 75
## 2 1 1 12.5
## 3 26 1 12.5
miss_case_summary(screen)
## # A tibble: 465 × 3
## case n_miss pct_miss
## <int> <int> <dbl>
## 1 52 1 12.5
## 2 64 1 12.5
## 3 69 1 12.5
## 4 77 1 12.5
## 5 118 1 12.5
## 6 135 1 12.5
## 7 161 1 12.5
## 8 172 1 12.5
## 9 173 1 12.5
## 10 174 1 12.5
## # ℹ 455 more rows
miss_case_table(screen)
## # A tibble: 2 × 3
## n_miss_in_case n_cases pct_cases
## <int> <int> <dbl>
## 1 0 438 94.2
## 2 1 27 5.81
library(rlang)
##
## Attaching package: 'rlang'
## The following object is masked from 'package:expss':
##
## is_na
## The following object is masked from 'package:maditr':
##
## :=
## The following object is masked from 'package:data.table':
##
## :=
library(ggplot2)
library(UpSetR)
library(naniar)
gg_miss_upset(screen)
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## ℹ The deprecated feature was likely used in the UpSetR package.
## Please report the issue to the authors.
## This warning is displayed once per session.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Warning: The `size` argument of `element_line()` is deprecated as of ggplot2 3.4.0.
## ℹ Please use the `linewidth` argument instead.
## ℹ The deprecated feature was likely used in the UpSetR package.
## Please report the issue to the authors.
## This warning is displayed once per session.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

vis_miss(screen)

library(naniar)
mcar_test(data = screen[,c(2,3,4,5,7,8)])
## # A tibble: 1 × 4
## statistic df p.value missing.patterns
## <dbl> <dbl> <dbl> <int>
## 1 18.7 10 0.0440 3
screen2 <- screen
screen2$INCOME_m <- screen2$INCOME
library(finalfit)
explanatory = c("TIMEDRS", "ATTDRUG", "ATTHOUSE")
dependent = "INCOME_m"
screen2 %>%
missing_compare(dependent,explanatory) %>%
knitr :: kable (row.names = FALSE,align = c("l", "l", "r", "r", "r"),
caption = "eksik veriye sahip olan ve olmayan değişkenlerin ortalama karşılaştırması")
eksik veriye sahip olan ve olmayan değişkenlerin ortalama
karşılaştırması
| TIMEDRS |
Mean (SD) |
7.9 (11.1) |
7.6 (7.4) |
0.891 |
| ATTDRUG |
Mean (SD) |
7.7 (1.2) |
7.9 (1.0) |
0.368 |
| ATTHOUSE |
Mean (SD) |
23.5 (4.5) |
23.7 (4.2) |
0.860 |
na.omit (screen)
## # A tibble: 438 × 8
## SUBNO TIMEDRS ATTDRUG ATTHOUSE INCOME EMPLMNT MSTATUS RACE
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 1 8 27 5 1 2 1
## 2 2 3 7 20 6 0 2 1
## 3 3 0 8 23 3 0 2 1
## 4 4 13 9 28 8 1 2 1
## 5 5 15 7 24 1 1 2 1
## 6 6 3 8 25 4 0 2 1
## 7 7 2 7 30 6 1 2 1
## 8 8 0 7 24 6 1 2 1
## 9 9 7 7 20 2 1 2 1
## 10 10 4 8 30 8 0 1 1
## # ℹ 428 more rows
screen3 <- screen
screen3$INCOME[is.na(screen3$INCOME)] <- mean(screen3$INCOME, na.rm =TRUE)
summary(screen3$INCOME)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.00 3.00 4.00 4.21 6.00 10.00
library(mvdalab)
##
## Attaching package: 'mvdalab'
## The following object is masked from 'package:psych':
##
## smc
dat <- introNAs(iris, percent = 25)
dat_EM <- imputeEM(dat[,-5])
dat_EM

## Sepal.Length Sepal.Width Petal.Length Petal.Width
## 1 5.100000 3.500000 1.400000 0.25777905
## 2 4.572197 3.000000 1.400000 0.19515706
## 3 4.700000 3.200000 1.374250 0.20000000
## 4 4.600000 3.100000 1.500000 0.20000000
## 5 5.000000 3.600000 1.305872 0.20000000
## 6 4.917708 3.179052 1.700000 0.40000000
## 7 4.600000 3.400000 1.400000 0.30000000
## 8 4.750263 3.188297 1.500000 0.20000000
## 9 4.730034 3.195595 1.400000 0.20000000
## 10 4.900000 3.100000 1.543571 0.10000000
## 11 5.400000 3.700000 1.500000 0.20000000
## 12 4.800000 3.400000 1.600000 0.20489479
## 13 4.800000 3.241129 1.400000 0.10000000
## 14 4.417264 3.000000 1.100000 0.06972992
## 15 5.800000 4.000000 1.200000 0.35508861
## 16 4.877251 3.193646 1.500000 0.40000000
## 17 5.400000 3.900000 1.300000 0.40000000
## 18 5.100000 3.500000 1.400000 0.30000000
## 19 5.700000 3.800000 1.700000 0.30000000
## 20 5.100000 3.800000 1.500000 0.30000000
## 21 5.400000 3.617220 1.700000 0.20000000
## 22 5.100000 3.322534 1.500000 0.34004279
## 23 4.600000 3.600000 1.000000 0.20000000
## 24 5.100000 3.300000 1.700000 0.38019213
## 25 4.800000 2.977159 1.900000 0.39492781
## 26 5.000000 3.000000 1.600000 0.20000000
## 27 4.897480 3.186349 1.600000 0.40000000
## 28 5.200000 3.500000 1.500000 0.20000000
## 29 5.200000 3.400000 1.400000 0.20000000
## 30 4.700000 3.200000 1.600000 0.22414067
## 31 4.800000 3.100000 1.600000 0.20000000
## 32 5.400000 3.400000 2.359371 0.61064978
## 33 5.200000 2.931333 2.743687 0.74796748
## 34 5.500000 4.200000 1.400000 0.20000000
## 35 4.660776 3.100000 1.430687 0.20000000
## 36 5.000000 3.200000 1.667282 0.20000000
## 37 5.500000 3.500000 1.884612 0.20000000
## 38 4.900000 3.600000 1.400000 0.10000000
## 39 4.729435 3.248629 1.300000 0.16307420
## 40 5.100000 3.419167 1.500000 0.20000000
## 41 5.000000 3.500000 1.300000 0.30000000
## 42 4.500000 2.300000 1.300000 0.30000000
## 43 4.707972 3.200000 1.300000 0.20000000
## 44 5.000000 3.500000 1.600000 0.25745964
## 45 5.457722 3.800000 1.803752 0.40000000
## 46 4.800000 3.000000 1.400000 0.30000000
## 47 5.100000 3.800000 1.600000 0.20786155
## 48 4.600000 3.200000 1.400000 0.20000000
## 49 5.300000 3.700000 1.500000 0.30056126
## 50 5.964754 3.300000 3.601471 1.12942012
## 51 6.213457 3.200000 4.244151 1.40000000
## 52 6.344478 3.200000 4.500000 1.50000000
## 53 6.257528 3.100000 4.493802 1.50000000
## 54 5.500000 2.300000 4.249089 1.30000000
## 55 6.039339 2.800000 4.600000 1.50000000
## 56 5.700000 2.800000 4.500000 1.30000000
## 57 6.541173 3.300000 4.700000 1.60000000
## 58 4.900000 2.579281 3.027961 1.00000000
## 59 5.997746 2.900000 4.600000 1.30000000
## 60 5.606896 2.700000 3.900000 1.22591572
## 61 5.000000 2.000000 3.682601 1.00000000
## 62 5.900000 3.000000 3.974532 1.27090328
## 63 6.000000 2.200000 4.000000 1.00000000
## 64 6.100000 2.900000 4.409424 1.40000000
## 65 5.600000 2.900000 3.600000 1.09971512
## 66 6.700000 3.100000 5.344667 1.85427058
## 67 5.600000 3.000000 4.500000 1.50000000
## 68 5.800000 3.028691 4.100000 1.00000000
## 69 5.837593 3.053269 3.764957 1.18531497
## 70 5.600000 2.868771 3.900000 1.10000000
## 71 5.900000 2.596216 4.800000 1.80000000
## 72 6.100000 2.800000 4.383391 1.30000000
## 73 5.552354 2.500000 4.131708 1.31070625
## 74 6.100000 3.102848 4.188588 1.36667704
## 75 5.920098 2.900000 4.300000 1.30000000
## 76 6.600000 3.000000 4.807459 1.40000000
## 77 6.179739 2.979578 4.800000 1.40000000
## 78 6.432728 3.000000 5.000000 1.70000000
## 79 6.000000 2.900000 4.500000 1.50000000
## 80 5.700000 2.600000 3.500000 1.00000000
## 81 5.252560 2.400000 3.800000 1.10000000
## 82 5.500000 2.988505 3.225321 0.95420400
## 83 5.800000 2.700000 3.900000 1.30504524
## 84 6.148170 2.700000 5.100000 1.60000000
## 85 5.400000 3.000000 4.500000 1.17157186
## 86 6.000000 3.400000 4.500000 1.29891420
## 87 6.700000 3.100000 4.700000 1.50000000
## 88 6.300000 2.300000 4.400000 1.30000000
## 89 5.600000 2.734312 4.100000 1.30000000
## 90 5.500000 2.750318 3.818070 1.30000000
## 91 5.603904 2.600000 4.065429 1.28804549
## 92 6.100000 3.000000 4.319072 1.40000000
## 93 5.800000 2.600000 4.000000 1.20000000
## 94 5.000000 2.563502 3.300000 1.00000000
## 95 5.600000 2.700000 4.200000 1.28383686
## 96 5.700000 3.000000 4.200000 1.20000000
## 97 5.700000 2.900000 4.200000 1.30000000
## 98 6.200000 2.900000 4.300000 1.30000000
## 99 5.100000 2.672457 3.000000 1.10000000
## 100 5.775606 2.800000 4.064632 1.30000000
## 101 6.300000 3.300000 5.523616 2.50000000
## 102 5.800000 2.700000 5.100000 1.90000000
## 103 7.100000 3.206418 5.925027 2.10000000
## 104 6.595545 2.931898 5.600000 1.80000000
## 105 6.500000 3.000000 5.800000 1.89501987
## 106 7.600000 3.000000 6.600000 2.10000000
## 107 4.900000 2.500000 3.947864 1.70000000
## 108 7.300000 2.900000 6.300000 1.80000000
## 109 6.700000 3.014190 5.800000 1.80000000
## 110 7.200000 3.046790 6.100000 2.50000000
## 111 6.810645 3.200000 5.100000 2.00000000
## 112 6.400000 2.700000 5.300000 1.90000000
## 113 6.800000 3.236249 5.312400 1.84789560
## 114 5.700000 2.500000 4.411334 1.42870090
## 115 5.800000 2.800000 5.100000 2.40000000
## 116 6.852330 2.967162 5.300000 2.30000000
## 117 6.500000 3.000000 5.175326 1.80000000
## 118 7.700000 3.800000 6.700000 2.20000000
## 119 7.700000 2.600000 6.900000 2.30000000
## 120 6.000000 2.200000 5.060600 1.50000000
## 121 6.933245 2.937973 5.700000 2.30000000
## 122 5.600000 2.800000 4.900000 2.00000000
## 123 7.700000 2.800000 6.700000 2.00000000
## 124 6.300000 2.700000 4.900000 1.80000000
## 125 7.110870 3.300000 5.700000 2.10000000
## 126 6.676460 2.902708 6.000000 1.80000000
## 127 6.277627 2.800000 4.800000 1.80000000
## 128 6.100000 3.000000 4.900000 1.80000000
## 129 6.400000 2.800000 5.600000 2.10000000
## 130 6.577614 3.000000 5.800000 1.60000000
## 131 7.400000 2.800000 6.351513 1.90000000
## 132 7.900000 3.766371 6.400000 2.00000000
## 133 6.400000 2.641648 5.600000 2.20000000
## 134 6.300000 2.800000 5.100000 1.50000000
## 135 6.100000 2.745360 5.600000 1.40000000
## 136 7.700000 3.000000 6.100000 2.30000000
## 137 7.354266 3.400000 5.600000 2.40000000
## 138 6.400000 3.100000 4.987296 1.80000000
## 139 6.000000 2.805719 4.800000 1.53488157
## 140 6.900000 3.100000 5.400000 2.10000000
## 141 7.105999 3.100000 5.600000 2.40000000
## 142 6.900000 3.324198 5.100000 1.82339112
## 143 5.800000 2.700000 5.100000 1.90000000
## 144 6.800000 3.200000 5.372372 1.87125791
## 145 6.700000 3.300000 5.914326 2.50000000
## 146 6.700000 3.000000 5.200000 1.85451959
## 147 6.276301 2.500000 5.520456 1.90000000
## 148 6.500000 3.000000 5.408098 2.00000000
## 149 6.979864 3.400000 5.400000 1.88680881
## 150 5.900000 3.000000 5.100000 1.80000000
library(mice)
##
## Attaching package: 'mice'
## The following object is masked from 'package:stats':
##
## filter
## The following objects are masked from 'package:base':
##
## cbind, rbind
md.pattern(screen)

## SUBNO TIMEDRS ATTDRUG EMPLMNT MSTATUS RACE ATTHOUSE INCOME
## 438 1 1 1 1 1 1 1 1 0
## 26 1 1 1 1 1 1 1 0 1
## 1 1 1 1 1 1 1 0 1 1
## 0 0 0 0 0 0 1 26 27
imputed_data <- mice(screen, m = 5, maksit = 50, method = 'pmm', seed = 50)
##
## iter imp variable
## 1 1 ATTHOUSE INCOME
## 1 2 ATTHOUSE INCOME
## 1 3 ATTHOUSE INCOME
## 1 4 ATTHOUSE INCOME
## 1 5 ATTHOUSE INCOME
## 2 1 ATTHOUSE INCOME
## 2 2 ATTHOUSE INCOME
## 2 3 ATTHOUSE INCOME
## 2 4 ATTHOUSE INCOME
## 2 5 ATTHOUSE INCOME
## 3 1 ATTHOUSE INCOME
## 3 2 ATTHOUSE INCOME
## 3 3 ATTHOUSE INCOME
## 3 4 ATTHOUSE INCOME
## 3 5 ATTHOUSE INCOME
## 4 1 ATTHOUSE INCOME
## 4 2 ATTHOUSE INCOME
## 4 3 ATTHOUSE INCOME
## 4 4 ATTHOUSE INCOME
## 4 5 ATTHOUSE INCOME
## 5 1 ATTHOUSE INCOME
## 5 2 ATTHOUSE INCOME
## 5 3 ATTHOUSE INCOME
## 5 4 ATTHOUSE INCOME
## 5 5 ATTHOUSE INCOME