Make curves thicker in R quickpsy

Viewed 41

I'm using quickpsy package in R (https://cran.r-project.org/web/packages/quickpsy/quickpsy.pdf /
http://dlinares.org/quickpsy.html) to fit psychometric functions to the data. I use quickpsy and then plotcurves.

fit <- quickpsy(data, delta, response, grouping = c("condition"),lapses = FALSE, bootstrap = "none",  fun = logistic_fun) 

plotcurves(fit,  ci = TRUE) + labs(y = "Proportion yes responses", x="Delta") + theme_classic(base_size = 20)  + scale_x_continuous(n.breaks = 6, limits=c(-3, 3)) + 
scale_color_manual(values=c("#C0C0C0", "#000000")) + theme(legend.title = element_blank())

I'd like to make the plotted curves thicker. Is there any way to do it? I couldn't increase the thickness with any ggplot width manipulation.

1 Answers

What you could do is using your quickpsy fit with ggplot instead of plotcurves. Then you can change the size of your geom_line. Here is a reproducible example:

library(ggplot2)
library(quickpsy)

x <- seq(0, 420, 60)
k <- c(0, 0, 4, 18, 20, 20, 19, 20)
dat <- tibble(x, k, n = 20)

fitWithoutLapses <- quickpsy(dat, x, k, n, prob = .75) 
#> Warning: `group_by_()` was deprecated in dplyr 0.7.0.
#> Please use `group_by()` instead.
#> See vignette('programming') for more help
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.

curvesWithoutLapses <- fitWithoutLapses$curves %>% 
  mutate(cond = 'Without Lapses')

pWithout <- ggplot()+
  geom_point(data = fitWithoutLapses$averages, aes(x = x, y = prob)) +
  geom_line(data = curvesWithoutLapses,
            aes(x = x, y = y, color = cond), size = 2) +
  geom_linerange(data = fitWithoutLapses$thresholds, 
                 aes(x = thre, ymin = 0, ymax = prob), lty =2) 
pWithout

Created on 2022-07-30 by the reprex package (v2.0.1)

For more info check this link for using quickpsy in ggplot.

Related