On Fri, 27 Jul 2001, Coppenolle, Hans wrote:
> Hello
>
> I am iteratively fitting a glm model
> with weights argument within a function
>
> a simple example
>
> uu_function(datas){
> aa_c(0.2,0.3,0.4,0.5,...)
> for(i in 1:10){
> glm(formula=formula,data=datas,weights=aa)
> aa_c(0.5,0.2,0.8,0.7,...)
> }
(Do you have a problem with your space bar?)
> uu(datas)
>
> the weights argument is however not updated during
> the iteration if the iteration is performed
> within the function...
>
> if outside the function, everything is ok...
> what can be the problem??
Check the scope rules. The simplest way out is to make the weights a
column in the data argument.
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
|