[R] MANOVA

John Fox jfox at mcmaster.ca
Sat May 16 20:07:32 CEST 2009


Dear Davide,

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
> Behalf Of Davide Floriello
> Sent: May-16-09 8:51 AM
> To: r-help at r-project.org
> Subject: [R] MANOVA
> 
> 
> Dear Sir,
> I am Davide Floriello and I am a student in mathematics. I have got a
problem
> with the MANOVA commands. I write here what I have done:
> 
> 
> 
> PV <- read.table('PV.txt')
> PV <- data.frame(PV)

The second command is redundant, since read.table() produces a data frame.

> 
> g <- 12
> p <- 2

These commands are unnecessary, since you're not referencing g or p.

> REL <- factor(PV$REL)
> HPV <- factor(PV$HPV)

Whether these commands are necessary depends upon whether REL and HPV are
already factors; if they are character data in the file PV.txt, then by
default read.table() will make factors.

> fit <- manova(as.matrix(PV) ~ REL + HPV + REL:HPV)

This really doesn't make sense: Since REL and HPV are among the variables in
PV (although not necessarily factors), these variables are both on the
left-hand and right-hand side of the model.

> 
> 
> 
> After this last line, an error message is shown:
> 
> 
> 
> Errore in `[[<-.data.frame`(`*tmp*`, i, value = c(17L, 19L, 16L, 14L, 15L,
:
>   replacement has 48 rows, data has 12
> Inoltre: Warning message:
> In storage.mode(v) <- "double" : si h prodotto un NA per coercizione

My guess is that REL and HPV are non-numeric. I wouldn't have to guess if
you had provided the data.

I hope this helps,
 John

> 
> 
> 
> I don't know how to solve this problem.
> 
> Thank you.
> 
> Davide Floriello
> 
> 
> 
> _________________________________________________________________
> 
> 
> 	[[alternative HTML version deleted]]




More information about the R-help mailing list