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 <- array(list(119.992 + ,157.302 + ,122.4 + ,148.65 + ,116.682 + ,131.111 + ,116.676 + ,137.871 + ,116.014 + ,141.781 + ,120.552 + ,131.162 + ,120.267 + ,137.244 + ,107.332 + ,113.84 + ,95.73 + ,132.068 + ,95.056 + ,120.103 + ,88.333 + ,112.24 + ,91.904 + ,115.871 + ,136.926 + ,159.866 + ,139.173 + ,179.139 + ,152.845 + ,163.305 + ,142.167 + ,217.455 + ,144.188 + ,349.259 + ,168.778 + ,232.181 + ,153.046 + ,175.829 + ,156.405 + ,189.398 + ,153.848 + ,165.738 + ,153.88 + ,172.86 + ,167.93 + ,193.221 + ,173.917 + ,192.735 + ,163.656 + ,200.841 + ,104.4 + ,206.002 + ,171.041 + ,208.313 + ,146.845 + ,208.701 + ,155.358 + ,227.383 + ,162.568 + ,198.346 + ,197.076 + ,206.896 + ,199.228 + ,209.512 + ,198.383 + ,215.203 + ,202.266 + ,211.604 + ,203.184 + ,211.526 + ,201.464 + ,210.565 + ,177.876 + ,192.921 + ,176.17 + ,185.604 + ,180.198 + ,201.249 + ,187.733 + ,202.324 + ,186.163 + ,197.724 + ,184.055 + ,196.537 + ,237.226 + ,247.326 + ,241.404 + ,248.834 + ,243.439 + ,250.912 + ,242.852 + ,255.034 + ,245.51 + ,262.09 + ,252.455 + ,261.487 + ,122.188 + ,128.611 + ,122.964 + ,130.049 + ,124.445 + ,135.069 + ,126.344 + ,134.231 + ,128.001 + ,138.052 + ,129.336 + ,139.867 + ,108.807 + ,134.656 + ,109.86 + ,126.358 + ,110.417 + ,131.067 + ,117.274 + ,129.916 + ,116.879 + ,131.897 + ,114.847 + ,271.314 + ,209.144 + ,237.494 + ,223.365 + ,238.987 + ,222.236 + ,231.345 + ,228.832 + ,234.619 + ,229.401 + ,252.221 + ,228.969 + ,239.541 + ,140.341 + ,159.774 + ,136.969 + ,166.607 + ,143.533 + ,162.215 + ,148.09 + ,162.824 + ,142.729 + ,162.408 + ,136.358 + ,176.595 + ,120.08 + ,139.71 + ,112.014 + ,588.518 + ,110.793 + ,128.101 + ,110.707 + ,122.611 + ,112.876 + ,148.826 + ,110.568 + ,125.394 + ,95.385 + ,102.145 + ,100.77 + ,115.697 + ,96.106 + ,108.664 + ,95.605 + ,107.715 + ,100.96 + ,110.019 + ,98.804 + ,102.305 + ,176.858 + ,205.56 + ,180.978 + ,200.125 + ,178.222 + ,202.45 + ,176.281 + ,227.381 + ,173.898 + ,211.35 + ,179.711 + ,225.93 + ,166.605 + ,206.008 + ,151.955 + ,163.335 + ,148.272 + ,164.989 + ,152.125 + ,161.469 + ,157.821 + ,172.975 + ,157.447 + ,163.267 + ,159.116 + ,168.913 + ,125.036 + ,143.946 + ,125.791 + ,140.557 + ,126.512 + ,141.756 + ,125.641 + ,141.068 + ,128.451 + ,150.449 + ,139.224 + ,586.567 + ,150.258 + ,154.609 + ,154.003 + ,160.267 + ,149.689 + ,160.368 + ,155.078 + ,163.736 + ,151.884 + ,157.765 + ,151.989 + ,157.339 + ,193.03 + ,208.9 + ,200.714 + ,223.982 + ,208.519 + ,220.315 + ,204.664 + ,221.3 + ,210.141 + ,232.706 + ,206.327 + ,226.355 + ,151.872 + ,492.892 + ,158.219 + ,442.557 + ,170.756 + ,450.247 + ,178.285 + ,442.824 + ,217.116 + ,233.481 + ,128.94 + ,479.697 + ,176.824 + ,215.293 + ,138.19 + ,203.522 + ,182.018 + ,197.173 + ,156.239 + ,195.107 + ,145.174 + ,198.109 + ,138.145 + ,197.238 + ,166.888 + ,198.966 + ,119.031 + ,127.533 + ,120.078 + ,126.632 + ,120.289 + ,128.143 + ,120.256 + ,125.306 + ,119.056 + ,125.213 + ,118.747 + ,123.723 + ,106.516 + ,112.777 + ,110.453 + ,127.611 + ,113.4 + ,133.344 + ,113.166 + ,130.27 + ,112.239 + ,126.609 + ,116.15 + ,131.731 + ,170.368 + ,268.796 + ,208.083 + ,253.792 + ,198.458 + ,219.29 + ,202.805 + ,231.508 + ,202.544 + ,241.35 + ,223.361 + ,263.872 + ,169.774 + ,191.759 + ,183.52 + ,216.814 + ,188.62 + ,216.302 + ,202.632 + ,565.74 + ,186.695 + ,211.961 + ,192.818 + ,224.429 + ,198.116 + ,233.099 + ,121.345 + ,139.644 + ,119.1 + ,128.442 + ,117.87 + ,127.349 + ,122.336 + ,142.369 + ,117.963 + ,134.209 + ,126.144 + ,154.284 + ,127.93 + ,138.752 + ,114.238 + ,124.393 + ,115.322 + ,135.738 + ,114.554 + ,126.778 + ,112.15 + ,131.669 + ,102.273 + ,142.83 + ,236.2 + ,244.663 + ,237.323 + ,243.709 + ,260.105 + ,264.919 + ,197.569 + ,217.627 + ,240.301 + ,245.135 + ,244.99 + ,272.21 + ,112.547 + ,133.374 + ,110.739 + ,113.597 + ,113.715 + ,116.443 + ,117.004 + ,144.466 + ,115.38 + ,123.109 + ,116.388 + ,129.038 + ,151.737 + ,190.204 + ,148.79 + ,158.359 + ,148.143 + ,155.982 + ,150.44 + ,163.441 + ,148.462 + ,161.078 + ,149.818 + ,163.417 + ,117.226 + ,123.925 + ,116.848 + ,217.552 + ,116.286 + ,177.291 + ,116.556 + ,592.03 + ,116.342 + ,581.289 + ,114.563 + ,119.167 + ,201.774 + ,262.707 + ,174.188 + ,230.978 + ,209.516 + ,253.017 + ,174.688 + ,240.005 + ,198.764 + ,396.961 + ,214.289 + ,260.277) + ,dim=c(2 + ,195) + ,dimnames=list(c('MDVP:Fo(Hz)' + ,'MDVP:Fhi(Hz)') + ,1:195)) > y <- array(NA,dim=c(2,195),dimnames=list(c('MDVP:Fo(Hz)','MDVP:Fhi(Hz)'),1:195)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'TRUE' > par2 = '2' > par1 = '1' > ylab = 'low sound variation' > xlab = 'high sound variation' > main = 'High versus Low Sound Variation' > par3 <- 'TRUE' > par2 <- '2' > par1 <- '1' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: aston2 > #To cite this work: Ian E. Holliday, 2012, Simple Linear Regression (v1.0.5) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/Ian.Holliday/rwasp_Simple%20Regression%20Y%20~%20X.wasp/ > #Source of accompanying publication: > # > cat1 <- as.numeric(par1) > cat2<- as.numeric(par2) > intercept<-as.logical(par3) > x <- t(x) > xdf<-data.frame(t(y)) > (V1<-dimnames(y)[[1]][cat1]) [1] "MDVP:Fo(Hz)" > (V2<-dimnames(y)[[1]][cat2]) [1] "MDVP:Fhi(Hz)" > xdf <- data.frame(xdf[[cat1]], xdf[[cat2]]) > names(xdf)<-c('Y', 'X') > if(intercept == FALSE) (lmxdf<-lm(Y~ X - 1, data = xdf) ) else (lmxdf<-lm(Y~ X, data = xdf) ) Call: lm(formula = Y ~ X, data = xdf) Coefficients: (Intercept) X 118.4733 0.1814 > sumlmxdf<-summary(lmxdf) > (aov.xdf<-aov(lmxdf) ) Call: aov(formula = lmxdf) Terms: X Residuals Sum of Squares 53437.91 278910.75 Deg. of Freedom 1 193 Residual standard error: 38.01491 Estimated effects may be unbalanced > (anova.xdf<-anova(lmxdf) ) Analysis of Variance Table Response: Y Df Sum Sq Mean Sq F value Pr(>F) X 1 53438 53438 36.978 6.282e-09 *** Residuals 193 278911 1445 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/rcomp/createtable") > > a<-table.start() > nc <- ncol(sumlmxdf$'coefficients') > nr <- nrow(sumlmxdf$'coefficients') > a<-table.row.start(a) > a<-table.element(a,'Linear Regression Model', nc+1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, lmxdf$call['formula'],nc+1) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'coefficients:',1,TRUE) > a<-table.element(a, ' ',nc,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, ' ',1,TRUE) > for(i in 1 : nc){ + a<-table.element(a, dimnames(sumlmxdf$'coefficients')[[2]][i],1,TRUE) + }#end header > a<-table.row.end(a) > for(i in 1: nr){ + a<-table.element(a,dimnames(sumlmxdf$'coefficients')[[1]][i] ,1,TRUE) + for(j in 1 : nc){ + a<-table.element(a, round(sumlmxdf$coefficients[i, j], digits=3), 1 ,FALSE) + } + a<-table.row.end(a) + } > a<-table.row.start(a) > a<-table.element(a, '- - - ',1,TRUE) > a<-table.element(a, ' ',nc,FALSE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Residual Std. Err. ',1,TRUE) > a<-table.element(a, paste(round(sumlmxdf$'sigma', digits=3), ' on ', sumlmxdf$'df'[2], 'df') ,nc, FALSE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple R-sq. ',1,TRUE) > a<-table.element(a, round(sumlmxdf$'r.squared', digits=3) ,nc, FALSE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Adjusted R-sq. ',1,TRUE) > a<-table.element(a, round(sumlmxdf$'adj.r.squared', digits=3) ,nc, FALSE) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/11gae1386671242.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'ANOVA Statistics', 5+1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, ' ',1,TRUE) > a<-table.element(a, 'Df',1,TRUE) > a<-table.element(a, 'Sum Sq',1,TRUE) > a<-table.element(a, 'Mean Sq',1,TRUE) > a<-table.element(a, 'F value',1,TRUE) > a<-table.element(a, 'Pr(>F)',1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, V2,1,TRUE) > a<-table.element(a, anova.xdf$Df[1]) > a<-table.element(a, round(anova.xdf$'Sum Sq'[1], digits=3)) > a<-table.element(a, round(anova.xdf$'Mean Sq'[1], digits=3)) > a<-table.element(a, round(anova.xdf$'F value'[1], digits=3)) > a<-table.element(a, round(anova.xdf$'Pr(>F)'[1], digits=3)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Residuals',1,TRUE) > a<-table.element(a, anova.xdf$Df[2]) > a<-table.element(a, round(anova.xdf$'Sum Sq'[2], digits=3)) > a<-table.element(a, round(anova.xdf$'Mean Sq'[2], digits=3)) > a<-table.element(a, ' ') > a<-table.element(a, ' ') > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/22vqo1386671242.tab") > postscript(file="/var/wessaorg/rcomp/tmp/34k5y1386671242.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(Y~ X, data=xdf, xlab=V2, ylab=V1, main='Regression Solution') > if(intercept == TRUE) abline(coef(lmxdf), col='red') > if(intercept == FALSE) abline(0.0, coef(lmxdf), col='red') > dev.off() null device 1 > library(car) Loading required package: MASS Loading required package: nnet > postscript(file="/var/wessaorg/rcomp/tmp/4i9fh1386671242.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qq.plot(resid(lmxdf), main='QQplot of Residuals of Fit') Warning message: 'qq.plot' is deprecated. Use 'qqPlot' instead. See help("Deprecated") and help("car-deprecated"). > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/5a8ky1386671242.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(xdf$X, resid(lmxdf), main='Scatterplot of Residuals of Model Fit') > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/6nb7l1386671242.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot.lm(lmxdf, which=4) > dev.off() null device 1 > > try(system("convert tmp/34k5y1386671242.ps tmp/34k5y1386671242.png",intern=TRUE)) character(0) > try(system("convert tmp/4i9fh1386671242.ps tmp/4i9fh1386671242.png",intern=TRUE)) character(0) > try(system("convert tmp/5a8ky1386671242.ps tmp/5a8ky1386671242.png",intern=TRUE)) character(0) > try(system("convert tmp/6nb7l1386671242.ps tmp/6nb7l1386671242.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.481 0.768 4.261