Richard Nixon
2002-Jul-01 16:28 UTC
[R] Defining own variance function / quasi-likelihood in a GLM
Hello, I've been looking in the on-line manuals and searching past posts but can't find an answer to this question. I'd like to define my own variance function in a GLM. The function glm(formula, family=quasi(var="var function")) lets me choose from a selection of built in variances, but I want to define my own function for the variance. Is there an S-plus "make.family" type function in R, or some such way of defining your own quasi-likelihoods in terms of the relationship between the mean and the variance? Thanks Richard -- Dr. Richard Nixon MRC Biostatistics Unit, Institute of Public Health, Robinson Way, Cambridge, CB2 2SR http://www.mrc-bsu.cam.ac.uk/personal/richard Tel: +44 (0)1223 330382, Fax: +44 (0)1223 330388 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
ripley@stats.ox.ac.uk
2002-Jul-01 17:05 UTC
[R] Defining own variance function / quasi-likelihood in a GLM
On Mon, 1 Jul 2002, Richard Nixon wrote:> > Hello, > > I've been looking in the on-line manuals and searching past posts but > can't find an answer to this question. > > I'd like to define my own variance function in a GLM. > The function glm(formula, family=quasi(var="var function")) > lets me choose from a selection of built in variances, but I want to > define my own function for the variance. > > Is there an S-plus "make.family" type function in R, or some such way of > defining your own quasi-likelihoods in terms of the relationship between the > mean and the variance?You can easily extend the switch statement in quasi(). Note that R specifies a family slightly differently from S. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._