Feature Request: coef and vcov methods for xpose_data
Closed this issue · 4 comments
I've recently been wanting to simplify confidence interval generation for xpose_data objects. As a first, naive attempt, I tried calling confint()
on my xpdb. That didn't work, so I dug a bit deeper, and the default confint method only requires a coef
and vcov
method.
I wrote the following a simple wrappers, but I know that I didn't do problem/subproblem/method selection correctly. Also, when using the Bayesian methods, it would be useful to use the quantiles of the sampling phase rather than the asymptotic CI.
What would you think about cleaning these up and adding them to xpose?
coef.xpose_data <- function(object, ..., .problem=NULL, .subprob=NULL, .method=NULL) {
ret <- get_prm(xpdb=object, .problem=.problem, .subprob=.subprob, .method=.method, digits=Inf, show_all=TRUE, ...)
setNames(ret$value, ret$name)
}
vcov.xpose_data <- function(object, ..., .problem=NULL, .subprob=NULL, .method=NULL) {
cov_data <- object$files$data[[which(object$files$extension == "cov")]]
ret <- as.matrix(cov_data[, setdiff(names(cov_data), "NAME")])
rownames(ret) <- cov_data$NAME
ret
}
Do you think this should be added in the core xpose or an add-on? When times allow I will transition xpose into S3 so it would allow more flexibility for this type of initiative.
To me, coef and vcov are methods that assist with model summaries, so I think that they are core.
Sure, why not! The code is relatively simple and we could add these to the summary()
output