rm(list=ls(all=TRUE)) # clear all variables graphics.off() # clear all graphics # Smiles and Leniency # Greg Francis # PSY 628 # 12 August 2024 # Fit a Psychometric function # load the quickpsy library library(quickpsy) # load data file MLdata<-read.csv(file="MLTBTData.csv",header=TRUE,stringsAsFactors=TRUE) # Create 0-1 response summary (report the plain line is longer) MLdata$Response <-0*MLdata$Trial # just makes an array of the right length, filled with 0's MLdata$Response[MLdata$WhichReportedLonger =="plain"] =1 # Fit without lapses fit1 <- quickpsy(MLdata, PlainLength, Response) # Fit with lapses fit2 <- quickpsy(MLdata, PlainLength, Response, lapses=TRUE) print(fit2) # Find 75% threshold fit3 <- quickpsy(MLdata, PlainLength, Response, lapses=TRUE, prob=.75) print(fit3) # Use Weibell function fit4 <- quickpsy(MLdata, PlainLength, Response, lapses=TRUE, fun=weibull_fun) print(fit4) # Use Logistic function fit5 <- quickpsy(MLdata, PlainLength, Response, lapses=TRUE, fun= logistic_fun) print(fit5) # With a guess rate of 0.25 fit6 <- quickpsy(MLdata, PlainLength, Response, lapses=TRUE, fun= logistic_fun, guess=0.25) print(fit6)