R version 2.7.2 (2008-08-25) 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. > y <- c(86.3,99.1,98.4,95.6,92.2,79.4,100.9,135.3,114.6,85.7,76.3,72.2,66.7,91.2,69.7,62.8,102,54.8,53.2,107.8,89.3,68.2,64.9,58.9,47.2,56.4,64.8,59.2,67.1,51.1,55.6,106,53.4,52.3,89,56.9,44.4,101.6,68.8,52.2,74.1,67.1,63.4,300.4,114.6,120.4,124,106.9,130.4,153.1,61.2,59.3,119.9,90.1,86.2,262,112.3,91.9,94.6,103.9,110,150.2,105.1,124.4,185.1,96.7,319.9,240.4,127.1,90.6,82.5,103.4,92.9,154.9,131.6,104.1,104.2,73.9,115.9,136.9,117.3,62.9,89.3,91,91.3,97.6,151.4,83.4,119.1,84.6,164,145.3,124.2,74.6,94.3,98.3,90.4) > x <- c(37.6,52.8,32.1,33.3,43.6,37.5,31.9,102,55,81.1,36.2,39.7,45.6,43,33.9,34.1,62.1,43.2,70.7,74.9,68.4,64.1,70.4,51.6,52.4,73.9,85.9,52.9,68.6,71.4,71.7,94.8,94.6,59.4,94.3,49.7,59.7,58,40.8,66.4,54,31.8,55.1,72.3,69.7,56.3,57,44.1,43.8,51,42,52.6,73.7,40.5,49,74.3,59.4,125.8,77.8,102.8,70.3,103.2,42.1,59,45,57.1,57.2,147.5,98.7,70.5,41,54.2,39.8,50.9,42.3,37.6,44.6,46.4,48,152.9,64.5,50.5,60.3,53.8,52.8,50.2,70.8,62,73.7,43.4,49.6,141,122.3,86.4,134,107.1,80.9) > ylab = 'investeringen wegtransporteurs' > xlab = 'investeringen transportmiddelenindustrie' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Pearson Correlation (v1.0.2) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_correlation.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > postscript(file="/var/www/html/freestat/rcomp/tmp/10nav1224576993.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > histx <- hist(x, plot=FALSE) > histy <- hist(y, plot=FALSE) > maxcounts <- max(c(histx$counts, histx$counts)) > xrange <- c(min(x),max(x)) > yrange <- c(min(y),max(y)) > nf <- layout(matrix(c(2,0,1,3),2,2,byrow=TRUE), c(3,1), c(1,3), TRUE) > par(mar=c(4,4,1,1)) > plot(x, y, xlim=xrange, ylim=yrange, xlab=xlab, ylab=ylab) > par(mar=c(0,4,1,1)) > barplot(histx$counts, axes=FALSE, ylim=c(0, maxcounts), space=0) > par(mar=c(4,0,1,1)) > barplot(histy$counts, axes=FALSE, xlim=c(0, maxcounts), space=0, horiz=TRUE) > dev.off() null device 1 > lx = length(x) > makebiased = (lx-1)/lx > varx = var(x)*makebiased > vary = var(y)*makebiased > corxy <- cor.test(x,y,method='pearson') > cxy <- as.matrix(corxy$estimate)[1,1] > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Pearson Product Moment Correlation - Ungrouped Data',3,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Statistic',1,TRUE) > a<-table.element(a,'Variable X',1,TRUE) > a<-table.element(a,'Variable Y',1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/arithmetic_mean.htm','Mean',''),header=TRUE) > a<-table.element(a,mean(x)) > a<-table.element(a,mean(y)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/biased.htm','Biased Variance',''),header=TRUE) > a<-table.element(a,varx) > a<-table.element(a,vary) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/biased1.htm','Biased Standard Deviation',''),header=TRUE) > a<-table.element(a,sqrt(varx)) > a<-table.element(a,sqrt(vary)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/covariance.htm','Covariance',''),header=TRUE) > a<-table.element(a,cov(x,y),2) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/pearson_correlation.htm','Correlation',''),header=TRUE) > a<-table.element(a,cxy,2) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/coeff_of_determination.htm','Determination',''),header=TRUE) > a<-table.element(a,cxy*cxy,2) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/ttest_statistic.htm','T-Test',''),header=TRUE) > a<-table.element(a,as.matrix(corxy$statistic)[1,1],2) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'p-value (2 sided)',header=TRUE) > a<-table.element(a,(p2 <- as.matrix(corxy$p.value)[1,1]),2) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'p-value (1 sided)',header=TRUE) > a<-table.element(a,p2/2,2) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Degrees of Freedom',header=TRUE) > a<-table.element(a,lx-2,2) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Number of Observations',header=TRUE) > a<-table.element(a,lx,2) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/freestat/rcomp/tmp/28sec1224576993.tab") > > system("convert tmp/10nav1224576993.ps tmp/10nav1224576993.png") > > > proc.time() user system elapsed 0.851 0.226 1.046