[R] Re: errors in randomization test
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Tue Jul 6 14:13:07 CEST 2004
"CR Bleay, School Biological Sciences" <Colin.Bleay at bristol.ac.uk> writes:
> hello all,
>
> last week i sent an e-mail about dealing with errors thrown up from a
> glm.nb model carried out on multiple random datasets.
>
> every so often a dataset is created which results in the following
> error after a call to glm.nb:
>
> "Error: NA/NaN/Inf in foreign function call (arg 1)
> In addition: Warning message:
> Step size truncated due to divergence"
>
>
> I am at a loss as to how to deal with this.
>
> firstly because the dataset that is generated, although throwing an
> error when the glm.nb model is applied, is a valid dataset. so how do
> i incorporate this dataset in my results (results being descriptive
> stats on the coefficients from the multiple datasets) i.e. shoould
> coefficients be set to zero?
NA, more likely, but it's not easy to say in general. If the algorithm
diverged in a particular way, setting diverged parameters to Inf or
-Inf might be a better idea. It is of course, quite normal that the
MLE does not exist for some data sets, although perhaps the algorithm
might have failed more gracefully.
> secondly, how do i capture and deal with the error. is it possible to
> construct an "if" statement so that "if error, do this, if not
> continue"
>
> lastly, i am unsure as to what characteristics of a dataset would
> result in these errors in the glm.nb?
>
> i would be very grateful for any assistance on this matter. i having
> been staring at code for too many days now and so can't see the wood
> for the trees.
>
Look at try()
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list