R version 3.0.1 (2013-05-16) -- "Good Sport" 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. > x <- c(109.77,109.77,109.77,109.77,109.77,109.77,109.77,109.77,109.77,109.77,109.77,109.77,109.86,110.12,110.5,113.73,119.84,119.83,113.06,112.45,110.07,110.09,110.72,109.9,109.9,110.06,110.52,116.16,118.54,118.77,113.71,106.98,106.98,106.98,106.98,106.98,106.98,107.43,107.93,111.99,115.4,115.53,115.22,102.75,102.75,102.75,102.75,102.75,102.75,102.87,103.13,108.52,111.6,111.32,108.77,100.05,100.05,100.05,100.05,100.05,100.05,100.07,100.07,109.26,110,110,109.26,99.42,99.42,99.42,99.42,99.42) > 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,] 109.77 109.86 109.90 106.98 102.75 100.05 [2,] 109.77 110.12 110.06 107.43 102.87 100.07 [3,] 109.77 110.50 110.52 107.93 103.13 100.07 [4,] 109.77 113.73 116.16 111.99 108.52 109.26 [5,] 109.77 119.84 118.54 115.40 111.60 110.00 [6,] 109.77 119.83 118.77 115.53 111.32 110.00 [7,] 109.77 113.06 113.71 115.22 108.77 109.26 [8,] 109.77 112.45 106.98 102.75 100.05 99.42 [9,] 109.77 110.07 106.98 102.75 100.05 99.42 [10,] 109.77 110.09 106.98 102.75 100.05 99.42 [11,] 109.77 110.72 106.98 102.75 100.05 99.42 [12,] 109.77 109.90 106.98 102.75 100.05 99.42 > 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] 109.7700 112.5142 111.0467 107.8525 104.1008 102.9842 > arr.sd [1] 0.000000 3.664405 4.615134 5.380360 4.632028 4.920518 > arr.range [1] 0.00 9.98 11.79 12.78 11.55 10.58 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 24.4998 -0.1909 > (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