Skip to content

dimnames-names of DMs and ISMs #249

@benthestatistician

Description

@benthestatistician

As applied to a DenseMatrix, dimnames() returns a list of two character vectors, "treatment" and "control". As applied to an InfinitySparseMatrix, dimnames() returns a list of two character vectors, "treated" and "control". The two lists should have the same two names.

data(nuclearplants)
match_on.examples <- list()
### Propensity score distances.
### Recommended approach:
(aGlm <- glm(pr~.-(pr+cost), family=binomial(), data=nuclearplants))
match_on.examples$ps1 <- match_on(aGlm)
is(match_on.examples$ps1)
## [1] "DenseMatrix" "matrix"      "array"       "structure"   "vector"   
names(dimnames(match_on.examples$ps1))
## [1] "treatment" "control" 

tmp <- nuclearplants$t1
names(tmp) <- rownames(nuclearplants)
absdist <- match_on(tmp, z = nuclearplants$pr,
                  within = exactMatch(pr ~ pt, nuclearplants))
is(absdist)
## [1] "BlockedInfinitySparseMatrix" "InfinitySparseMatrix"       
## [3] "vector"     
names(dimnames(absdist))
## [1] "treated" "control"

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions