[R] Constructing confidence interval ellipses with R

John Fox j|ox @end|ng |rom mcm@@ter@c@
Tue Jan 25 17:41:19 CET 2022


Dear Paul,

This looks like a version of the question you asked a couple of weeks 
ago. As I explained then, I'm pretty sure that you want concentration 
(i.e., data) ellipses and not confidence ellipses, which pertain to 
parameters (e.g., regression coefficients). Also, the hand-drawn 
concentration contours in your example graph don't look elliptical, so 
I'm not sure that you really want ellipses, but I'll assume that you do.

Since as far as I can see you didn't share your data, here's a similar 
example using the scatterplot() function in the car package:

library("car")
scatterplot(prestige ~ income | type, data=Prestige, ellipse=TRUE, 
smooth=FALSE, regLine=FALSE)

By default, this draws 50% and 95% concentration ellipses assuming 
bivariate normality in each group, but that and other aspects of the 
graph can be customized -- see ?scatterplot.

I hope this helps,
  John

-- 
John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
web: https://socialsciences.mcmaster.ca/jfox/

On 2022-01-24 4:24 p.m., Paul Bernal wrote:
> Dear friends,
> 
> I will be sharing a dataset which has the following columns:
> 1. Scenario
> 2. Day of Transit date
> 3. Canal Ampliado
> 4. Canal Original
> 
> Basically, I need to create a scatter plot diagram, with the Canal Ampliado
> column values in the x-axis, and the Canal Original column values in the
> y-axis, but also, I need to create confidence interval ellipses grouping
> the points on the scatterplot, based on the different scenarios.
> 
> So I need to have in one graph, the scatterplot of Canal Ampliado vs Canal
> Original and then, on the same graph, construct the confidence interval
> ellipses.
> 
> I will attach an image depicting what I need to accomplish, as well as the
> dataset, for your reference.
> 
> Any help and/or guidance will be greatly appreciated.
> 
> Cheers,
> Paul
> 
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.



More information about the R-help mailing list