File:Correlation_examples2.svg
From Wikipedia, the free encyclopedia
Size of this PNG preview of this SVG file: 506 × 231 pixels. Other resolutions: 320 × 146 pixels | 640 × 292 pixels | 1,024 × 467 pixels | 1,280 × 584 pixels | 2,560 × 1,169 pixels.
Original file (SVG file, nominally 506 × 231 pixels, file size: 2.18 MB)
This is a file from the Wikimedia Commons. Information from its description page there is shown below. Commons is a freely licensed media file repository. You can help. |
Summary
DescriptionCorrelation examples2.svg |
English: redesign File:Correlation_examples.png using vector graphics (SVG file) |
Date | |
Source | Own work, original uploader was Imagecreator |
Author | DenisBoigelot, original uploader was Imagecreator |
Permission (Reusing this file) |
Released into the public domain (by the authors). |
Other versions |
Derivative works of this file: CovrarianceCorrelation.svg File:Correlation_examples.png |
#Title: An example of the correlation of x and y for various distributions of (x,y) pairs
#Tags: Mathematics; Statistics; Correlation
#Author: Denis Boigelot
#Packets needed : mvtnorm (rmvnorm), RSVGTipsDevice (devSVGTips)
#How to use: output()
#
#This is an translated version in R of an Matematica 6 code by Imagecreator.
library(mvtnorm)
library(RSVGTipsDevice)
MyPlot <- function(xy, xlim = c(-4, 4), ylim = c(-4, 4), eps = 1e-15) {
title = round(cor(xy[,1], xy[,2]), 1)
if (sd(xy[,2]) < eps) title = "" # corr. coeff. is undefined
plot(xy, main = title, xlab = "", ylab = "",
col = "darkblue", pch = 16, cex = 0.2,
xaxt = "n", yaxt = "n", bty = "n",
xlim = xlim, ylim = ylim)
}
MvNormal <- function(n = 1000, cor = 0.8) {
for (i in cor) {
sd = matrix(c(1, i, i, 1), ncol = 2)
x = rmvnorm(n, c(0, 0), sd)
MyPlot(x)
}
}
rotation <- function(t, X) return(X %*% matrix(c(cos(t), sin(t), -sin(t), cos(t)), ncol = 2))
RotNormal <- function(n = 1000, t = pi/2) {
sd = matrix(c(1, 1, 1, 1), ncol = 2)
x = rmvnorm(n, c(0, 0), sd)
for (i in t)
MyPlot(rotation(i, x))
}
Others <- function(n = 1000) {
x = runif(n, -1, 1)
y = 4 * (x^2 - 1/2)^2 + runif(n, -1, 1)/3
MyPlot(cbind(x,y), xlim = c(-1, 1), ylim = c(-1/3, 1+1/3))
y = runif(n, -1, 1)
xy = rotation(-pi/8, cbind(x,y))
lim = sqrt(2+sqrt(2)) / sqrt(2)
MyPlot(xy, xlim = c(-lim, lim), ylim = c(-lim, lim))
xy = rotation(-pi/8, xy)
MyPlot(xy, xlim = c(-sqrt(2), sqrt(2)), ylim = c(-sqrt(2), sqrt(2)))
y = 2*x^2 + runif(n, -1, 1)
MyPlot(cbind(x,y), xlim = c(-1, 1), ylim = c(-1, 3))
y = (x^2 + runif(n, 0, 1/2)) * sample(seq(-1, 1, 2), n, replace = TRUE)
MyPlot(cbind(x,y), xlim = c(-1.5, 1.5), ylim = c(-1.5, 1.5))
y = cos(x*pi) + rnorm(n, 0, 1/8)
x = sin(x*pi) + rnorm(n, 0, 1/8)
MyPlot(cbind(x,y), xlim = c(-1.5, 1.5), ylim = c(-1.5, 1.5))
xy1 = rmvnorm(n/4, c( 3, 3))
xy2 = rmvnorm(n/4, c(-3, 3))
xy3 = rmvnorm(n/4, c(-3, -3))
xy4 = rmvnorm(n/4, c( 3, -3))
MyPlot(rbind(xy1, xy2, xy3, xy4), xlim = c(-3-4, 3+4), ylim = c(-3-4, 3+4))
}
output <- function() {
devSVGTips(width = 7, height = 3.2) # remove first and last line for no svg exporting
par(mfrow = c(3, 7), oma = c(0,0,0,0), mar=c(2,2,2,0))
MvNormal(800, c(1.0, 0.8, 0.4, 0.0, -0.4, -0.8, -1.0));
RotNormal(200, c(0, pi/12, pi/6, pi/4, pi/2-pi/6, pi/2-pi/12, pi/2));
Others(800)
dev.off() # remove first and last line for no svg exporting
}
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. | |
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse |
Items portrayed in this file
depicts
some value
9 May 2011
image/svg+xml
31cfb22bd2b6ebd79849d3d8a0f44e93c16c64af
2,285,771 byte
231 pixel
506 pixel
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 06:00, 10 May 2011 | 506 × 231 (2.18 MB) | DenisBoigelot | {{Information |Description ={{en|1=fd}} |Source ={{own}} |Author =DenisBoigelot |Date = |Permission = |other_versions = }} fjdk |
File usage
The following pages on the English Wikipedia use this file (pages on other projects are not listed):
Global file usage
The following other wikis use this file:
- Usage on ast.wikipedia.org
- Usage on as.wikipedia.org
- Usage on be.wikipedia.org
- Usage on bn.wikipedia.org
- Usage on bs.wikipedia.org
- Usage on ca.wikipedia.org
- Usage on cs.wikipedia.org
- Usage on el.wikipedia.org
- Usage on en.wikiversity.org
- Usage on en.wiktionary.org
- Usage on es.wikipedia.org
- Usage on fa.wikipedia.org
- Usage on fi.wikipedia.org
- Usage on fi.wiktionary.org
- Usage on fr.wikipedia.org
- Usage on ga.wikipedia.org
- Usage on ja.wikipedia.org
- Usage on jv.wikipedia.org
- Usage on ko.wikipedia.org
- Usage on pt.wikipedia.org
- Usage on ru.wikipedia.org
- Usage on sl.wikipedia.org
- Usage on sr.wikipedia.org
- Usage on sv.wikipedia.org
- Usage on tl.wikipedia.org
- Usage on uk.wikipedia.org
- Usage on www.wikidata.org
- Usage on zh-yue.wikipedia.org
- Usage on zh.wikipedia.org
Metadata
This file contains additional information, probably added from the digital camera or scanner used to create or digitize it.
If the file has been modified from its original state, some details may not fully reflect the modified file.
Short title | R SVG Plot |
---|---|
Image title | R SVG Plot with tooltips! (mode=1) |
Retrieved from "https://en.wikipedia.org/wiki/File:Correlation_examples2.svg"