FAQ
Hello Fellow R
Users,I have
spent the last week trying to find a work around to this problem and I can't
seem to solve it. I simply want to plot my GEE model result with 95% confidence
bands.

I am using the geepack package to run a basic GEE model involving
nestling weights, to a Gaussian distribution, with "exchangeable" error
structure. I am examining how nestling weight varies as a function of distance
from a plot boundary.

The response variable (WEIGHT) and the explanatory
variable (DISTANCE) are both continuous. The clustering factor (MOTHER) is
entered into my model to account for similarity of nestlings from the same nest
produced by a given mother.

My simplified code is
as follows:

summary(model1<-geeglm(WEIGHT~DISTANCE,
id=MOTHER,data=df,corstr="exchangeable")))
#I've included part of the
model output
here

<Coefficients:
<
Estimate Std.err
Wald Pr(>|W|)

<(Intercept) 15.8702 0.4416
1291.8 < 2e-16 ***
<Initiationdate -0.0664
0.0157 17.9 2.4e-05
***
<
<Estimated Scale
Parameters:
<
< Estimate
Std.err
<(Intercept) 5.78
2.46

plot(df\$DISTANCE,df\$WEIGHT)

abline(model1)

x<-seq(min(df\$DISTANCE),max(df\$DISTANCE),l=1000)

y<-predict(model1,data.frame(DISTANCE=x))

Everything is fine up until this last line of code, when I get the following
error message:

