[R] Summary.Formula: prmsd and test statistic

From: Eli Kamara <eli.kamara_at_gmail.com>
Date: Sat, 14 May 2011 11:23:30 -0400


Hello,

I'm a new user to R so apologies if this is a basic question, but after scouring the web on information for summary.formula, I still am searching for an answer.

I made a function to analyze my data - I have a categorical variable and three continuous variables. I am analyzing my continuous variables on the basis of my categorical variables.

radioanal <- function(a)
{

#Educational status first - pulling variables from my database. categorical is 13 = Edu. numerical is 48=Kyph, 50=Vert, 53=HL.
a1= a[,c(13,48,50,53)]

#make sure they are in numeric form

a2= transform(a1, Kyph=as.numeric(as.character(Kyph)), Vert=as.numeric(as.character(Vert)), HL=as.numeric(as.character(HL)))

#see boxplots of the individual variables
boxplot(a2$Kyph~a2$Edu, main="Education vs Kyphosis angle",

   xlab="Education", ylab="Kyphosis angle") boxplot(a2$Vert~a2$Edu, main="Education vs # of vertebrae affected",

   xlab="Education", ylab="#of vertebrae affected") boxplot(a2$HL~a2$Edu, main="Education vs %HL",

   xlab="Education", ylab="%HL")

#see distribution of data

d=summary.formula(a2$Edu~a2$Kyph+a2$HL+a2$Vert, method="reverse", overall=T, continuous=5, add=TRUE, test=T)

#perform MANOVA

a3=manova(cbind(Kyph, Vert, HL)~as.factor(Edu), data=a2)

#return results

a4=list("Results of Educational Status MANOVA", print(d),

summary(a3, test="Hotelling-Lawley"), 
summary(a3, test="Roy") ,
summary(a3, test="Pillai"),
summary(a3, test="Wilks"),

summary.aov(a3)
)

print(a4)

}

This function works as is, but I want to add the mean and standard deviation to my table. When I add the following code to line 36 where I print "d" print(d, prmsd=TRUE)

The numbers in my table disappear. When I use the same commands from the command line, the same thing happens. After reading the manual, I think the error might be due to the missing numbers in my database, so I tried adding na.action to my set of commands:

print(summary.formula(a2$Edu~a2$Kyph+a2$HL+a2$Vert, na.action, method="reverse", overall=T, continuous=5, add=TRUE, test=T), prmsd=TRUE)

but then I get the following error:
Error in as.data.frame.default(data, optional = TRUE) :   cannot coerce class '"function"' into a data.frame

Any ideas?

Also, does anyone know what kind of test statistic this function calculates? I compared the F and p values to a manual ANOVA but they were different.



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. Received on Sun 15 May 2011 - 12:52:47 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 15 May 2011 - 14:10:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive