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

4.5.2 cobalt::bal.tab and Missing Values #76

Open
vnusinfo opened this issue Dec 10, 2023 · 2 comments
Open

4.5.2 cobalt::bal.tab and Missing Values #76

vnusinfo opened this issue Dec 10, 2023 · 2 comments

Comments

@vnusinfo
Copy link

vnusinfo commented Dec 10, 2023

There may have been a bug introduced in version 4.5.2. When there is a missing value for a continuous variable (e.g., age in lalonde). Here is the error message:

> packageVersion("cobalt")
[1] ‘4.5.2’
> cobalt::bal.tab(subset(dfd, select = -c(treat, re78, nodegree, married))
+                ,treat=dfd$treat)$Balance
Note: `s.d.denom` not specified; assuming pooled.
Error in `.rowNamesDF<-`(x, value = value) : 
  duplicate 'row.names' are not allowed
In addition: Warning messages:
1: Missing values exist in the covariates. Displayed values omit these observations. 
2: non-unique value when setting 'row.names': ‘age’

Here is the minimum code to replicate:

> packageVersion("cobalt")
[1] ‘4.5.2’
> cobalt::bal.tab(subset(dfd, select = -c(treat, re78, nodegree, married))
+                ,treat=dfd$treat)$Balance
Note: `s.d.denom` not specified; assuming pooled.
Error in `.rowNamesDF<-`(x, value = value) : 
  duplicate 'row.names' are not allowed
In addition: Warning messages:
1: Missing values exist in the covariates. Displayed values omit these observations. 
2: non-unique value when setting 'row.names': ‘age’

Here is the same output when the version is reverted to 4.5.1:

> packageVersion("cobalt")
[1] ‘4.5.1’
> dfd <- cobalt::lalonde
> dfd$age[1] <- NA
> 
> packageVersion("cobalt")
[1] ‘4.5.1’
> cobalt::bal.tab(subset(dfd, select = -c(treat, re78, nodegree, married))
+                ,treat=dfd$treat)$Balance
Note: `s.d.denom` not specified; assuming pooled.
               Type      Diff.Un Diff.Adj
age         Contin. -0.248847159       NA
age:<NA>     Binary  0.005405405       NA
educ        Contin.  0.044755085       NA
race_black   Binary  0.640446040       NA
race_hispan  Binary -0.082731683       NA
race_white   Binary -0.557714358       NA
re74        Contin. -0.595751591       NA
re75        Contin. -0.287002109       NA
Warning message:
Missing values exist in the covariates. Displayed values omit these observations.`
@ngreifer
Copy link
Owner

Thank you for this report! I will take a look.

@vnusinfo
Copy link
Author

Thanks so much! Please let me know if I can do anything to contribute.

ngreifer added a commit that referenced this issue Jan 9, 2024
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

2 participants