[R] bug in predict.nnet?
tebaldi at rap.ucar.edu
Fri Jul 20 18:36:19 CEST 2001
I may have found a little problem in the code of predict.nnet, that comes
up only if you have NA's in your dataset:
the present code:
z <- matrix(NA, length(keep), nout, dimnames = list(rn,
should be (at least if I understand things correctly)
z <- matrix(NA, length(rn), nout, dimnames = list(rn,
length(rn) maintains the first dimension of the arrray given as
newdata. The present version crashes if length(keep) < length(rn)
i.e. if there are NA's in the dataset.
The subsequent line fills up only the rows corresponding to "keep" with
the predicted values, leaving the rest as NA's.
Also, there is an old bug in the function fda:
m <- dd
assigns the number of columns of dd to m, but in the following line m is
still treated as the "model":
weights <- model.extract(m, weights)
this is of no consequences if you haven't assigned weights to the
observations, but results in erasing them in case you have. Besides, the
line is totally redundant, since that value of "m" is never used
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
More information about the R-help