| Reference | Downloads | Github

FitWeibull: can it produce an error fit?


I have used the builder to create and experiment that uses a method of constant stimuli. From the psychometric data, I wish to find the threshold values for my conditions using the FitWeibull.

However, I also need to know the estimate of the error fit for the data, and I am not sure how to produce that.

Based on this link (!msg/psychopy-users/caESaU69HmY/fRNMVf7uxzYJ), it says that the SEMS takes into account the weight.

Considering that I had 5 nReps, I adjusted the to sems = 5. Is there a command I have to use to produce the error fit?

[On a side note, the experiment produces the following files; .csv, .log, .psydat, and .xlsx
at the moment I am retrieving the data manually from the excel file so the code I am using is very basic, but I will eventually read the excel file using openpyxl]

from psychopy import data

oriChange = [5,10,15,25,35]
Accuracy = [0.65, 0.7, 0.85, 0.95, 0.85]
thresholdVal = 0.80
fit = data.FitWeibull(oriChange, Accuracy, sems=5)
print fit.params
print fit.inverse(thresholdVal)

Thank you!

You can get the sum-squared error of your fit using using fit.ssq in your example.

The sems parameter isn’t quite the weights but the inverse of the weights. The idea is that if you know the s.e.m for each of your means then you can use the inverse of these as weights to your fit. Values with larger sems should contribute less to the fit because you have less confidence in their precision. So weights are 1/sems. In your case, if you have a set with N measurements per point then you want the opposite you want a larger weight for larger N. For now, to use an array of Ns as weights you’d need to provide them as 1/N in the sems argument.

I realise that this is confusing. We should have had an argument simply called weights and you can then choose whether to set the weights as 1/sems or simply N (or something else entirely). In future we’ll probably do that and deprecate the sims argument.

By the way in your particular case, with N=5 at every point, the weight/sems value is irrelevant anyway. All points are being scaled by the same value which won’t affect the fitting at all.

Thank you Jon!

By the way, the documentation only mentions .params .eval .inverse
Is there a list of other things that can be retrieved?

You can query any Python object in code using print(dir(myObject)) or you can go to the source code, linked below.

If your question is answered can you tick solved please?

@Cash, was your problem solved? If yes, please tick solved.

1 Like