Skip to content

Commit

Permalink
spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
lukesonnet committed Mar 20, 2018
1 parent f9e2cc9 commit 5359ac4
Show file tree
Hide file tree
Showing 17 changed files with 816 additions and 864 deletions.
30 changes: 14 additions & 16 deletions R/S3_confint.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,24 @@ confint.iv_robust <- confint_lm_like


#' @export
confint.difference_in_means <-
function(object,
parm = NULL,
level = NULL,
...) {
cis <- get_ci_mat(object, level)
confint.difference_in_means <- function(object,
parm = NULL,
level = NULL,
...) {
cis <- get_ci_mat(object, level)

return(cis)
}
return(cis)
}

#' @export
confint.horvitz_thompson <-
function(object,
parm = NULL,
level = NULL,
...) {
cis <- get_ci_mat(object, level, ttest = FALSE)
confint.horvitz_thompson <- function(object,
parm = NULL,
level = NULL,
...) {
cis <- get_ci_mat(object, level, ttest = FALSE)

return(cis)
}
return(cis)
}


## internal method that builds confidence intervals and labels the matrix to be returned
Expand Down
1 change: 0 additions & 1 deletion R/S3_predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ predict.lm_robust <- function(object,
interval <- match.arg(interval)

if (se.fit || interval != "none") {

if (ncol(coefs) > 1) {
stop("Can't set `se.fit` == TRUE with multivariate outcome")
}
Expand Down
22 changes: 9 additions & 13 deletions R/S3_print.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ print_summary_lm_like <- function(x,
...) {
cat(
"\nCall:\n", paste(deparse(x$call, nlines = 5), sep = "\n", collapse = "\n"),
"\n\n", sep = ""
"\n\n",
sep = ""
)
if (x$weighted) {
cat("Weighted, ")
Expand Down Expand Up @@ -67,18 +68,13 @@ print.summary.iv_robust <- function(x,
}

#' @export
print.difference_in_means <-
function(
x,
...) {
cat("Design: ", x$design, "\n")
print(summarize_tidy(x))
}
print.difference_in_means <- function(x, ...) {
cat("Design: ", x$design, "\n")
print(summarize_tidy(x))
}


#' @export
print.horvitz_thompson <-
function(x,
...) {
print(summarize_tidy(x))
}
print.horvitz_thompson <- function(x, ...) {
print(summarize_tidy(x))
}
21 changes: 6 additions & 15 deletions R/S3_summary.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#' @export
summary.lm_robust <- function(object,
...) {

summary.lm_robust <- function(object, ...) {
if (is.matrix(coef(object))) {
ny <- ncol(coef(object))

Expand Down Expand Up @@ -29,7 +27,6 @@ summary.lm_robust <- function(object,
all_models <- object

for (i in seq(ny)) {

for (nm in names(object)) {
if (nm %in% mat_objs) {
object[[nm]] <- all_models[[nm]][, i, drop = TRUE]
Expand All @@ -52,9 +49,7 @@ summary.lm_robust <- function(object,
}

#' @export
summary.iv_robust <- function(object,
...) {

summary.iv_robust <- function(object, ...) {
summary_lm_model(object)
}

Expand Down Expand Up @@ -85,8 +80,7 @@ summary_lm_model <- function(object) {


#' @export
summary.difference_in_means <- function(object,
...) {
summary.difference_in_means <- function(object, ...) {
return(list(
coefficients = summarize_tidy(object),
design = object$design
Expand All @@ -95,12 +89,9 @@ summary.difference_in_means <- function(object,


#' @export
summary.horvitz_thompson <-
function(
object,
...) {
return(list(coefficients = summarize_tidy(object, "z")))
}
summary.horvitz_thompson <- function(object, ...) {
return(list(coefficients = summarize_tidy(object, "z")))
}

summarize_tidy <- function(object, test = "t", ...) {
remove_cols <- c("term", "outcome")
Expand Down
5 changes: 3 additions & 2 deletions R/S3_tidy.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ tidy.horvitz_thompson <- function(object, ...) {


tidy_data_frame <- function(object, digits = NULL) {

vec_cols <-
c(
"coefficients",
Expand All @@ -94,7 +93,9 @@ tidy_data_frame <- function(object, digits = NULL) {
"df"
)

tidy_mat <- do.call("cbind", lapply(vec_cols, function(x) {as.vector(object[[x]])}))
tidy_mat <- do.call("cbind", lapply(vec_cols, function(x) {
as.vector(object[[x]])
}))
vec_cols[which(vec_cols == "coefficients")] <- "estimate"
colnames(tidy_mat) <- vec_cols
return_frame <- data.frame(
Expand Down
Loading

0 comments on commit 5359ac4

Please sign in to comment.