R/utils-results.R

Defines functions format_results

# Function to format results.
format_results <- function(labels, estimates, varcov, label_name="treat", ...){

  # Extract estimates and create results data
  result <- dplyr::tibble(
    label=labels,
    estimate=c(estimates),
    se=diag(varcov**0.5)
  )
  colnames(result) <- c(label_name, "estimate", "se")

  # Compute p-values based on the correct variance estimates
  result <- result %>% dplyr::mutate(
    `pval (2-sided)`=2*stats::pnorm(abs(.data$estimate/.data$se), lower.tail=F)
  )
  return(result)
}

Try the RobinCar package in your browser

Any scripts or data that you put into this service are public.

RobinCar documentation built on May 29, 2024, 3:03 a.m.