R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > par6 = '5.4' > par5 = '0.05' > par4 = '5.2' > par3 = '5.35' > par2 = '0.36' > par1 = '9' > par1<-as.numeric(par1) > par2<-as.numeric(par2) > par3<-as.numeric(par3) > par4<-as.numeric(par4) > par5<-as.numeric(par5) > par6<-as.numeric(par6) > c <- 'NA' > csn <- abs(qnorm(par5)) > if (par3 == par4) + { + conclusion <- 'Error: the null hypothesis and sample mean must not be equal.' + } > if (par3 > par4) + { + c <- par4 + csn * sqrt(par2) / sqrt(par1) + } > if (par3 < par4) + { + c <- par4 - csn * sqrt(par2) / sqrt(par1) + } > p <- pnorm((c - par6) / (sqrt(par2/par1))) > p [1] 0.740489 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/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,'alternative hypothesis about mean',header=TRUE) > a<-table.element(a,par6) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/ht_mean_knownvar.htm#ex3','Type II Error','example'),header=TRUE) > a<-table.element(a,p) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/1duql1288094588.tab") > > > > proc.time() user system elapsed 0.198 0.029 0.995