I am trying to include four rdrobust models in a table using modelsummary, but also need to include: N (number of observations), bws (chosen bandwidth) and p (order of the polynomial). The answer to this question was very helpful but I need to add the extra statistics. I tried to include these in the glance and the tidy formula, but keep getting an error. I'm not sure where I'm going wrong.
I tried:
tidy.rdrobust <- function(x, ...) {
ret <- data.frame(
term = row.names(x$coef),
estimate = x$coef[, 1],
std.error = x$se[, 1],
p.value = x$pv[, 1]
N = x$N[,1],
BW = x$bws[,1]
)
row.names(ret) <- NULL
ret
}
glance.rdrobust <- function(x, ...) {
ret <- data.frame(
Kernel = x$kernel,
Bandwidth = x$bwselect
)
ret
}
And also:
tidy.rdrobust <- function(x, ...) {
ret <- data.frame(
term = row.names(x$coef),
estimate = x$coef[, 1],
std.error = x$se[, 1],
p.value = x$pv[, 1]
)
row.names(ret) <- NULL
ret
}
glance.rdrobust <- function(x, ...) {
ret <- data.frame(
Kernel = x$kernel,
Bandwidth = x$bwselect,
BW = x$bws,
N = x$N
)
ret
}