File:Kernel density.svg

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Kernel_density.svg(SVG file, nominally 250 × 200 pixels, file size: 42 KB)

[edit] Summary

Created in R using:

# uncomment to generate the same results with every run
# set.seed(1)

# "Tight" x-axis (so it appears all horizontal lines span infinitely both left and right
par(xaxs="i")

# Sequence between -3.1 and 3.1 with 0.1 steps
x <- seq(-3.1, 3.1, 0.1)

# Plot a perfect bell curve, or a normal distribution probability density function
plot(x, dnorm(x), "l", ylim=c(0, 0.5), col="grey", lwd=5)

# 100 normally distributed random values with mean 0 and standard deviation 1
rx <- rnorm(100)

# Add lines that attempt to characterize the distribution probability density for "rx"
# using different bandwidth "bw" values 0.3, 0.1 and 0.5 (coarse to fine widths)
lines(density(rx, bw=0.3), col="#333399")
lines(density(rx, bw=0.1), col="#009900")
lines(density(rx, bw=0.05), col="#FF6633")

# Ticks at bottom to indicate where the random "rx" values are; add legend
rug(rx)
legend("topleft", legend=c("reference", "0.3", "0.1", "0.05"), bty="n",
       col=c("grey", "#333399", "#009900", "#FF6633"), lwd=c(5, 1, 1, 1))

Note that the outcome will change for each run, as the result is dependant on randomly selected values.

Rlogo.png
This chart was created with R.

[edit] Licensing

I, the copyright holder of this work, hereby publish it under the following licenses:
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.

w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
  • share alike – If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
This licensing tag was added to this file as part of the GFDL licensing update.

w:en:Creative Commons
attribution
This file is licensed under the Creative Commons Attribution 2.5 Generic license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).

You may select the license of your choice.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current19:15, 9 July 2007Thumbnail for version as of 19:15, 9 July 2007250 × 200 (42 KB)Mwtoews== Summary == Created in R using (roughly): <pre> x <- seq(-3.1,3.1,.1) par(xaxs="i") plot(x,dnorm(x),"l",ylim=c(0,.5),col="grey",lwd=5) rx <- rnorm(100) lines(density(rx,bw=0.3)) lines(density(rx,bw=0.1)) lines(density(rx,bw=
The following pages on the English Wikipedia link to this file (pages on other projects are not listed):

Global file usage

The following other wikis use this file:

Metadata

Personal tools
Namespaces

Variants
Views
Actions
Navigation
Interaction
Toolbox