Lists missing data patterns in the specified dataset
descMissData.RdSummarises the missing data patterns in the specified dataset. Each row in the output corresponds to a missing data pattern (1=observed, 0=missing). The number and percentage of observations is also displayed for each missing data pattern. The first column indicates the number of missing data patterns. The second column refers to the analysis model outcome ('y'), with all other variables ('covs') displayed in subsequent columns. Alternatively, 'y' can indicate the primary variable of interest, e.g. 'y' could refer to an exposure or intervention, with all other variables listed in 'covs'.
Arguments
- y
The analysis model outcome variable(s), specified as a string (space delimited) or a list
- data
A data frame containing the specified analysis model outcome, covariate(s), and if specified, stratification variable(s)
- covs
Optional analysis model covariate(s), specified as a string (space delimited) or a list
- by
Optional stratification variable(s), specified as a string (space delimited) or a list of factors; if specified, the data are subsetted by the values of the factor(s) and missing data patterns are displayed for each subset in turn; can only be used when the total number of variables listed in 'y' and 'covs' is greater than one
- plot
If TRUE, displays a plot using md.pattern to visualise the missing data patterns; if stratification variable(s) are specified, a separate plot will be displayed for each subset; use plot = FALSE (the default) to disable the plot
Examples
descMissData(y="bmi7", covs="matage mated", data=bmi)
#> [[1]]
#> pattern bmi7 matage mated n pct
#> [1,] 1 1 1 1 592 59
#> [2,] 2 0 1 1 408 41
#>
descMissData(y="bmi7", covs="matage mated bwt", by="pregsize", data=bmi)
#> pregsize: 0
#> pattern bmi7 matage mated bwt n pct
#> [1,] 1 1 1 1 1 524 59
#> [2,] 2 0 1 1 1 365 41
#> ------------------------------------------------------------
#> pregsize: 1
#> pattern bmi7 matage mated bwt n pct
#> [1,] 1 1 1 1 1 68 61
#> [2,] 2 0 1 1 1 43 39