I have the following problem. Consider a `classical' test which works for k .ge. 2 samples. Possible interfaces are e.g. xxx.test(x, g) x ... all data, g ... corresponding groups xxx.test(x1, ..., xk) xxx.test(list(x1, ..., xk)) etc etc. Clearly, the first and the second one are nice, but cannot be combined without making `g' (i.e., `group') a named argument. Hence, in e.g. my current version of kruskal.test() I've combined the first (by compatibility with S-PLUS) and third interfaces. Perhaps this is not optimal, though ... What I'd like to do now is to extend var.test() as follows. * With one data arg, perform a chisq-based test for a certain value of the variance, as specified by an optional var argument * With two data args, do the usual F test * With more than two data args, perform some test for the homogeneity of variances, as specified by an optional method (default "Bartlett") arg. What is the right interface then? Should we have var.test(x, y = NULL, ..., group = NULL, alternative = "two.sided", conf.level = 0.95, var = 1, ratio = 1, method = "Bartlett") ??? If so, should the interface to kruskal.test be changed accordingly? Please advise me here. -k =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Kurt Hornik <hornik@ci.tuwien.ac.at> writes:> > I have the following problem. Consider a `classical' test which works > for k .ge. 2 samples. Possible interfaces are e.g. > > xxx.test(x, g) x ... all data, g ... corresponding groups > xxx.test(x1, ..., xk) > xxx.test(list(x1, ..., xk)) > > etc etc. > > Clearly, the first and the second one are nice, but cannot be combined > without making `g' (i.e., `group') a named argument.I'm sort of beginning to like the list(...) construction. It might also allow one to assign meaningful tags to the variables (as in kruskal.test(list(bp.males=dataframe$bp[dataframe$sex==1],bp.females=....)> var.test(x, y = NULL, ..., group = NULL, alternative = "two.sided", > conf.level = 0.95, var = 1, ratio = 1, method = "Bartlett") > > ??? > > If so, should the interface to kruskal.test be changed accordingly? > > Please advise me here. >You won't gain much above (pardon the sketchy code) var.test(x,g = NULL,..etc..) if (is.list(x)) g<-... x<-c(x) if( g == NULL) ng<-1 else ng<-length(unique(g[nonmiss])) if (ng == 1) .. else if (ng == 2) .. else .. I'd say that the real issue is whether t.test should be supplied with a group= parameter? -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-