s-news
[Top] [All Lists]

Re: (scoping in glm)

To: "Coppenolle, Hans" <Hans.Coppenolle@AGR.KULEUVEN.AC.BE>
Subject: Re: (scoping in glm)
From: Prof Brian Ripley <ripley@stats.ox.ac.uk>
Date: Fri, 27 Jul 2001 09:47:03 +0100 (BST)
Cc: internet <s-news@lists.biostat.wustl.edu>
In-reply-to: <D8BDEB41755B704690C96ADD78B0E1F412C854@agr-srv-24.agr.ad10.intern.kuleuven.ac.be>
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


<Prev in Thread] Current Thread [Next in Thread>
  • [no subject], Coppenolle, Hans
    • Re: (scoping in glm), Prof Brian Ripley <=