Tim,

You might use try which will catch the error and allow you to handle what
happens.
Usually something like this works to get parameter estimates

for (i in 1:1000){
fit<-try(lm(y~x,dataset))
results<- ifelse(class(fit)=="try-error", NA, fit$coefficients)
}

HTH
Mike



On Sun, May 4, 2008 at 11:52 PM, Tim Reid <treid@utas.edu.au> wrote:

> Hi all,
>
> I am currently running some R code bootstrapping some data and
> running GLMs on the sampled data sets. Occasionally the data sets
> that are sampled cause errors in the GLM (usually with the message
> "Error in solve.default(as.matrix(fit$hessian)) "). Currently, if
> this occurs, the program stops and exits. I would like to know if
> there is a way I can instead of having the program terminate, to get
> the program to step through that problem and continue further on in
> the program (i.e. getting it to re-sample the data again).
>
> Any help would be much appreciated,
> tim.
>
>
> -----------------------------------------------------------------------
> Tim Reid | PhD Candidate
>
> Quantitative Marine Sciences/ Antarctic Wildlife Research Unit
> School of Zoology
> University of Tasmania
> PO Box 252-05
> Hobart Tasmania 7001
> Australia
>
> phone:  +61 3 6226 2594 | mob: 0404 668 363
> www.zoo.utas.edu.au/awru/
>
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>

	[[alternative HTML version deleted]]

