Description Usage Arguments Details Value References See Also Examples

Fit psychometric functions using either
`glm()`

or `brglm()`

, estimate PSE, JND and the related
confidence intervals, and draw the curve on an existing plot.

1 2 3 | ```
PsychFunction(ps.formula, ps.link, ps.data, x.range = c(NA, NA), ps.x = NA,
ps.lines = F, ps.col = "black", ps.lty = "dashed", ps.lwd = 1,
br = F)
``` |

`ps.formula` |
an object of class “formula”, such as |

`ps.link` |
a link function for the binomial family of error distribution. See 'Details |

`ps.data` |
a data frame including the variables in the model |

`x.range` |
a vector of length two specifying the range for model predictions |

`ps.x` |
optionally, a data frame in which to look for variables with which to predict. See ‘Details’ |

`ps.lines` |
logical. If TRUE, model predictions and confidence intervals of the PSE will be added to an existing plot |

`ps.col` |
color of the lines to be plotted |

`ps.lty` |
line type |

`ps.lwd` |
line width |

`br` |
logical. If TRUE, brglm is used if fitted values are equal to 0 or 1 |

If `lines = TRUE`

, the function draws model predictions on an existing plot.
Only for univariable glm of the type `F(Y) ~ X`

, where X is a continuous
predictor. If `ps.x`

is empty, the new data frame is a vector of length = 1000,
whose range is specified from `x.range`

. Std. Errors and 95% confidence intervals
of the PSE and JND are estimated via Delta Methods, see Faraggi et al. (2003).

a list including the fitted glm (or `brglm`

),
the estimate of PSE and JND and a flag to indicate if `brglm`

was called.

Faraggi, D., Izikson, P., & Reiser, B. (2003). Confidence intervals for the 50 per cent response dose. Statistics in medicine, 22(12), 1977-1988. https://doi.org/10.1002/sim.1368

Moscatelli, A., Mezzetti, M., & Lacquaniti, F. (2012). Modeling psychophysical data at the population-level: The generalized linear mixed model. Journal of Vision, 12(11):26, 1-17. https://doi.org/10.1167/12.11.26

`glm`

for for Generalized Linear Models.
`PsychShape`

for plotting psychometric function of given PSE and JND

1 2 3 4 5 6 7 8 9 10 11 12 | ```
# simulate data from a single participant
datafr.S1 <- PsySimulate(fixeff = c(-7.5, 0.0875), nsubject = 1, constant = TRUE)
#fit a glm (probit link)
model.glm = glm(formula = cbind(Longer, Total - Longer) ~ X,
family = binomial(link = "probit"), data = datafr.S1)
#fit psychometric function single-subject data and draw on existing plot
plot(Longer/Total ~ X, data = datafr.S1)
fit.S1 = PsychFunction(ps.formula = cbind(Longer, Total - Longer) ~ X,
ps.link = "probit", ps.data = datafr.S1,
x.range = c(40, 120), ps.lines = TRUE)
``` |

```
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.