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. > x <- c(1.65,1.66,1.66,1.67,1.68,1.68,1.68,1.68,1.69,1.7,1.7,1.71,1.72,1.73,1.74,1.74,1.75,1.75,1.75,1.76,1.79,1.83,1.84,1.85,1.87,1.87,1.87,1.88,1.88,1.88,1.88,1.89,1.89,1.89,1.9,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.89,1.9,1.9,1.92,1.93,1.92,1.95,1.96,1.96,1.96,1.96,1.96,1.97,1.97,1.97,1.97,1.97,1.97,1.98,1.98,1.98,1.98,1.98,1.98,1.97,1.98,1.98,1.99,2,2) > 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] 84 > (np <- floor(n / par1)) [1] 7 > 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] [,7] [1,] 1.65 1.72 1.87 1.89 1.89 1.95 1.98 [2,] 1.66 1.73 1.87 1.89 1.89 1.96 1.98 [3,] 1.66 1.74 1.87 1.89 1.89 1.96 1.98 [4,] 1.67 1.74 1.88 1.89 1.89 1.96 1.98 [5,] 1.68 1.75 1.88 1.89 1.89 1.96 1.98 [6,] 1.68 1.75 1.88 1.89 1.89 1.96 1.98 [7,] 1.68 1.75 1.88 1.89 1.89 1.97 1.97 [8,] 1.68 1.76 1.89 1.89 1.90 1.97 1.98 [9,] 1.69 1.79 1.89 1.89 1.90 1.97 1.98 [10,] 1.70 1.83 1.89 1.89 1.92 1.97 1.99 [11,] 1.70 1.84 1.90 1.89 1.93 1.97 2.00 [12,] 1.71 1.85 1.89 1.89 1.92 1.97 2.00 > 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] 1.680000 1.770833 1.882500 1.890000 1.900000 1.964167 1.983333 > arr.sd [1] 0.018090681 0.045218326 0.009653073 0.000000000 0.014770979 0.006685579 [7] 0.008876254 > arr.range [1] 0.06 0.13 0.03 0.00 0.04 0.02 0.03 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 0.16185 -0.07877 > (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