bitmap(file='test1.png') plot(x,y, xlab=xlab, ylab=ylab) abline(coef=(lm(y ~ x))$coeff, col='red') ctp<-cor.test(x, y, use='pair', method='pearson') legend('bottomright', c('cor =', as.character(signif(ctp$estimate, digits=4)))) dev.off() (sw1<-shapiro.test(x)) (sw2<-shapiro.test(y)) (cxy<-cor.test(x, y, method=par1)) load(file='createtable') a<-table.start() a<-table.row.start(a) a<-table.element(a,paste('Shapiro Test (', xlab,')',sep=''),3,TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'Statistic W',header=TRUE) a<-table.element(a,'Probability',header=TRUE) a<-table.element(a,'Link',header=TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,signif(sw1$statistic, digits=4)) a<-table.element(a,signif(sw1$p.value, digits=4)) a<-table.element(a,hyperlink('http://en.wikipedia.org/wiki/Shapiro%E2%80%93Wilk_test','Shapiro-Wilk Test','Shapiro-Wilk Test')) a<-table.row.end(a) a<-table.end(a) table.save(a,file='mytable.tab') a<-table.start() a<-table.row.start(a) a<-table.element(a, paste('Shapiro Test (', ylab,')',sep=''),3,TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'Statistic W',header=TRUE) a<-table.element(a,'probability',header=TRUE) a<-table.element(a,'Link',header=TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,signif(sw2$statistic, digits=4)) a<-table.element(a,signif(sw2$p.value, digits=4)) a<-table.element(a,hyperlink('http://en.wikipedia.org/wiki/Shapiro%E2%80%93Wilk_test','Shapiro-Wilk Test','Shapiro-Wilk Test')) a<-table.row.end(a) a<-table.end(a) table.save(a,file='mytable1.tab') a<-table.start() a<-table.row.start(a) a<-table.element(a,'Correlation Test X-Y',6,TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'Statistic',header=TRUE) a<-table.element(a,'Value',header=TRUE) a<-table.element(a,'probability',header=TRUE) a<-table.element(a,'Method',header=TRUE) a<-table.element(a,'alternative',header=TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,names(cxy$estimate)) a<-table.element(a,signif(cxy$estimate, digits=4)) a<-table.element(a,signif(cxy$p.value, digits=4)) a<-table.element(a,cxy$method) a<-table.element(a,cxy$alternative) a<-table.row.end(a) a<-table.end(a) table.save(a,file='mytable2.tab')
|