Fitting sigmoid data then determining value of x when y = 50%

5 views (last 30 days)
Hi there,
Psychology PhD student who is attempting data analysis on MATLAB for the first time.
If I explain what I need to do:
(i): I need to fit a sigmoid curve to my data, via the curve fitting tool, if possible
(ii): I then want to find the value for x when y is 50%
Now, I've attempted to fit a sigmoid curve via the curve fitting tool by inputting the formula for it. It has given me some sort of y = mx + c (screen shot attached). Where have I gone wrong and, how do I acheive what I am trying to do?
Best wishes,
Matthew A

Answers (1)

Cris LaPierre
Cris LaPierre on 28 Jul 2020
Edited: Cris LaPierre on 28 Jul 2020
Sigmoid models typically return a probability, and the 50% response corresponds to x=0. Therefore, you need to modify your equation a little. I elected to use the logistic function found here.
(1./(1+a*exp(-b*(x-450))))*100
Here, I've estimated that the X value of the 50% response is 450. Since the equation is designed to return a value between 0 and 1, I've multiplied it by 100 to make it go from 0-100.
In this case, I would likely incorporate the 50% point into the model and have it be a result of the fit.
(1./(1+a*exp(-b*(x-x50))))*100
However, this doesn't 'just work' as is. I had to modify the fit options to get it to give a decent result. This means you would have to know something about the expected values. Here's how I modified it.
To reduce the number of parameters estimated from the data, I set c=1.
  5 Comments
Cris LaPierre
Cris LaPierre on 29 Jul 2020
Edited: Cris LaPierre on 29 Jul 2020
Ideally, you can find a range that works for everyone. I started with 200-600, but it didn't fit the curve until I increased the lower limit to 300 for the subject you show. The biggest problem is that there are so few data points.
You might have more success using fminsearch, where you can define your own cost function. My suggestion would be to research what techniques others in your field have used in their publications. You will likely find fit equations and cost functions that, at the least, are generally accepted and understood by the community.
Matthew Hopkins
Matthew Hopkins on 29 Jul 2020
Hi there,
Thanks for that. The main methods they describe is either fitting a regression line and calculating that, or using the sigmodial function
Best wishes,
MAtthew A

Sign in to comment.

Categories

Find more on Psychology in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!