R version 2.6.2 (2008-02-08) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(2.02,1.99,1.99,2.01,2.01,2.01,2,2.01,2.02,2.01,2,2.01,2.01,2.01,2,2,1.98,2.01,1.99,1.99,2,2,1.99,1.96,1.98,1.98,1.99,1.99,1.99,1.99,1.98,1.98,1.98,1.98,1.98,1.98,1.97,1.99,2,1.99,1.98,1.98,1.96,1.95,1.94,1.93,1.92,1.91,1.92,1.93,1.94,1.93,1.94,1.93,1.93,1.92,1.92,1.91,1.92,1.92,1.93,1.91,1.95,2.01,1.98,2.01,2,1.99,1.98,1.98,1.99,1.98,1.99) > par1 = '4' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > par1 <- as.numeric(par1) > (n <- length(x)) [1] 73 > (np <- floor(n / par1)) [1] 18 > 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] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 2.02 2.01 2.02 2.01 1.98 2.00 1.98 1.99 1.98 1.97 1.98 1.94 1.92 1.94 [2,] 1.99 2.01 2.01 2.01 2.01 2.00 1.98 1.99 1.98 1.99 1.98 1.93 1.93 1.93 [3,] 1.99 2.00 2.00 2.00 1.99 1.99 1.99 1.98 1.98 2.00 1.96 1.92 1.94 1.93 [4,] 2.01 2.01 2.01 2.00 1.99 1.96 1.99 1.98 1.98 1.99 1.95 1.91 1.93 1.92 [,15] [,16] [,17] [,18] [1,] 1.92 1.93 1.98 1.98 [2,] 1.91 1.91 2.01 1.98 [3,] 1.92 1.95 2.00 1.99 [4,] 1.92 2.01 1.99 1.98 > 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] 2.0025 2.0075 2.0100 2.0050 1.9925 1.9875 1.9850 1.9850 1.9800 1.9875 [11] 1.9675 1.9250 1.9300 1.9300 1.9175 1.9500 1.9950 1.9825 > arr.sd [1] 0.015000000 0.005000000 0.008164966 0.005773503 0.012583057 0.018929694 [7] 0.005773503 0.005773503 0.000000000 0.012583057 0.015000000 0.012909944 [13] 0.008164966 0.008164966 0.005000000 0.043204938 0.012909944 0.005000000 > arr.range [1] 0.03 0.01 0.02 0.01 0.03 0.04 0.01 0.01 0.00 0.03 0.03 0.03 0.02 0.02 0.01 [16] 0.10 0.03 0.01 > (lm1 <- lm(arr.sd~arr.mean)) Call: lm(formula = arr.sd ~ arr.mean) Coefficients: (Intercept) arr.mean 0.09752 -0.04376 > (lnlm1 <- lm(log(arr.sd)~log(arr.mean))) Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : NA/NaN/Inf in foreign function call (arg 4) Calls: lm -> lm.fit -> .Fortran Execution halted