[R] confidence / prediction ellipse

Bert Gunter gunter.berton at gene.com
Mon Jan 28 00:26:50 CET 2013


All:

Aha! -- The light dawneth, methinks (maybe...)

Giuseppe: I re-read the SAS link you sent and if I have parsed it
correctly, what SAS chooses to call an ellipse for "prediction" -- a
rather idiosyncratic way to describe it, imo -- I believe the rest of
us would call a contour for a population quantile. The key phrase that
indicates this is "It [the elliptical region] also approximates a
region containing a specified percentage of the population. "

So, if I'm right, I believe you just need to use car's data.ellipse() function.

And if I'm wrong, my little corner of the globe remains cloaked in
darkness confusion.

Cheers,
Bert

On Sun, Jan 27, 2013 at 12:43 PM, John Fox <jfox at mcmaster.ca> wrote:
> Dear Giuseppe and Bert,
>
> I also didn't follow what's intended, more or less for the same reasons as
> Bert mentioned, which is why I didn't reply to the initial posting. In the
> car package, confidenceEllipse() draws confidence ellipses for a pair of
> coefficients from a statistical model, and dataEllipse() draws
> bivariate-normal concentration ellipses for the bivariate distribution of
> two variables.
>
> I'm copying to Georges Monette and Michael Friendly, coauthors of these
> functions, in case they have something to add.
>
> I hope that this helps, but I doubt that it does.
>
> John
>
> -----------------------------------------------
> John Fox
> Senator McMaster Professor of Social Statistics
> Department of Sociology
> McMaster University
> Hamilton, Ontario, Canada
>
>
>
>
>> -----Original Message-----
>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
>> On Behalf Of Giuseppe Amatulli
>> Sent: Sunday, January 27, 2013 11:41 AM
>> To: Bert Gunter
>> Cc: r-help at r-project.org
>> Subject: Re: [R] confidence / prediction ellipse
>>
>> Hi,
>> thanks for your replay.
>> My values of a and b are respectively:
>> a = observation of an event
>> b = prediction of a model.
>>
>> Therefore i would like to draw the confidence region for predicting a
>> new
>> observation, and according to this
>> http://v8doc.sas.com/sashtml/insight/chap40/sect35.htm the prediction
>> ellipse should be more appropriate.
>>
>> But i'm not able to track back the function
>> radius <- sqrt(dfn * qf(level, dfn, dfd))
>> in order to change it and draw a prediction ellipses.
>>
>> Regards
>> Giuseppe
>>
>>
>>
>>
>> On 26 January 2013 17:19, Bert Gunter <gunter.berton at gene.com> wrote:
>>
>> > Well, I'd guess you have to first define what you mean by "prediction
>> > ellipse," as the confidence ellipses are for the bivariate
>> > distribution of 2 parameter estimates -- as I understand it --
>> > whereas predictions depend on the covariate values and are for a
>> > single response value (unless you have fitted multiple responses, I
>> > suppose).
>> >
>> > -- Bert
>> >
>> > On Sat, Jan 26, 2013 at 1:12 PM, Giuseppe Amatulli
>> > <giuseppe.amatulli at gmail.com> wrote:
>> > > Hi,
>> > > I'm using the R library(car) to draw confidence/prediction ellipses
>> in a
>> > > scatterplot.
>> > > >From what i understood  the ellipse() function return an ellipse
>> based
>> > > parameters:  shape, center,  radius .
>> > > If i read  dataEllipse() function i can see how these parameters are
>> > > calculated for a confidence ellipse.
>> > >
>> > > ibrary(car)
>> > >
>> > > a=c(12,12,4,5,63,63,23)
>> > > b=c(13,15,7,10,73,83,43)
>> > >
>> > > v <- cov.trob(cbind(a, b))
>> > > shape <- v$cov
>> > > center <- v$center
>> > >
>> > > radius <- sqrt(2 * qf(0.95, 2, length(a) - 1))   # radius <-
>> sqrt(dfn *
>> > > qf(level, dfn, dfd))
>> > >
>> > > conf.elip = ellipse(center, shape, radius,draw = F)
>> > > plot(conf.elip, type='l')
>> > > points(a,b)
>> > >
>> > > My question is how I can calculate shape, center and radius  to
>> obtain a
>> > > prediction ellipses rather than a confidence ellipse?
>> > > Thanks in Advance
>> > > Giuseppe
>> > >
>> > > --
>> > > Giuseppe Amatulli
>> > > Web: www.spatial-ecology.net
>> > >
>> > >         [[alternative HTML version deleted]]
>> > >
>> > > ______________________________________________
>> > > 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
>> >
>>
>>
>>
>> --
>> Giuseppe Amatulli
>> Web: www.spatial-ecology.net
>>
>>       [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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