"Warning message:
In predict.lm(object, newdata, se.fit, scale = 1, type = ifelse(type == :
calling predict.lm(<fake-lm-object>) ..."

This isn't a geepack problem because I get the same error message using the gee
package as well. The above simplified code is how I usually create and plot 95%
CI bands for a linear model, followed by:

matlines(x,y)

I have read through the package PDFs and searched the web and archives of
various listservs without success. Any help would be most appreciative. Seems
like there should be a simple work-around. Thank you,
Jason

## Search Discussions

• at Oct 17, 2011 at 3:36 pm ⇧ Hi Jason,

I would go for Zelig package to get simulated values and confidence
intervals. It can handle gee model.

Shige
On Mon, Oct 17, 2011 at 9:38 AM, JASON M. HILL wrote:
Hello Fellow R
Users,I have
spent the last week trying to find a work around to this problem and I can't
seem to solve it. I simply want to plot my GEE model result with 95% confidence
bands.

I am using the geepack package to run a basic GEE model involving
nestling weights, to a Gaussian distribution, with "exchangeable" error
structure. I am examining how nestling weight varies as a function of distance
from a plot boundary.

The response variable (WEIGHT) and the explanatory
variable (DISTANCE) are both continuous. The clustering factor (MOTHER) is
entered into my model to account for similarity of nestlings from the same nest
produced by a given mother.

My simplified code is
as follows:

summary(model1<-geeglm(WEIGHT~DISTANCE,
id=MOTHER,dataß,corstr="exchangeable")))
#I've included part of the
model output
here

<Coefficients:
<
? ? ? ? ? ? ? ? ?Estimate Std.err
?Wald ? ? ? ? Pr(>|W|)

<(Intercept) ? ? 15.8702 ?0.4416
1291.8 ?< 2e-16 ***
<Initiationdate ?-0.0664
?0.0157 ? 17.9 ? ? ? ? ?2.4e-05
***
<
<Estimated Scale
Parameters:
<
< ? ? ? ? ? ?Estimate
Std.err
<(Intercept) ? ? 5.78
?2.46

plot(df\$DISTANCE,df\$WEIGHT)

abline(model1)

x<-seq(min(df\$DISTANCE),max(df\$DISTANCE),l00)

y<-predict(model1,data.frame(DISTANCE=x))

Everything is fine up until this last line of code, when I get the following
error message:

"Warning message:
In predict.lm(object, newdata, se.fit, scale = 1, type = ifelse(type == ?:
?calling predict.lm(<fake-lm-object>) ..."

This isn't a geepack problem because I get the same error message using the gee
package as well. The above simplified code is how I usually create and plot 95%
CI bands for a linear model, followed by:

matlines(x,y)

I have read through the package PDFs and searched the web and archives of
various listservs without success. Any help would be most appreciative. Seems
like there should be a simple work-around. Thank you,
Jason

? ? ? ?[[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
and provide commented, minimal, self-contained, reproducible code.
• at Oct 18, 2011 at 2:36 am ⇧ Thank you Shige,I got the Zelig package to work for me. For anyone who cares,
here's the code:
library(Zelig)order(df\$WEIGHT)z.out<- zelig(WEIGHT~DISTANCE, model =
"normal.gee",id = "MOTHER", data = df,corstr =
"exchangeable")summary(z.out)date.range<-0:51 # sequence of values over the
range of DISTANCEx.high <- setx(z.out,DISTANCE=date.range)x.low <-
setx(z.out,DISTANCE=date.range)s.out <- sim(z.out, x = x.low, x1 =
x.high)summary(s.out)plot.ci(s.out,col="RED")abline(z.out)
The "plot.ci" function produces a plot without confidence bands, per se. The
resulting figure has a vertical confidence bar at every value of X. It's kind
of a cool effect and just as good, I guess, as the standard regression line
plot with confidence bands.
Thanks again Shige for pointing me in the right direction.cheers,Jason
On Mon, Oct 17, 2011 11:36 AM, Shige Song wrote:
>
Hi Jason,
I would go for Zelig package to get simulated values and confidence
intervals. It can handle gee model.

Shige
On Mon, Oct 17, 2011 at 9:38 AM, JASON M. HILL wrote:
Hello Fellow R
Users,I have
spent the last week trying to find a work around to this problem and I can't
seem to solve it. I simply want to plot my GEE model result with 95%
confidence
bands.

I am using the geepack package to run a basic GEE model involving
nestling weights, to a Gaussian distribution, with
"exchangeable" error
structure. I am examining how nestling weight varies as a function of distance
from a plot boundary.

The response variable (WEIGHT) and the explanatory
variable (DISTANCE) are both continuous. The clustering factor
(MOTHER) is
entered into my model to account for similarity of nestlings from the same nest
produced by a given mother.

My simplified code is
as follows:

summary(model1<-geeglm(WEIGHT~DISTANCE,
id=MOTHER,data=df,corstr="exchangeable")
#I've included part of the
model output
here

<Coefficients:
<
Estimate Std.err
Wald Pr(>|W|)

<(Intercept) 15.8702 0.4416
1291.8 < 2e-16 ***
<Initiationdate -0.0664
0.0157 17.9 2.4e-05
***
<
<Estimated Scale
Parameters:
<
< Estimate
Std.err
<(Intercept) 5.78
2.46

plot(df\$DISTANCE,df\$WEIGHT)

abline(model1)

x<-seq(min(df\$DISTANCE),max(df\$DISTANCE),l=1000)

y<-predict(model1,data.frame(DISTANCE=x)

Everything is fine up until this last line of code, when I get the following
error message:

"Warning message:
In predict.lm(object, newdata, se.fit, scale = 1, type = ifelse(type == :
calling predict.lm(<fake-lm-object>) ..."

This isn't a geepack problem because I get the same error message using the
gee
package as well. The above simplified code is how I usually create and plot
95%
CI bands for a linear model, followed by:

matlines(x,y)

I have read through the package PDFs and searched the web and archives of
various listservs without success. Any help would be most appreciative. Seems
like there should be a simple work-around. Thank you,
Jason

[[alternative HTML version deleted]]

______________________________________________
r-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
and provide commented, minimal, self-contained, reproducible code.
'Nothing in biology makes sense, except in the light of evolution'
--Theodosius Dobzhansky--

Jason Hill
http://www.coopunits.org/Pennsylvania/People/Jason_Hill/index.html
PA Cooperative Fish and Wildlife Research Unit
221 Forest Resources Building
University Park, PA 16802-4705
Office: 814-865-0772
Fax: 814-863-4710
Ecology Program - PhD Candidate
Pennsylvania State University
School of Forest Resources

## Related Discussions

Discussion Overview
 group r-help categories r posted Oct 17, '11 at 1:38p active Oct 18, '11 at 2:36a posts 3 users 2 website r-project.org irc #r

### 2 users in discussion

Content

People

Support

Translate

site design / logo © 2022 Grokbase