0

I am trying to perform parameter estimation using an R package called "quickpsy." Using the code you will see below, I am calculating thresholds for each subject.

#import basic libraries


library(quickpsy)
library(tidyverse)
library(ggplot2)
library(extrafont)
loadfonts(device = "win")

# Deney 1 PSE analysis

Deney1_Ra_84$Motivasyon <- as.character(Deney1_Ra_84$Motivasyon)
Deney1_Ra_84$Motivasyonel_Yogunluk <- as.character(Deney1_Ra_84$Motivasyonel_Yogunluk)

# quickpsy to estimate psychometric thresholds 50%
Deney1_psy_fits_50 = quickpsy(Deney1_Ra_84, test_duration, correct, lapses = TRUE, prob = .5, 
                              grouping = c("subject_nr","Motivasyon","Motivasyonel_Yogunluk"), fun = cum_normal_fun, bootstrap="none")


Deney1_psy_fits_50$thresholds

Afterwards, when I manually calculate the means of the variables "Motivasyon" and "Motivasyonel_Yoğunluk" in Excel, I obtain the averages of the thresholds for the interaction of motivasyon and motivasyonel_yoğunluk. However, when I use the following code in R (excluding the variable subject_nr) for the variables "Motivasyon" and "Motivasyonel_Yoğunluk," I obtain different averages.

# quickpsy to estimate psychometric thresholds 50%
Deney1_psy_fits_50 = quickpsy(Deney1_Ra_84, test_duration, correct, lapses = TRUE, prob = .5, 
                              grouping = c("Motivasyon","Motivasyonel_Yogunluk"), fun = cum_normal_fun, bootstrap="none")

What could be the reason for this discrepancy?

I would be grateful for your assistance.

In summary,

I attempted to calculate the mean thresholds for each level of "motivasyon" and "motivasyonel_yoğunluk" both in Excel and R. However, I obtained different results in the two approaches.

MrFlick
  • 195,160
  • 17
  • 277
  • 295
  • 1
    Hi Aslan, please provide [a minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). You included no data – Mark Jun 26 '23 at 11:31
  • Hi @Mark, Thank you for your response. You can find a summarized version of the raw data at the following link: [link] (https://drive.google.com/file/d/1CQdaJ3UooGfJWVVFBNC1H-hLcqGYyPVE/view?usp=sharing) – Aslan Karaaslan Jun 26 '23 at 12:18
  • 1
    thanks for sharing! I don't think I can be of much more use. My mind thinks two things: 1. if there is going to be a bug, it is most likely in a new implementation of something in Excel than in a mature R package (but impossible to say where one might be for certain, if indeed one exists). 2. the source code for `quickpsy` is relatively short, you could very easily save it on your computer, debug that, see the constituent parts of the function, and see if they match the constituent parts of your Excel code. Then at least you will know where things are differing. All the best brother! – Mark Jun 26 '23 at 12:43
  • https://github.com/danilinares/quickpsy/blob/1739338784c201762d7c812e8dbdfe47e3c39010/R/quickpsy.R#L122 – Mark Jun 26 '23 at 12:45
  • Hi @Mark Thank you for sharing your thoughts! I appreciate your input. The idea of examining the source code of quickpsy, comparing it with my Excel code, and debugging it on my computer sounds like a promising approach. Thank you once again for your advice and all the best! – Aslan Karaaslan Jun 26 '23 at 13:17
  • I'd strongly encourage you to make a **minimal** example - whether for clarity here or for your own debugging. The google drive link you show has thousands of rows - it will be hard to understand what's going on. Instead, subset your data to, say, 2 subjects with 10 rows each and run your Excel and R code on them. If there's still a difference, it will be much easier to identify on a small example. If there's not a difference, increase the complexity - maybe cut your data in half. If you can find the smallest example that illustrates your problem, then your problem will be much clearer. – Gregor Thomas Jun 26 '23 at 14:11

0 Answers0