0

Could you provide me with some guides how to write a user-specified link function that I can then use in glm()?

To be more specific, I'd like to perform the logistic regression with the 5-parameter logistic function but glm offers only the traditional 2-parameter logistic function. Here's a formula of the function I'd like to use.

Prradep
  • 5,506
  • 5
  • 43
  • 84
kozooh
  • 2,035
  • 1
  • 21
  • 31
  • http://stackoverflow.com/questions/15931403/modify-glm-function-to-adopt-user-specified-link-function-in-r – Vlo Aug 05 '15 at 19:24
  • (1) Can you say a little bit more about your response variable? If it's binary or binomial, you're going to have to constrain the parameter space so that 0 < lower asymptote < upper asymptote < 1. (2) I think you're going to do have to do this as a nonlinear regression/general maximum-likelihood fit; even if link functions allow user-specified parameters, they need to be set *outside* of the `glm()` fit. – Ben Bolker Aug 05 '15 at 19:34
  • (1) Yes, it's a binary function. (2) Sorry but I'm quite new to R.... Do you mean using `nls()` instead of `glm()`? – kozooh Aug 05 '15 at 20:17
  • `nls()` only does least-squares. For a logistic regression/binary response you're probably going to have to something *approximately* like `library("bbmle"); mle2(y~dbinom(size=1,prob=A+(K-A)/(C+Q*exp(-B*x))^(1/nu),data=...,start=list(A=...,B=...,...))`. But be warned that this is likely to be a fairly challenging numerical problem, requiring a large data set and good starting values. You may need to do something to bound the parameters such that the response stays in (0,1). If you edit to provide a reproducible example and show some effort to get started the question might get reopened ... – Ben Bolker Aug 05 '15 at 20:53

0 Answers0