par1<-as.numeric(par1) par2<-as.numeric(par2) par3<-as.numeric(par3) par4<-as.numeric(par4) par5<-as.numeric(par5) c <- 'NA' csn <- abs(qnorm(par5)) csn2 <- abs(qnorm(par5/2)) z <- (par3 - par4) / (sqrt(par2/par1)) p <- 1-pnorm(z) if (par3 == par4) { conclusion <- 'Error: the null hypothesis and sample mean must not be equal.' conclusion2 <- conclusion } else { if (p < par5/2) { conclusion2 <- 'Reject the null hypothesis' } else { conclusion2 <- 'Do not reject the null hypothesis' } } if (p < par5) { conclusion <- 'Reject the null hypothesis.' } else { conclusion <- 'Do not reject the null hypothesis.' } p conclusion load(file='createtable') a<-table.start() a<-table.row.start(a) a<-table.element(a,hyperlink('ht_mean_knownvar.htm','Testing Mean with known Variance','learn more about Statistical Hypothesis Testing about the Mean when the Variance is known'),2,TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'sample size',header=TRUE) a<-table.element(a,par1) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'population variance',header=TRUE) a<-table.element(a,par2) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'sample mean',header=TRUE) a<-table.element(a,par3) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'null hypothesis about mean',header=TRUE) a<-table.element(a,par4) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'type I error',header=TRUE) a<-table.element(a,par5) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'Z-value',header=TRUE) a<-table.element(a,z) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'p-value (one-tailed)',header=TRUE) a<-table.element(a,p) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'p-value (two-tailed)',header=TRUE) a<-table.element(a,p*2) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'conclusion for one-tailed test',2,header=TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,conclusion,2) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'conclusion for two-tailed test',2,header=TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,conclusion2,2) a<-table.row.end(a) a<-table.end(a) table.save(a,file='mytable.tab')
|