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

Allow custom na.action in bart2() and dbartsData() #61

Open
ngreifer opened this issue Oct 26, 2023 · 0 comments
Open

Allow custom na.action in bart2() and dbartsData() #61

ngreifer opened this issue Oct 26, 2023 · 0 comments

Comments

@ngreifer
Copy link

bart2() calls dbartData() to handle the inputs. When a formula and data.frame are supplied, dbartsData() calls model.frame() using similar infrastructure to lm(), which is very common in packages that allow a formula interface. However, dbartsData() assigns stats::na.omit to na.action, which drops any observations with missingness. This guarantees missing values do not enter the dataset and cause errors, but omitting missing observations is not the only way to handle them. For example, one might write a custom function that imputes the missing values (e.g., with the mean). I request that dbartsData() and bart2() accept an na.action argument that allows users to supply their own function for processing missing values. This should also be followed by a check to make sure no missing values remain in the dataset after running model.frame(). The default can be na.omit, which is currently what is hard-coded in. Thank you.

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

No branches or pull requests

1 participant