[R] Help converting a function from S-Plus to R: family$weight

Peter Dunn dunn at usq.edu.au
Fri Aug 12 06:14:09 CEST 2005


Hi all

I am converting an S-Plus function into R.  The S-Plus code
uses some of the glm families, and  family  objects.

The family objects in S-Plus and R have many different
features, for example:

In R:
 > names(Gamma())
  [1] "family"     "link"       "linkfun"    "linkinv"    "variance"
  [6] "dev.resids" "aic"        "mu.eta"     "initialize" "validmu"
[11] "valideta"

In S-Plus:
 > names(Gamma())
[1] "family"     "names"      "link"       "inverse"    "deriv"
[6] "initialize" "variance"   "deviance"   "weight"
 >


My question concerns the variable  weight  in the S-Plus function.
I'm not sure what it is.  (I have searched the S-Plus mailing list
archive, and my "S-Plus for linux 6.1" documentation.)  For almost all
family objects, the weight variable is the same as variance,
just weighted (and the former as a function; the later as an
expression):

 > Gamma()$variance
function(mu)
mu^2
 > Gamma()$weight
expression(w * mu^2.)
 >

The same applies for most families.  So I thought I could determine
what this weight variable was.

But alas--not the inverse,gaussian:

 > inverse.gaussian()$variance
function(mu)
mu^3
 > inverse.gaussian()$weight
expression(w/((sqrt(family$variance(mu)) * family$deriv(mu))^2.))


So:
- can anyone tell me what this expression weight represents?
- why is the inverse.gaussian family different than all others?

Thanks in advance.

P.

My S-Plus version:

 > version
Version 6.2.1  for Linux 2.4.18 : 2003

My R version:

 > version
          _
platform i386-pc-linux-gnu
arch     i386
os       linux-gnu
system   i386, linux-gnu
status
major    2
minor    1.0
year     2005
month    04
day      18
language R
 >


-- 
Dr Peter Dunn  |  Senior Lecturer in Statistics
Faculty of Sciences, University of Southern Queensland
   Web:    http://www.sci.usq.edu.au/staff/dunn
   Email:  dunn <at> usq.edu.au
CRICOS:  QLD 00244B |  NSW 02225M |  VIC 02387D |  WA 02521C




More information about the R-help mailing list