Confidence ellipses around categories?

80 views
Skip to first unread message

110greef

unread,
Sep 14, 2015, 6:10:35 PM9/14/15
to FactoMineR users
Hi,

I am new to MDFA and I have trouble getting confidence ellipses (command "plotellipses") around the categories that I obtain with the command "plot.FAMD".

With the command plot.FAMD, I get the graph "FAMD_plot"  that you can find attached. I would like to get a confidence ellipse around each category (T0, T1, T2).. which are different categories for the variable "Time".

To get the ellipses, I use the command:

plotellipses(res, keepvar = 5, axis = c(1, 2), means=TRUE, level = 0.95,
             magnify = 2, cex = 0.5, pch = 20, pch.means=15, type = c("g","p"),
             keepnames = TRUE, namescat = NULL, xlim=xlim, ylim=ylim, lwd=1,
             label="all")

As an output file, I get graphs like "ellipses_plot" that you can also find attached.

What am I doing wrong?

Thank you!

François-Étienne
FAMD_plot.png
Ellipse_plot.png

François Husson

unread,
Sep 15, 2015, 2:07:25 AM9/15/15
to FactoMineR users
Hi,
I don't know what is wrong but the variable 5 is probably a continuous variable and not the variable Time.
You can use this line of code:
plotellipses(res, keepvar = "Time")

I hope it is better.
FH

110greef

unread,
Sep 15, 2015, 2:59:33 PM9/15/15
to FactoMineR users
Thank you for your help, I appreciate. I tried your suggestion, but I ended up with hundreds of small graph like I did before (see the file "Ellipse_plot" attached to the first post).

To do the FAMD and get the ellipses, I run the following commands:

     res <- FAMD(df)

     summary(res)

     plot.FAMD(res, choix="var", axes=c(1,2), habillage=1, invisible="quali")

     plotellipses(res, keepvar = 1, axis = c(1, 2), means=TRUE, level = 0.95,
             magnify = 2, cex = 0.5, pch = 20, pch.means=15, type = c("g","p"),
             keepnames = TRUE, namescat = NULL, xlim=xlim, ylim=ylim, lwd=1,
             label="all")

You can find an example of the input file that I use, attached to this post.

- Why am I getting hundreds of graphs?

- Should I define supplementary data? Some people have suggested this might be the problem. If so, what line of command should I use to indicate to R which supplementary data to use?

Thank you again!

example_forum.xlsx

François Husson

unread,
Sep 16, 2015, 2:03:50 AM9/16/15
to FactoMineR users
Hi,
Maybe you do not import the dataset correctly and the first column, named Sample, is considererd as a variable. 
So can you check that this first column is not in the dataset. Else can you use this line of code :
plotellipses(res, keepvar = "Time")
And if it doesn't work, can you check that the version of FactoMineR is not too old: the version up to date is 1.31.3
FH

110greef

unread,
Sep 23, 2015, 11:36:54 AM9/23/15
to FactoMineR users
Hi,

Thank you again for your quick response. Unfortunately, I tried everything that you suggested and I am still getting the same result.

You can find, attached, that data matrix that I use + the result of the "plot.FAMD" command + the result of the "plotellipses" command. On the "plotellipses" pdf file, the only graph that I would like is the one at the top left corner. Here are the command lines that I use:

Input <- "~/Desktop/R//Data_Matrix_Example.csv"
df <- read.table(Input, header=T, row.names =1, sep=",")
cNAMES <- colnames(df)
rNAMES <- row.names(df)

res <- FAMD(df)
summary(res)

pdf("Plot_FAMD_Data_Example.pdf")
plot.FAMD(res, choix="ind", axes=c(1,2), habillage=1, invisible="quali", lab.ind=FALSE, title="Time:Treat")
dev.off()

pdf("ellipses_Data_Example.pdf")
plotellipses(res, keepvar = 1)
dev.off()

Thank you!
François-Étienne


ellipses_Data_Example.pdf
Data_Matrix_Example.csv
Plot_FAMD_Data_Example.pdf
Reply all
Reply to author
Forward
0 new messages