help with predict and plotting confidence intervals

help with predict and plotting confidence intervals

Dear R help,

This seems to be a commonly asked question and I am able to run examples that have been proposed, but I can't seems to get this to work with my own data. Reproducible code is below. Thank you in advance for any help you can provide.

The main problem is that I can not get the confidence lines to plot correctly.
The secondary problem is that predict is not able to find my object when
I include a model object.

# error ' object "logA" not found'
# I am not sure why object is not found, I assume this has to do with
# the way I added the transformed variables to the dataframe
pp <- predict(wt.mod, int = "p", newdata=pred.frame)

Re: help with predict and plotting confidence intervals

On Mar 12, 2009, at 11:14 AM, Michael Denslow wrote:

>
> Dear R help,
>
> This seems to be a commonly asked question and I am able to run
> examples that have been proposed, but I can't seems to get this to
> work with my own data. Reproducible code is below. Thank you in
> advance for any help you can provide.

I suspect you omitted the actual call that produced this error. I
suspect it was something along the lines of:
> predwt <- predict(wt.mod, newdata=pred.frame)
Error in eval(expr, envir, enclos) : object "logA" not found
>
> # I am not sure why object is not found, I assume this has to do with
> # the way I added the transformed variables to the dataframe

Because you didn't give the arguments the same name(s) as were used in
the model formula.

Lines? What lines? If predict does not find a newdata object that
satisfies its requirements, it uses the original data.

>
> # I am not sure how to get the lines to draw correctly here
> matlines(pred.frame$a,pp, lty=c(1,2,2),col="black")
>
The x values are your sequence whereas the y values are in the
sequence from the original data. They are not correctly associated
with each other.