[R] extending family() objects

Simon.Bond Simon.Bond at mrc-bsu.cam.ac.uk
Fri May 19 17:28:11 CEST 2006


Dear R-help,

The "family" collection of objects is very useful since I can perform some
of the calculations involved when fitting glms easily in a vectorized
manner.

I would like to extend them in the following manner:  I want to supply a
vector of family names such as c("poisson", "gamma","beta"), and an
indexing vector such as c(1,1,1,1,1,1,2,2,2,2,3,3,3,3) ( integer elements
that go up to the length of the vector of family names).  I then want to
construct a new type of family object, new.family,  such that when calling
any of its functions, eg. family.new$variance(mu), it will apply a
different function according to the indexing vector.

I could do this quick-and-dirty using loops but I would really like not to
loose much of the speed obtained through vectorised calculations.

Any ideas?

Thanks

Simon Bond.

-------------------------------------------------------------------------
    /"\
    \ /    ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
     X                           - AGAINST MS ATTACHMENTS
    / \

http://www.gnu.org/philosophy/no-word-attachments.html



More information about the R-help mailing list