R version 3.2.4 (2016-03-10) -- "Very Secure Dishes" Copyright (C) 2016 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(-15,-15,-13,-8,-13,-9,-7,-4,-4,-2,0,-2,-3,1,-2,-1,1,-3,-4,-9,-9,-7,-14,-12,-16,-20,-12,-12,-10,-10,-13,-16,-14,-17,-24,-25,-23,-17,-24,-20,-19,-18,-16,-12,-7,-6,-6,-5,-4,-4,-8,-9,-6,-7,-10,-11,-11,-12,-14,-12,-9,-5,-6,-6,-3,-2,-6,-6,-10,-8,-4,-3) > 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,] -15 -3 -16 -23 -4 -9 [2,] -15 1 -20 -17 -4 -5 [3,] -13 -2 -12 -24 -8 -6 [4,] -8 -1 -12 -20 -9 -6 [5,] -13 1 -10 -19 -6 -3 [6,] -9 -3 -10 -18 -7 -2 [7,] -7 -4 -13 -16 -10 -6 [8,] -4 -9 -16 -12 -11 -6 [9,] -4 -9 -14 -7 -11 -10 [10,] -2 -7 -17 -6 -12 -8 [11,] 0 -14 -24 -6 -14 -4 [12,] -2 -12 -25 -5 -12 -3 > 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] -7.666667 -5.166667 -15.750000 -14.416667 -9.000000 -5.666667 > arr.sd [1] 5.365434 4.969605 5.029459 6.947313 3.247377 2.461830 > arr.range [1] 15 15 15 19 10 8 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 2.748 -0.200 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases Calls: lm -> lm.fit In addition: Warning message: In log(arr.mean) : NaNs produced Execution halted