Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Little's MCAR test #279

Merged
merged 3 commits into from
Dec 23, 2020
Merged

Add Little's MCAR test #279

merged 3 commits into from
Dec 23, 2020

Conversation

andrewheiss
Copy link
Contributor

I added mcar_test() for calculating Little's MCAR statistic. The function returns a broom::glance()-like tibble with one row and four columns:

mcar_test(airquality)
#> # A tibble: 1 x 4
#>   statistic    df p.value missing.patterns
#>       <dbl> <dbl>   <dbl>            <int>
#> 1      35.1    14 0.00142                4

Description

I adapted LittleMCAR() from the now-orphaned {BaylorEdPsych} package, which was archived by CRAN because {mvnmle} was also archived.

Eric Stemmler updated the function to work with {norm} for ML estimation instead. I rewrote and readapted his code to work with {purrr}, so it should go faster (and it handles edge cases where every value in a row is NA)

Example

mcar_test(airquality)
#> # A tibble: 1 x 4
#>   statistic    df p.value missing.patterns
#>       <dbl> <dbl>   <dbl>            <int>
#> 1      35.1    14 0.00142                4

Tests

The function has 100% test coverage.

andrewheiss and others added 3 commits December 22, 2020 10:36
…a note on the code being adapted from BaylorEdPsych, add author name of Andrew Heiss. Remove @importFrom and use namespaced pchisq
@njtierney
Copy link
Owner

Awesome! Just added a few small cosmetic changes, thanks so much for providing such a fully-fledged PR with tests and great docs!

@njtierney njtierney merged commit 9c57600 into njtierney:master Dec 23, 2020
@andrewheiss andrewheiss deleted the mcar branch December 23, 2020 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants