Dear all,
I?m specifying the fisher.exact test for use with summary.formula as follows:
u<-function(a,b){
j<-fisher.test(a)
p<-list(P=j$p.value,stat=NA,df=NA,testname=j$method,statname="")
return(p)
}
However I?m also required to specify stat & df. However this doesnt apply to
the fisher test. I?ve tried specifying them as NA and "" without
success-throws either a blank or an error msg trying to round a non-numeric
value respectively.
reproducible example:
ex<-pbc
summary(trt~sex+ascites,data=ex,test=T,method="reverse")
summary(trt~sex+ascites,data=ex,test=T,method="reverse",catTest=u)
The closest I get is
u<-function(a,b){
j<-fisher.test(a)
p<-list(P=j$p.value,stat=1,df=1,testname=j$method,statname="")
return(p)
}
However then I manually have to edit the output. Is there a smart way of doing
this?
//M
> The closest I get is > > > u<-function(a,b){ > > j<-fisher.test(a) > p<-list(P=j$p.value,stat=1,df=1,testname=j$method,statname="") > return(p) > > } > > However then I manually have to edit the output. Is there a smart way of doing this?You're not explaining what the output is and what you are doing when you 'manually have to edit' it. Does the prtest argument help when you actually use the 'print' function around your summary.formula object? I think that's how I solve it. prtest: a vector of test statistic components to print if ?test=TRUE? was in effect when ?summary.formula? was called. Defaults to printing all components. Specify ?prtest=FALSE? or ?prtest="none"? to not print any tests. This applies to ?print?, ?latex?, and ?plot? methods for ?method='reverse'?.