1
0

comment out irrelevant stuff that made knitr fail.

This commit is contained in:
2023-03-02 13:22:24 -08:00
parent e36c6a742f
commit 5e0c2de35b
2 changed files with 15 additions and 12 deletions

View File

@@ -12,9 +12,9 @@ iv.sample.count <- iv.example$cc_ex_tox.likes.race_disclosed.medsampsample.count
dv.sample.count <- dv.example$cc_ex_tox.likes.race_disclosed.largesampsample.count
plot.cc.example <- function(datalist, name, varnames=NULL, varorder=NULL, include.models=c("Automated Classifications", "Manual Annotations")){
plot.cc.example <- function(datalist, name, varnames=NULL, varorder=NULL, include.models=c("Automatic Classification", "All Annotations")){
model.names <- c("Automated Classifications", "Manual Annotations", "Annotation Sample", "Error Correction")
model.names <- c("Automatic Classification", "All Annotations", "Annotation Sample", "Error Correction")
glm.par.names <- paste0(name,"coef_",c("pred", "coder", "sample"), "_model")
@@ -62,6 +62,8 @@ plot.cc.example <- function(datalist, name, varnames=NULL, varorder=NULL, includ
df[,Model:= factor(gsub('\\.',' ', Model), levels=rev(model.names))]
df <- df[Model %in% include.models]
rename_models <- list("Automatic Classification"="Automated Classifications", "All Annotations"="Manual Annotations")
df <- df[, Model := factor(rename_models[as.character(df$Model)],levels=rev(unique(rename_models[model.names])))]
p <- ggplot(df[variable != "Intercept"], aes(y = Estimate, x=Model, ymax=LowerCI, ymin=UpperCI, group=variable))
p <- p + geom_pointrange(shape=1) + facet_wrap('variable',scales='free_x',nrow=1,as.table=F) + geom_hline(aes(yintercept=0),linetype='dashed',color='gray40') + coord_flip() + xlab("")
@@ -70,8 +72,9 @@ plot.cc.example <- function(datalist, name, varnames=NULL, varorder=NULL, includ
}
plot.civilcomments.dv.example <- function(include.models=c("Automatic Classification", "All Annotations")){
return(plot.cc.example(dv.example, "cc_ex_tox.likes.race_disclosed.medsamp", varnames=c("Intercept", "Likes", "Identity Disclosure", "Likes:Identity Disclosure"),varorder=c("Intercept", "Likes", "Identity Disclosure", "Likes:Identity Disclosure"), include.models=include.models) + ylab("Coefficients and 95% Confidence Intervals") + ggtitle("Logistic Regression Predicting Toxicity"))
plot.civilcomments.dv.example <- function(include.models=c("Automated Classifications", "Manual Annotations")){
p <- plot.cc.example(dv.example, "cc_ex_tox.likes.race_disclosed.medsamp", varnames=c("Intercept", "Likes", "Identity Disclosure", "Likes:Identity Disclosure"),varorder=c("Intercept", "Likes", "Identity Disclosure", "Likes:Identity Disclosure"), include.models=include.models) + ylab("Coefficients and 95% Confidence Intervals") + ggtitle("Logistic Regression Predicting Toxicity")
return(p)
}