R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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. > x <- c(0.36,0.37,0.38,0.38,0.38,0.38,0.38,0.38,0.38,0.38,0.38,0.38,0.37,0.37,0.37,0.38,0.38,0.39,0.39,0.38,0.38,0.38,0.38,0.39,0.39,0.4,0.4,0.4,0.41,0.41,0.41,0.41,0.41,0.42,0.42,0.42,0.42,0.42,0.42,0.42,0.42,0.42,0.42,0.42,0.42,0.42,0.42,0.42,0.42,0.43,0.44,0.43,0.43,0.43,0.44,0.44,0.44,0.44,0.44,0.44,0.44,0.44,0.44,0.44,0.45,0.45,0.45,0.45,0.45,0.45,0.45,0.45) > par1 = '12' > par1 <- '12' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P. (2012), Standard Deviation-Mean Plot (v1.0.6) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_smp.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > # > par1 <- as.numeric(par1) > (n <- length(x)) [1] 72 > (np <- floor(n / par1)) [1] 6 > arr <- array(NA,dim=c(par1,np)) > j <- 0 > k <- 1 > for (i in 1:(np*par1)) + { + j = j + 1 + arr[j,k] <- x[i] + if (j == par1) { + j = 0 + k=k+1 + } + } > arr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.36 0.37 0.39 0.42 0.42 0.44 [2,] 0.37 0.37 0.40 0.42 0.43 0.44 [3,] 0.38 0.37 0.40 0.42 0.44 0.44 [4,] 0.38 0.38 0.40 0.42 0.43 0.44 [5,] 0.38 0.38 0.41 0.42 0.43 0.45 [6,] 0.38 0.39 0.41 0.42 0.43 0.45 [7,] 0.38 0.39 0.41 0.42 0.44 0.45 [8,] 0.38 0.38 0.41 0.42 0.44 0.45 [9,] 0.38 0.38 0.41 0.42 0.44 0.45 [10,] 0.38 0.38 0.42 0.42 0.44 0.45 [11,] 0.38 0.38 0.42 0.42 0.44 0.45 [12,] 0.38 0.39 0.42 0.42 0.44 0.45 > arr.mean <- array(NA,dim=np) > arr.sd <- array(NA,dim=np) > arr.range <- array(NA,dim=np) > for (j in 1:np) + { + arr.mean[j] <- mean(arr[,j],na.rm=TRUE) + arr.sd[j] <- sd(arr[,j],na.rm=TRUE) + arr.range[j] <- max(arr[,j],na.rm=TRUE) - min(arr[,j],na.rm=TRUE) + } > arr.mean [1] 0.3775000 0.3800000 0.4083333 0.4200000 0.4350000 0.4466667 > arr.sd [1] 0.006215816 0.007385489 0.009374369 0.000000000 0.006741999 0.004923660 > arr.range [1] 0.02 0.02 0.03 0.00 0.02 0.01 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 0.01943 -0.03320 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : NA/NaN/Inf in 'y' Calls: lm -> lm.fit Execution halted