R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" 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(100,100,100,100,100,100,100,100,100,100,100,100,100.4,100.4,100.4,100.4,100.4,100.4,100.4,100.4,100.4,100.4,101.4,101.4,102,102,102.6,102.6,102.6,102.6,102.6,102.6,102.3,102.4,102.4,102.4,102.9,102.9,102.9,104.9,104.9,105.5,105.5,105.5,105.5,105.5,105.5,105.5,105.5,106.8,106.8,106.8,106.9,107.5,107.6,107.6,107.6,107.8,107.8,107.8) > 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] 60 > (np <- floor(n / par1)) [1] 5 > 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] [1,] 100 100.4 102.0 102.9 105.5 [2,] 100 100.4 102.0 102.9 106.8 [3,] 100 100.4 102.6 102.9 106.8 [4,] 100 100.4 102.6 104.9 106.8 [5,] 100 100.4 102.6 104.9 106.9 [6,] 100 100.4 102.6 105.5 107.5 [7,] 100 100.4 102.6 105.5 107.6 [8,] 100 100.4 102.6 105.5 107.6 [9,] 100 100.4 102.3 105.5 107.6 [10,] 100 100.4 102.4 105.5 107.8 [11,] 100 101.4 102.4 105.5 107.8 [12,] 100 101.4 102.4 105.5 107.8 > 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] 100.0000 100.5667 102.4250 104.7500 107.2083 > arr.sd [1] 0.0000000 0.3892495 0.2261335 1.1381804 0.6815201 > arr.range [1] 0.0 1.0 0.6 2.6 2.3 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean -10.3971 0.1057 > (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