File:Logistic-t-normal-extreme-tails.svg

Original file(SVG file, nominally 630 × 630 pixels, file size: 442 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 -- extreme tail portion.

Created using the following R code:

Source Code
logistic.t.norm.extreme.tails = 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,axes=FALSE)

# Somewhat annoying code just to get extra tick marks added without
# corresponding labels.  Here we add ticks every 5 units along the x axis, but
# labels only every 10 units, so they fit.
# NOTE: Assumes xmin=-40, xmax=40!  Needs to be generalized.
ticksat=-8:8*5
labels=ifelse(ticksat %% 10 == 0, sprintf("%d",ticksat),sprintf("",ticksat))
axis(1,at=-8:8*5,labels=labels) # 1=bottom
axis(2) # 2=left side; let the default algorithm work here
box() # Put back the box around the edge that axes=FALSE turned off

# Draw a dotted vertical line at 0 (lty=line type, 3=dotted)
abline(v=0,lty=3) 
# 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 top center
legend("top", 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.extreme.tails(-40,40,1e-8,"logistic-t-normal-extreme-tails.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:53, 28 March 2012Thumbnail for version as of 04:53, 28 March 2012630 × 630 (442 KB)Benwing (talk | contribs)add std dev tick marks along top
03:28, 28 March 2012Thumbnail for version as of 03:28, 28 March 2012630 × 630 (432 KB)Benwing (talk | contribs){{Information |description = {{en|1=Comparison of standard logistic distribution with closest normal and Student's t distributions, by matching moments -- extreme tail portion. Created using the following R code: {{cot|Source Code}} <source lang="rsplu...

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file: