File:Logistic-t-normal.svg

Original file(SVG file, nominally 630 × 630 pixels, file size: 731 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary edit

Description
English: Comparison of standard logistic distribution with closest normal and Student's t distributions, by matching moments.

Created using the following R code:

Source Code
logistic.t.norm = function(xmin, xmax, yplot.max, filename) {
# Generate npoints from xmin to xmax
npoints=10000
scalefact=npoints/(xmax - xmin)
x=(xmin*scalefact):(xmax*scalefact)/scalefact

ylim=c(0,yplot.max) # Minimum and maximum Y limits
svg(filename)
# cex=font scaling, mai=margins (reduced as much as possible)
par(cex=1.5,mai=c(0.8,0.8,0.2,0.1))
# Plot blue logistic curve; lwd=line width, type="l" means use a line
plot(x,dlogis(x),type="l",xlab="", ylab="",lwd=3,col="blue",ylim=ylim)
abline(v=0,lty=3) # Draw a dotted vertical line at 0 (lty=line type, 3=dotted)
# Set Student t params to match moments of logistic
df = 9; shape = sqrt((df-2)/df*pi*pi/3) 
# Plot red Student t curve; lwd=line width, lty=line type (3=dotted)
points(x,dt(x/shape,df)/shape,type="l",lty=3,col="red",lwd=3)
# Set normal params to match moments of logistic
sd = sqrt(pi*pi/3)
# Draw std dev lines (currently only at +/- 1 std dev, alternatively at all of them)
#for (sdevs in 1:floor(xmax/sd)) {
for (sdevs in 1:1) {
  abline(v=-sd*sdevs,lty=2) # Draw a dashed vertical line at -1 std dev (lty 2=dashed)
  abline(v=sd*sdevs,lty=2) # Draw a dashed vertical line at +1 std dev (lty 2=dashed)
}
# Add std dev ticks along the top
axis(3,at=-floor(xmax/sd):floor(xmax/sd)*sd,labels=FALSE)
# Plot green normal curve; lwd=line width, lty=line type (3=dotted)
points(x,dnorm(x,0,sd),type="l",lty=3,col="green",lwd=3)
# Draw legend in bottom center
legend("bottom", c("logistic(0,1)", sprintf("t(%g,0,%g)",df,shape), sprintf("norm(0,%g)", sd), sprintf("std dev=%g", sd)), cex=0.9,col = c("blue","red","green", "black"), lty=c(1,3,3,2),lwd=c(3,3,3,1))
dev.off()
}

logistic.t.norm(-6,6,0.25,"logistic-t-normal.svg")
Date
Source Created using R
Author Benwing

Licensing edit

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 4.0 International, 3.0 Unported, 2.5 Generic, 2.0 Generic and 1.0 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 give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
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
current04:35, 28 March 2012Thumbnail for version as of 04:35, 28 March 2012630 × 630 (731 KB)Benwing (talk | contribs)add ticks along top
03:25, 28 March 2012Thumbnail for version as of 03:25, 28 March 2012630 × 630 (729 KB)Benwing (talk | contribs)add std dev lines
02:36, 28 March 2012Thumbnail for version as of 02:36, 28 March 2012630 × 630 (724 KB)Benwing (talk | contribs){{Information |description = {{en|1=Comparison of standard logistic distribution with closest normal and Student's t distributions, by matching moments. Created using the following R code: {{cot|Source Code}} <source lang="rsplus"> logistic.t.norm = fu...

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file: