library(ggplot2)
# with matching
df_match <- readRDS("data-raw/bikesharing-tempdata/bikes_allcw_matched.Rds")
df_match <- cbind(df_match, group = rep(1:3, each = 110))
dft <- df_match # safety save stupid
dft$method <- apply( dft[ , c(3, 6)], 1, paste, collapse = "_") # to that grouping works
data.table(dft[, .(meanlpdens = mean(lpdens)), by = .(method)])
dfx <- dft[method %in% c("equal_wt_NA", "gewisano_NA", "caliper_propto_0.10")]
plt1 <- ggplot(dfx, aes(y = lpdens, x = t, color = method)) +
geom_line() +
facet_wrap(~group, ncol = 1, scales = "free") +
labs(
title = "Log pred density smoothing with continuous vars and matching",
x = "Time",
y = "lpdens"
)
ggplot2::ggsave("temp/aggpreds-cont-match.pdf", plt1)
View(dft[, .(predabil = sum(lpdens)), by = .(method)])
# without matching
df_nomatch <- readRDS("data-raw/bikesharing-tempdata/bikes_allcw_nomatch.Rds")
df_nomatch <- cbind(df_nomatch, group = rep(1:3, each = 110))
dft <- df_nomatch # safety save stupid
dft$method <- apply( dft[ , c(3, 6)], 1, paste, collapse = "_") # to that grouping works
data.table(dft[, .(meanlpdens = mean(lpdens)), by = .(method)])
dfx <- dft[method %in% c("equal_wt_NA", "gewisano_NA", "caliper_propto_0.10")]
plt2 <- ggplot(dfx, aes(y = lpdens, x = t, color = method)) +
geom_line() +
facet_wrap(~group, ncol = 1, scales = "free") +
labs(
title = "Log pred density smoothing with continuous vars and matching",
x = "Time",
y = "lpdens"
)
ggplot2::ggsave("temp/aggpreds-cont-no-match.pdf", plt2)
View(dft[, .(predabil = sum(lpdens)), by = .(method)])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.