R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-bit) 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. > par8 = '50' > par7 = '0.50' > par6 = '0.50' > par5 = '0.90' > par4 = '0.10' > par3 = '0.02' > par2 = '0.03' > par1 = '0.05' > par8 <- '50' > par7 <- '0.50' > par6 <- '0.50' > par5 <- '0.90' > par4 <- '0.10' > par3 <- '0.02' > par2 <- '0.03' > par1 <- '0.05' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., (2012), Reproduction of Table 7.1 from Saunders et al. in Methoden en technieken van onderzoek, 4e editie (v1.0.2) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_saundersetal71.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > # > par1 <- as.numeric(par1) > par2 <- as.numeric(par2) > par3 <- as.numeric(par3) > par4 <- as.numeric(par4) > par5 <- as.numeric(par5) > par6 <- as.numeric(par6) > par7 <- as.numeric(par7) > par8 <- as.numeric(par8) > confidence <- par5 > proportion <- par6 > power <- par7 > userpopsize <- par8 > > #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/rcomp/createtable") > > compsize <- function(population,confidence,proportion,marginoferror,power) + { + par22 <- marginoferror*marginoferror + z <- abs(qnorm((1-confidence)/2)) + abs(qnorm(1-power)) + dum <- z*z * proportion*(1-proportion) + size <- round(population * dum / (dum + (population-1) * par22)) + return(size) + } > comprow <- function(population, confidence, proportion, marginoferror1, marginoferror2, marginoferror3, marginoferror4, power) + { + population <- as.integer(population) #this prevents scientific notation + row <- '' + row<-table.row.start(row) + row<-table.element(row,population,header=TRUE) + row<-table.element(row, compsize(population, confidence, proportion, marginoferror1, power)) + row<-table.element(row, compsize(population, confidence, proportion, marginoferror2, power)) + row<-table.element(row, compsize(population, confidence, proportion, marginoferror3, power)) + row<-table.element(row, compsize(population, confidence, proportion, marginoferror4, power)) + row<-table.row.end(row) + return(row) + } > npop <- array(NA, 200) > ppop <- array(NA, 200) > for (i in 1:200) + { + ppop[i] <- i * 100 + npop[i] <- compsize(ppop[i], confidence, proportion, par1, power) + } > postscript(file="/var/fisher/rcomp/tmp/1b5jt1386599817.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- paste(par1*100,'%') > plot(ppop,npop,col=2,main=paste('Steekproefomvang bij een Foutenmarge van ', dum), xlab='Populatieomvang', ylab='Steekproefomvang') > dev.off() null device 1 > a<-table.start() > dum <- paste(confidence*100, '%, een Proportie van ',sep='') > dum <- paste(dum, proportion) > dum <- paste(dum, 'en een Power van ') > dum <- paste(dum, power*100) > dum <- paste(dum, '%',sep='') > a<-table.row.start(a) > a<-table.element(a,paste('Tabel 7.1: Steekproefomvang voor verschillende waarden van de populatieomvang op een betrouwbaarheidsniveau van ', dum),5,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'',1,TRUE) > a<-table.element(a,'Foutenmarge',4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Populatie',1,TRUE) > a<-table.element(a, paste(par1*100,'%'),1,TRUE) > a<-table.element(a, paste(par2*100,'%'),1,TRUE) > a<-table.element(a, paste(par3*100,'%'),1,TRUE) > a<-table.element(a, paste(par4*100,'%'),1,TRUE) > a<-table.row.end(a) > a <- paste(a,comprow(userpopsize, confidence, proportion, par1, par2, par3, par4, power)) > a <- paste(a,comprow(100, confidence, proportion, par1, par2, par3, par4, power)) > a <- paste(a,comprow(150, confidence, proportion, par1, par2, par3, par4, power)) > a <- paste(a,comprow(200, confidence, proportion, par1, par2, par3, par4, power)) > a <- paste(a,comprow(250, confidence, proportion, par1, par2, par3, par4, power)) > a <- paste(a,comprow(300, confidence, proportion, par1, par2, par3, par4, power)) > a <- paste(a,comprow(400, confidence, proportion, par1, par2, par3, par4, power)) > a <- paste(a,comprow(500, confidence, proportion, par1, par2, par3, par4, power)) > a <- paste(a,comprow(750, confidence, proportion, par1, par2, par3, par4, power)) > a <- paste(a,comprow(1000, confidence, proportion, par1, par2, par3, par4, power)) > a <- paste(a,comprow(2000, confidence, proportion, par1, par2, par3, par4, power)) > a <- paste(a,comprow(5000, confidence, proportion, par1, par2, par3, par4, power)) > a <- paste(a,comprow(10000, confidence, proportion, par1, par2, par3, par4, power)) > a <- paste(a,comprow(100000, confidence, proportion, par1, par2, par3, par4, power)) > a <- paste(a,comprow(1000000, confidence, proportion, par1, par2, par3, par4, power)) > a <- paste(a,comprow(10000000, confidence, proportion, par1, par2, par3, par4, power)) > a<-table.end(a) > table.save(a,file="/var/fisher/rcomp/tmp/2b05s1386599818.tab") > > try(system("convert tmp/1b5jt1386599817.ps tmp/1b5jt1386599817.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.400 0.388 1.744