[R] Shafer's MIX: Query on code

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Tue Apr 29 16:19:57 CEST 2003


Thanks to Fernando Tusell and especially to Brian Ripley for
their work on 'mix', leading to an apparently good package
mow available on CRAN.

Going through the R code for the function prelim.mix, I am
wondering why the following method of calculation is used
at one point:

  umd <- as.integer(round(exp(cumsum(log(d)))))

(d is a vector containing, in effect, the numbers of levels of
the factors in col1, col2, ... of the categorical variables.
Therefore umd is a vector containing the numbers of possible
combinations of factor levels in col1, col1&col2, ... )

But why not do it as

  umd <- as.integer(cumprod(d))

?? [It can't be that this number could go out or range, since
that would be equally true of exp(cumsum(log(d)))) ]

With thanks, and best wishes to all,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 29-Apr-03                                       Time: 15:19:57
------------------------------ XFMail ------------------------------



More information about the R-help mailing list