[R] LOESS confidence interval

Bert Gunter gunter.berton at gene.com
Tue Mar 6 20:17:14 CET 2012


As I have seen no response  to your post ....

1. I am in no sense an expert on loess, so caveat emptor.

2. AFAICS, you just need to read the seq() Help file carefully.  I do
not know how to tell you how to use seq() more clearly than it already
does, and so will not attempt to do so. You might get a more useful
response if you showed us the actual call that you used and the error
message you received, so that we would have some clue about what you
don't get.

3. You also need to read the Help file for predict .loess more
carefully and note that the newdata argument must be a data.frame, not
just a vector, which is what seq() will give you.

In sum, to paraphrase a comment Brian Ripley made here recently, the
first place to look(and typically the last you'll need, in my
experience) for help in R are the R Help docs. I am somewhat
unsympathetic to protestations that online posts and resources failed
to provide needed information when this has apparently not yet been
done.

Finally, back to (1) above. Note that there is no confint method for
loess in R: it is an algorithm, and AFAIK, there is no good way to
generate reliable CI's for its predictions other than by
bootstrapping. And even that is questionable. Whence just using, say,
2 or 3 se envelopes to give some sort of notion of uncertainty. Again,
a real expert may give you better advice.

Incidentally, you may also wish to have a look at the locfit package
for local smoothing. It has additional flexibility and capabilities
beyond loess() .

Cheers,
Bert

On Tue, Mar 6, 2012 at 8:57 AM,  <F.Hassan at lse.ac.uk> wrote:
> Dear all,
>
>
>
> I'm trying to construct confidence intervals for a LOWESS estimation (by not using bootstrapping).
>
>
>
> I have checked previous posts and other material online and I understand that the main procedure is:
>
>
>
> my.count<- seq(...)
>
> fit<- loess (y ~ x, data=z)
>
> pred<- pred(fit, my.count, se=TRUE)
>
>
>
> and then the plotting.
>
> However, it's not working; as confidence intervals I get meaningless dashed lines with no reference to the underlying loess estimation.
>
>
>
> I think that my main problem is with the seq command, whose role and function I don't really get.
>
>
>
> My (x;y) space refer to (income; price) across countries.
>
>
>
> A previous thread was mentioning that the variables on the X-axis should be equi-spaced; obviously in my case they are not. Is that the problem? If yes, how can I fix it?
>
>
>
> Can anyone help?
>
>
>
> Many thanks,
>
>
>
> fadi
>
>
> Please access the attached hyperlink for an important electronic communications disclaimer: http://lse.ac.uk/emailDisclaimer
>
> ______________________________________________
> 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list