[R] Fitting a cumulative gaussian
Dear R-Experts, I was wondering how to fit a cumulative gaussian to a set of empirical data using R. On the R website as well as in the mail archives, I found a lot of help on how to fit a normal density function to empirical data, but unfortunately no advice on how to obtain reasonable estimates of m and sd for a gaussian ogive function. Specifically, I have data from a psychometric function relating the frequency a subject's binary response (stimulus present / absent) to the strength of a physical stimulus. Such data is often modeled using a cumulative gaussian function. I have tried to implement such a fitting algorithm in R, but unfortunately, I was not successful. Maybe anyone on the list already coded a script for such purposes or could help me otherwise??? Thanks in advance, Matthias __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fitting a cumulative gaussian
Gamer, Matthias gamer at uni-mainz.de writes: Specifically, I have data from a psychometric function relating the frequency a subject's binary response (stimulus present / absent) to the strength of a physical stimulus. Such data is often modeled using a cumulative gaussian function. Well, more often by a logistic function, and there are quite a few tools powerful for doings this around, for example glm, or lmer/lme4, glmmPQL/MASS, glmmML/glmmML . The latter three are the tools of choice when you have within subject repeats, as it's standard in psychophysics. See http://finzi.psych.upenn.edu/R/Rhelp02a/archive/33737.html for a comparison. If you really want a cumlative gaussian, you can misuse drfit/drfit, which is primarily for dose/response curves and ld50 determination. I think there is a fitdistr/MASS example around (somewhere in the budworms chapter), but I don't have the book at hand currently. Dieter __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fitting a cumulative gaussian
If the data asymptote at 0 and 1, then you can use glm with the binomial family with either the logistic or probit links. If the data are from an n-alternative forced choice procedure or if the data do not asymptote at 0 and 1 for some reason or other, then you need to try other procedures. Two possibilities are to use the PsychoFun package available here http://www.kyb.tuebingen.mpg.de/~kuss and described in Kuss, M., F. Jäkel and F.A. Wichmann: Bayesian inference for psychometric functions. Journal of Vision 5(5), 478-492 (2005) or tools from some of Jim Lindsey's packages, described here Yssaad-Fesselier R, Knoblauch K. Modeling psychometric functions in R. Behav Res Methods. 2006 Feb;38(1):28-41. HTH ken Gamer, Matthias gamer at uni-mainz.de writes: Specifically, I have data from a psychometric function relating the frequency a subject's binary response (stimulus present / absent) to the strength of a physical stimulus. Such data is often modeled using a cumulative gaussian function. Well, more often by a logistic function, and there are quite a few tools powerful for doings this around, for example glm, or lmer/lme4, glmmPQL/MASS, glmmML/glmmML . The latter three are the tools of choice when you have within subject repeats, as it's standard in psychophysics. See http://finzi.psych.upenn.edu/R/Rhelp02a/archive/33737.html for a comparison. If you really want a cumlative gaussian, you can misuse drfit/drfit, which is primarily for dose/response curves and ld50 determination. I think there is a fitdistr/MASS example around (somewhere in the budworms chapter), but I don't have the book at hand currently. Dieter [[alternative text/enriched version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.