Thanks to Duncan and Bill for very helpful tips.
On Fri, Aug 28, 2020 at 11:38 AM William Dunlap wrote:
> Note that neither call to glm in your myglm function really works -
> the first one is using the 'weights' object from the global
> environment, not the weights argument. E.g., in the fresh
Note that neither call to glm in your myglm function really works -
the first one is using the 'weights' object from the global
environment, not the weights argument. E.g., in the fresh R session,
where I avoid making unneeded assignments and use fixed x and y for
repeatability,
> n <- 16
> d
This came up recently in a discussion of lm() on the R-devel list. I'd
assume the same issue applies to glm.
The problem is that the argument to weights is evaluated in the same way
as arguments in the formula: first in data, then in the environment of
the formula. The latter will eventuall
Dear R-help:
I am writing a function based on glm and would like some variations of
weights. In the code below, I couldn't understand why the second glm
function fails and don't know how to fix it:
Error in eval(extras, data, env) : object 'newweights' not found
Calls: print ... eval -> -> mode
4 matches
Mail list logo