y = value,
fill = name)) +
# Add a bar, but don't add the legend
geom_col(show.legend = FALSE) +
# A pie/donut chart is a bar chart with polar coordinates
# Add polar coordinates and set the direction to -1
# so the filled in part starts at the top and goes clockwise
coord_polar(theta = "y",
direction = -1) +
# Set the limits, which is important for adding the hole
xlim(c(-2, 2)) +
# Set a color scale with the highlighted section in whatever color
# is chosen with the highlight_color argument and the rest in a light gray
scale_fill_manual(values = c(highlight_color, "grey90")) +
# Set theme_void() to remove grid lines and everything else from the plot
theme_void() +
# Add the big number in the center of the hole
annotate("text",
label = big_number_text_label,
family = font_family,
fontface = "bold",
color = highlight_color,
size = 12,
x = -2,
y = 0)
}
big_number_donut_plot(value = 0.56,
font_family = "Inter",
highlight_color = "orange")
value <- 0.56
# Wrangle data to get a data frame in the format we need it in to make our donut chart
df <- tibble(x = 1, y = value) %>%
mutate(y_negative = 1 - y) %>%
pivot_longer(cols = -x)
df
highlight_color <- "orange"
# Create our plot
ggplot(data = df,
aes(x = x,
y = value,
fill = name)) +
# Add a bar, but don't add the legend
geom_col(show.legend = FALSE) +
# A pie/donut chart is a bar chart with polar coordinates
# Add polar coordinates and set the direction to -1
# so the filled in part starts at the top and goes clockwise
coord_polar(theta = "y",
direction = -1) +
# Set the limits, which is important for adding the hole
xlim(c(-2, 2)) +
# Set a color scale with the highlighted section in whatever color
# is chosen with the highlight_color argument and the rest in a light gray
scale_fill_manual(values = c(highlight_color, "grey90")) +
# Set theme_void() to remove grid lines and everything else from the plot
theme_void()
font_family <- "Inter"
# Create a nicely formatted big number to go in the donut hole
big_number_text_label <- percent(value, accuracy = 1)
# Create our plot
ggplot(data = df,
aes(x = x,
y = value,
fill = name)) +
# Add a bar, but don't add the legend
geom_col(show.legend = FALSE) +
# A pie/donut chart is a bar chart with polar coordinates
# Add polar coordinates and set the direction to -1
# so the filled in part starts at the top and goes clockwise
coord_polar(theta = "y",
direction = -1) +
# Set the limits, which is important for adding the hole
xlim(c(-2, 2)) +
# Set a color scale with the highlighted section in whatever color
# is chosen with the highlight_color argument and the rest in a light gray
scale_fill_manual(values = c(highlight_color, "grey90")) +
# Set theme_void() to remove grid lines and everything else from the plot
theme_void() +
# Add the big number in the center of the hole
annotate(geom = "text",
label = big_number_text_label,
family = font_family,
fontface = "bold",
color = highlight_color,
size = 12,
x = -2,
y = 0)
pacman::p_load(tidyverse, scales)
font_family <- "Inter"
big_number_donut_plot <- function(value, font_family, highlight_color) {
# Wrangle data to get a data frame in the format we need it in to make our donut chart
df <- tibble(x = 1, y = value) %>%
mutate(y_negative = 1 - y) %>%
pivot_longer(cols = -x)
# Create a nicely formatted big number to go in the donut hole
big_number_text_label <- percent(value, accuracy = 1)
# Create our plot
ggplot(df,
aes(x = x,
y = value,
fill = name)) +
# Add a bar, but don't add the legend
geom_col(show.legend = FALSE) +
# A pie/donut chart is a bar chart with polar coordinates
# Add polar coordinates and set the direction to -1
# so the filled in part starts at the top and goes clockwise
coord_polar(theta = "y",
direction = -1) +
# Set the limits, which is important for adding the hole
xlim(c(-2, 2)) +
# Set a color scale with the highlighted section in whatever color
# is chosen with the highlight_color argument and the rest in a light gray
scale_fill_manual(values = c(highlight_color, "grey90")) +
# Set theme_void() to remove grid lines and everything else from the plot
theme_void() +
# Add the big number in the center of the hole
annotate("text",
label = big_number_text_label,
family = font_family,
fontface = "bold",
color = highlight_color,
size = 12,
x = -2,
y = 0)
}
big_number_donut_plot(value = 0.56,
font_family = "Inter",
highlight_color = "orange")
value <- 0.56
# Wrangle data to get a data frame in the format we need it in to make our donut chart
df <- tibble(x = 1, y = value) %>%
mutate(y_negative = 1 - y) %>%
pivot_longer(cols = -x)
df
highlight_color <- "orange"
# Create our plot
ggplot(data = df,
aes(x = x,
y = value,
fill = name)) +
# Add a bar, but don't add the legend
geom_col(show.legend = FALSE) +
# A pie/donut chart is a bar chart with polar coordinates
# Add polar coordinates and set the direction to -1
# so the filled in part starts at the top and goes clockwise
coord_polar(theta = "y",
direction = -1) +
# Set the limits, which is important for adding the hole
xlim(c(-2, 2)) +
# Set a color scale with the highlighted section in whatever color
# is chosen with the highlight_color argument and the rest in a light gray
scale_fill_manual(values = c(highlight_color, "grey90")) +
# Set theme_void() to remove grid lines and everything else from the plot
theme_void()
font_family <- "Inter"
# Create a nicely formatted big number to go in the donut hole
big_number_text_label <- percent(value, accuracy = 1)
# Create our plot
ggplot(data = df,
aes(x = x,
y = value,
fill = name)) +
# Add a bar, but don't add the legend
geom_col(show.legend = FALSE) +
# A pie/donut chart is a bar chart with polar coordinates
# Add polar coordinates and set the direction to -1
# so the filled in part starts at the top and goes clockwise
coord_polar(theta = "y",
direction = -1) +
# Set the limits, which is important for adding the hole
xlim(c(-2, 2)) +
# Set a color scale with the highlighted section in whatever color
# is chosen with the highlight_color argument and the rest in a light gray
scale_fill_manual(values = c(highlight_color, "grey90")) +
# Set theme_void() to remove grid lines and everything else from the plot
theme_void() +
# Add the big number in the center of the hole
annotate(geom = "text",
label = big_number_text_label,
family = font_family,
fontface = "bold",
color = highlight_color,
size = 12,
x = -2,
y = 0)
pacman::p_load(tidyverse, scales)
font_family <- "Inter"
big_number_donut_plot <- function(value, font_family, highlight_color) {
# Wrangle data to get a data frame in the format we need it in to make our donut chart
df <- tibble(x = 1, y = value) %>%
mutate(y_negative = 1 - y) %>%
pivot_longer(cols = -x)
# Create a nicely formatted big number to go in the donut hole
big_number_text_label <- percent(value, accuracy = 1)
# Create our plot
ggplot(df,
aes(x = x,
y = value,
fill = name)) +
# Add a bar, but don't add the legend
geom_col(show.legend = FALSE) +
# A pie/donut chart is a bar chart with polar coordinates
# Add polar coordinates and set the direction to -1
# so the filled in part starts at the top and goes clockwise
coord_polar(theta = "y",
direction = -1) +
# Set the limits, which is important for adding the hole
xlim(c(-2, 2)) +
# Set a color scale with the highlighted section in whatever color
# is chosen with the highlight_color argument and the rest in a light gray
scale_fill_manual(values = c(highlight_color, "grey90")) +
# Set theme_void() to remove grid lines and everything else from the plot
theme_void() +
# Add the big number in the center of the hole
annotate("text",
label = big_number_text_label,
family = font_family,
fontface = "bold",
color = highlight_color,
size = 12,
x = -2,
y = 0)
}
big_number_donut_plot(value = 0.65,
font_family = "Inter",
highlight_color = "orange")
value <- 0.65
# Wrangle data to get a data frame in the format we need it in to make our donut chart
df <- tibble(x = 1, y = value) %>%
mutate(y_negative = 1 - y) %>%
pivot_longer(cols = -x)
df
highlight_color <- "orange"
# Create our plot
ggplot(data = df,
aes(x = x,
y = value,
fill = name)) +
# Add a bar, but don't add the legend
geom_col(show.legend = FALSE) +
# A pie/donut chart is a bar chart with polar coordinates
# Add polar coordinates and set the direction to -1
# so the filled in part starts at the top and goes clockwise
coord_polar(theta = "y",
direction = -1) +
# Set the limits, which is important for adding the hole
xlim(c(-2, 2)) +
# Set a color scale with the highlighted section in whatever color
# is chosen with the highlight_color argument and the rest in a light gray
scale_fill_manual(values = c(highlight_color, "grey90")) +
# Set theme_void() to remove grid lines and everything else from the plot
theme_void()
font_family <- "Inter"
# Create a nicely formatted big number to go in the donut hole
big_number_text_label <- percent(value, accuracy = 1)
# Create our plot
ggplot(data = df,
aes(x = x,
y = value,
fill = name)) +
# Add a bar, but don't add the legend
geom_col(show.legend = FALSE) +
# A pie/donut chart is a bar chart with polar coordinates
# Add polar coordinates and set the direction to -1
# so the filled in part starts at the top and goes clockwise
coord_polar(theta = "y",
direction = -1) +
# Set the limits, which is important for adding the hole
xlim(c(-2, 2)) +
# Set a color scale with the highlighted section in whatever color
# is chosen with the highlight_color argument and the rest in a light gray
scale_fill_manual(values = c(highlight_color, "grey90")) +
# Set theme_void() to remove grid lines and everything else from the plot
theme_void() +
# Add the big number in the center of the hole
annotate(geom = "text",
label = big_number_text_label,
family = font_family,
fontface = "bold",
color = highlight_color,
size = 12,
x = -2,
y = 0)
df
pacman::p_load(tidyverse, scales)
font_family <- "Inter"
big_number_donut_plot <- function(value, font_family, highlight_color) {
# Wrangle data to get a data frame in the format we need it in to make our donut chart
df <- tibble(x = 1, y = value) %>%
mutate(y_negative = 1 - y) %>%
pivot_longer(cols = -x)
# Create a nicely formatted big number to go in the donut hole
big_number_text_label <- percent(value, accuracy = 1)
# Create our plot
ggplot(df,
aes(x = x,
y = value,
fill = name)) +
# Add a bar, but don't add the legend
geom_col(show.legend = FALSE) +
# A pie/donut chart is a bar chart with polar coordinates
# Add polar coordinates and set the direction to -1
# so the filled in part starts at the top and goes clockwise
coord_polar(theta = "y",
direction = -1) +
# Set the limits, which is important for adding the hole
xlim(c(-2, 2)) +
# Set a color scale with the highlighted section in whatever color
# is chosen with the highlight_color argument and the rest in a light gray
scale_fill_manual(values = c(highlight_color, "grey90")) +
# Set theme_void() to remove grid lines and everything else from the plot
theme_void() +
# Add the big number in the center of the hole
annotate("text",
label = big_number_text_label,
family = font_family,
fontface = "bold",
color = highlight_color,
size = 12,
x = -2,
y = 0)
}
big_number_donut_plot(value = 0.65,
font_family = "Inter",
highlight_color = "orange")
value <- 0.65
# Wrangle data to get a data frame in the format we need it in to make our donut chart
df <- tibble(x = 1, y = value) %>%
mutate(y_negative = 1 - y) %>%
pivot_longer(cols = -x)
df
highlight_color <- "orange"
# Create our plot
ggplot(data = df,
aes(x = x,
y = value,
fill = name)) +
# Add a bar, but don't add the legend
geom_col(show.legend = FALSE) +
# A pie/donut chart is a bar chart with polar coordinates
# Add polar coordinates and set the direction to -1
# so the filled in part starts at the top and goes clockwise
coord_polar(theta = "y",
direction = -1) +
# Set the limits, which is important for adding the hole
xlim(c(-2, 2)) +
# Set a color scale with the highlighted section in whatever color
# is chosen with the highlight_color argument and the rest in a light gray
scale_fill_manual(values = c(highlight_color, "grey90")) +
# Set theme_void() to remove grid lines and everything else from the plot
theme_void()
font_family <- "Inter"
# Create a nicely formatted big number to go in the donut hole
big_number_text_label <- percent(value, accuracy = 1)
# Create our plot
ggplot(data = df,
aes(x = x,
y = value,
fill = name)) +
# Add a bar, but don't add the legend
geom_col(show.legend = FALSE) +
# A pie/donut chart is a bar chart with polar coordinates
# Add polar coordinates and set the direction to -1
# so the filled in part starts at the top and goes clockwise
coord_polar(theta = "y",
direction = -1) +
# Set the limits, which is important for adding the hole
xlim(c(-2, 2)) +
# Set a color scale with the highlighted section in whatever color
# is chosen with the highlight_color argument and the rest in a light gray
scale_fill_manual(values = c(highlight_color, "grey90")) +
# Set theme_void() to remove grid lines and everything else from the plot
theme_void() +
# Add the big number in the center of the hole
annotate(geom = "text",
label = big_number_text_label,
family = font_family,
fontface = "bold",
color = highlight_color,
size = 12,
x = -2,
y = 0)
install.packages(c("car", "datawizard", "DescTools", "digest", "e1071", "effectsize", "ggeffects", "gld", "insight", "jsonlite", "maptools", "markdown", "mgcv", "minqa", "openxlsx", "ragg", "rpart", "sys", "vctrs", "xfun", "yaml"))
install.packages(c("evaluate", "ggrepel", "lubridate", "plotly", "RcppEigen", "rmarkdown", "rstatix", "sp", "timechange"))
install.packages(c("ggrepel", "lubridate", "Matrix", "plyr", "RcppEigen", "roxygen2", "sp", "timechange"))
library(lme4)
library(MuMIn)    # for the r.squaredGLMM function
#library(ordinal)
set.seed(1245)
# Simulate data for power analysis
n <- 180
newdat <- data.frame(
id = factor(rep(1:n, e=12)), ###Messungen pro person
## UVs
echo = factor(rep(c("conf_echo", "balance", "host_echo"), e=12)),
conf = as.vector(replicate(12, sample(1:3, n, replace=T))),
## Posts
post_num = factor(1:12),
## AVs
judgment = as.vector(replicate(12, sample(1:6, n, replace=T)))
)
# check data set
View(newdat)
table(newdat$id)
xtabs( ~ echo + id, newdat)
with(newdat, tapply(id, echo, function(x) length(unique(x))))
# number of simulations
nsim <- 400
lmx <- lmer(judgment ~ echo*conf + (1 | id) + (1|post_num), newdat) #ohne correlation
summary(lmx)
simdat <- simulate( ~ echo*conf+ (1 | id) + (1|post_num), newdata=newdat,
newparams=list(theta=c(0.50, 0.10),
beta=c(3.48671, 0, 0, 0.053, -0.12, 0.12),
sigma=1), family=gaussian,
nsim=nsim)
p <- numeric(nsim)
r2 <- matrix(nrow=nsim, ncol=2)
for (i in seq_len(nsim)) {
newdat$av <- simdat[, i]
fit1 <- lmer(av ~ echo+conf + (1 | id) + (1|post_num), newdat)
fit2 <- lmer(av ~ echo*conf + (1 | id) + (1|post_num), newdat)
p[i] <- anova(fit1, fit2)[2, "Pr(>Chisq)"]
r2[i,] <- r.squaredGLMM(fit2)
}
# calculate power
mean(p < 0.05)
# look at R2(marginal)
hist(r2[, 1], col="gray", border="white")
abline(v=0.3, col="red")
abline(v=mean(r2[, 1]), col="blue")
# R2(conditional)
mean(r2[, 2])
library(lme4)
library(MuMIn)    # for the r.squaredGLMM function
#library(ordinal)
set.seed(1245)
# Simulate data for power analysis
n <- 180
newdat <- data.frame(
id = factor(rep(1:n, e=12)), ###Messungen pro person
## UVs
echo = factor(rep(c("conf_echo", "balance", "host_echo"), e=12)),
conf = as.vector(replicate(12, sample(1:3, n, replace=T))),
## Posts
post_num = factor(1:12),
## AVs
judgment = as.vector(replicate(12, sample(1:6, n, replace=T)))
)
# check data set
View(newdat)
echo
lmx <- lmer(judgment ~ echo*conf + (1 | id) + (1|post_num), newdat) #ohne correlation
summary(lmx)
install.packages(c("bit", "data.table", "datawizard", "Hmisc", "insight", "knitr", "sass", "sjPlot", "sjstats", "vctrs", "xfun"))
install.packages(c("httpuv", "maptools", "nlme"))
install.packages(c("httpuv", "maptools", "nlme"))
install.packages(c("httpuv", "maptools", "nlme"))
reticulate::repl_python()
import whisper
Y
install.packages(c("gdtools", "interp", "marginaleffects"))
install.packages(c("cachem", "chatgpt", "class", "evaluate", "gdata", "ggeffects", "influenceR", "KernSmooth", "later", "MASS", "nnet", "profvis", "sass", "survey", "testthat", "viridis", "viridisLite", "waldo"))
library(segmag)
install.packages(c("dbplyr", "digest", "downlit", "jtools", "KernSmooth", "Matrix", "MatrixModels", "mgcv", "pkgload", "readxl", "rstudioapi", "shiny", "testthat"))
install.packages(c("BiocManager", "bslib", "cpp11", "curl", "effectsize", "emmeans", "gert", "ggplot2", "ggpmisc", "ggpp", "htmltools", "httr", "Matrix", "nlme", "promises", "purrr", "rmarkdown", "shiny", "sjPlot", "survival", "tinytex", "uuid", "xfun"))
install.packages(c("emmeans", "sjPlot", "uuid"))
install.packages(c("emmeans", "sjPlot", "uuid"))
install.packages(c("credentials", "ggeffects"))
install.packages(c("credentials", "ggeffects"))
# Install and load necessary package
if (!require("ggplot2")) install.packages("ggplot2")
library(ggplot2)
# Data
references <- c(2, 12, 21)
names(references) <- c("Real Citations", "Similar to Actual Manuscripts", "Pastiche of Multiple Manuscripts")
# Total number of references
total_references <- sum(references)
# Colors
colors <- c("#ff9999", "#66b3ff", "#99ff99")
# Create pie chart
pie <- ggplot() +
geom_bar(aes(x="", y=references, fill=names(references)), stat="identity", width=1) +
coord_polar("y", start=0) +
theme_void() +
theme(legend.title = element_blank()) +
scale_fill_manual(values=colors) +
ggtitle(paste("Proportion of Hallucinated References in ChatGPT Citations (Total:", total_references, "References)"))
# Display plot
print(pie)
install.packages(c("bslib", "crosstalk", "htmlwidgets", "stringi", "tinytex"))
install.packages(c("BayesFactor", "brew", "brio", "checkmate", "cli", "cluster", "cowplot", "cpp11", "curl", "data.table", "desc", "fansi", "gert", "ggeffects", "ggridges", "htmlwidgets", "httpuv", "jsonlite", "later", "markdown", "pkgbuild", "processx", "progress", "ragg", "rpart", "sandwich", "sass", "splus2R", "stringi", "testthat", "vctrs", "vroom", "xml2", "yaml", "yulab.utils"))
install.packages(c("BH", "DBI", "digest", "ggpp", "ggrepel", "glue", "Matrix", "Rcpp", "readr", "reprex", "rlang", "roxygen2", "yulab.utils"))
cite(lme4)
cite(tidyverse)
library(tidyverse)
cite(tidyverse)
citation(tidyverse)
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
csv_files <- list.files(pattern = "\\.csv$")
csv_files
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
csv_files <- list.files(pattern = "\\.csv$")
for (file_name in csv_files) {
# Read the CSV file
df <- read.csv(file_name)
# Remove the columns. Ensure these column names match your files' column names.
df <- df[ , !(names(df) %in% c("PROLIFIC_PID", "STUDY_ID", "SESSION_ID"))]
# Write the modified dataframe back to a CSV file
# If you want to overwrite the original files, use the same file_name
write.csv(df, file_name, row.names = FALSE)
# If you prefer to save as new files (to preserve originals), modify file_name accordingly
# write.csv(df, paste0("modified_", file_name), row.names = FALSE)
}
