2
$\begingroup$

I am trying to fit a cumulative Gaussian distribution function to my data, but I'm not sure how to do this. From what I understand, the fitting process tries to find the mean and standard deviation of the cumulative Gaussian that makes the function best fit my data, right? So I need a way of fitting the CDF while providing initial parameters for the fitting process. My data looks like this

     x       p
1   0.6    0.431
2   0.7    0.479
3   0.8    0.515
4   0.9    0.494
5   1      0.535
6   1.1    0.545
7   1.2    0.538
8   1.3    0.587
9   1.4    0.629

Where p is the average confidence of participants for that $x_i$

I tried using glm() but I don't fully understand glm() or its output, so I don't know if I accomplished what I wanted.

fit <- glm(p ~ x, family = binomial(link=probit), data=dataset)

One example of something in glm() I don't understand is the fitted values:

           1            2            3            4            5            6            7            8            9 
0.4470200681 0.4672569250 0.4875787887 0.5079329624 0.5282664971 0.5485266046 0.5686610686 0.5886186480 0.6083494673 

And another thing, how can I get the mean and standard deviation of my fitted function from the output of glm()? Any help would be much appreciated, I'm very new to R and statistics.

$\endgroup$

closed as unclear what you're asking by whuber Jan 10 at 18:52

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ Because your values of "p" do not sum to 100%, they cannot possibly be chances corresponding to the $x_i$. What are they really? Would they perhaps correspond to chances of the intervals $(-\infty, x_i]$ for the data $x_i$? If so, how were they computed or estimated? $\endgroup$ – whuber Jan 10 at 18:52
  • 1
    $\begingroup$ Sorry, you are right. I don't know why I wrote that. p comes from data that relates to a person's level of confidence in their response. It goes from 1 to 5, and I converted them to percentages (1->10%,2->30%,3->50%, etc) and averaged them for each value of x. So you can consider p to be the person's confidence at that value of x (where 1 would be 100% confident). $\endgroup$ – supercoolusername123123 Jan 10 at 19:00
  • 1
    $\begingroup$ Can you provide better description/reference of 'the model of this someone else' that you are using. Is it right? We can not answer your question without knowing what (and why!) you are doing this fit.... $\endgroup$ – Martijn Weterings Jan 10 at 20:34
  • 1
    $\begingroup$ physiology.org/doi/pdf/10.1152/jn.00318.2015 steps are described at the end of the paper in a flowchart $\endgroup$ – supercoolusername123123 Jan 10 at 20:39
  • 1
    $\begingroup$ For each of the nine x values you can report the number of people that answered 1, 2, 3, 4 and 5. (which gives 45 numbers). Then you can fit a model for these counts which will be a 1 parameter for the dispersion of the perceived stimuli (the Gaussian distribution) and 4 parameters for decision boundaries. If you have sufficient counts then you can fit this using a minimization of the chi-squared statistic. (possibly you could do this with the simpler 'standard' glm as well, by coding your data as 4 binary decisions or making the decision a sum of 5 coin flips instead of a binary decision).... $\endgroup$ – Martijn Weterings Jan 10 at 21:25