mslugocki / bayesfit

Bayesian Psychometric Curve Fitting Tool
Apache License 2.0
45 stars 8 forks source link

Support for appearence-based tasks? #10

Closed LegrandNico closed 3 years ago

LegrandNico commented 4 years ago

Is it possible to use Bayesfit in the context of appearance-based tasks?

I tried to set nafc to 1 but get an error.

I can work on a PR if this is not currently supported.

mslugocki commented 3 years ago

Think you mean a detection task 💡

You can set the parameter estimate for gamma to be 0.0, and fix it. Unfortunately not able to update this code base as a result of contractual obligations, so PRs are always welcome :)

Hope this helps! M

WORKING EXAMPLE:


import matplotlib.pyplot as plt 
import numpy as np
import bayesfit as bf

stimulus_intensity = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]
trial_correct = [1, 3, 4, 8, 7, 8, 10, 10]
trial_total = [10, 10, 10, 10, 10, 10, 10, 10]

data = np.array([stimulus_intensity, trial_correct, trial_total]).transpose()
param_free = [True, True, False, False]
param_ests = [None, None, 0.0, 0.05]

metrics, options = bf.fitmodel(data, 
                               nafc = 2, 
                               sigmoid_type = "logistic", 
                               param_free = param_free,
                               param_ests = param_ests)

bf.plot_psyfcn(data, options, metrics)

Example_Figure

LegrandNico commented 3 years ago

Thank you for your response, I will try this solution.