Claus Dethlefsen / Region Nordjylland
2010-Jul-15 12:59 UTC
[R] Problem with offset (Glm or glmD) in Design library
Dear List
My question relates to the rms (or Design) package. I have modified the example
from help(Glm) to include an offset argument. It works with "glm" but
"Glm" gives the error
Error in if (!length(fname) || !any(fname == zname)) { :
missing value where TRUE/FALSE needed
# -- begin example
library(rms)
of <- 100:92
counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
f <- glm(counts ~ outcome + treatment, family=poisson(),offset=of)
f
anova(f)
summary(f)
f <- Glm(counts ~ outcome + treatment, family=poisson(),offset=of)
# -- end example
The same error occurs using glmD from the Design package.
I use R version 2.11.1 for Windows and have installed the "rms"
package together with Design and Hmisc.
Is this a bug or am I missing something?
Best regards,
Claus
----------------------------------------
Claus Dethlefsen, MSc, PhD
Biostatistician at Center for Cardiovascular Research
Aalborg Hospital, Aarhus University Hospital, Denmark
Frank E Harrell Jr
2010-Jul-15 20:08 UTC
[R] Problem with offset (Glm or glmD) in Design library
On 07/15/2010 07:59 AM, Claus Dethlefsen / Region Nordjylland wrote:> Dear List > > My question relates to the rms (or Design) package. I have modified > the example from help(Glm) to include an offset argument. It works > with "glm" but "Glm" gives the error > > Error in if (!length(fname) || !any(fname == zname)) { : missing > value where TRUE/FALSE needed > > > # -- begin example library(rms) of<- 100:92 > > counts<- c(18,17,15,20,10,20,25,13,12) outcome<- gl(3,1,9) > treatment<- gl(3,3) f<- glm(counts ~ outcome + treatment, > family=poisson(),offset=of) f anova(f) summary(f) f<- Glm(counts ~ > outcome + treatment, family=poisson(),offset=of) # -- end exampleThat should be counts ~ outcome + treatment + offset(of) Frank> > The same error occurs using glmD from the Design package. > > I use R version 2.11.1 for Windows and have installed the "rms" > package together with Design and Hmisc. > > Is this a bug or am I missing something? > > Best regards, > > Claus ---------------------------------------- Claus Dethlefsen, MSc, > PhD Biostatistician at Center for Cardiovascular Research Aalborg > Hospital, Aarhus University Hospital, Denmark > > ______________________________________________ R-help at r-project.org > mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do > read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Frank E Harrell Jr Professor and Chairman School of Medicine Department of Biostatistics Vanderbilt University