Jump to content

File:Nc student t pdf.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file (SVG file, nominally 360 × 288 pixels, file size: 41 KB)

Summary

Description
English: Graphs of the probability density functions for several members of the noncentral Student-t family.
Date
Source Own work
Author Skbkekas
SVG development
InfoField
 
The SVG code is valid.
 
This plot was created with Matplotlib.
Source code
InfoField

Python code

import numpy as np
import matplotlib.pyplot as plt
import scipy.special as sp

col = ['orange', 'purple', 'deepskyblue', 'mediumseagreen']

X = np.arange(-5, 10, 0.01)

##                                                                              
## PDF                                                                          
##                                                                              

plt.clf()
plt.figure(figsize=(4,3.2))
plt.axes([0.17,0.13,0.79,0.8])
plt.hold(True)

Q = []
for k,(mu,df) in enumerate([(0.,1.),(0.,4.),(2.,1.),(2.,4.)]):
    Y = df/2*np.log(df) + sp.gammaln(df+1) - df*np.log(2) - mu**2/2
    Y -= (df/2)*np.log(df+X**2)
    Y -= sp.gammaln(df/2)

    A = sp.hyp1f1(df/2+1, 1.5, mu**2*X**2/(2*(df+X**2)))
    B = sp.hyp1f1((df+1)/2, 0.5, mu**2*X**2/(2*(df+X**2)))

    C = np.sqrt(2)*mu*X*A
    C /= df+X**2
    C /= np.exp(sp.gammaln((df+1)/2))

    D = B/np.sqrt(df+X**2)
    D /= np.exp(sp.gammaln(df/2+1))

    Y += np.log(C+D)

    a = plt.plot(X, np.exp(Y), '-', color=col[k], lw=2)
    Q.append(a)

plt.xlabel("x")
plt.ylabel("P(x)")
bx = plt.legend(Q, (r"$\mu=0,\,\nu=1$", r"$\mu=0,\,\nu=4$",\
                    r"$\mu=2,\,\nu=1$", r"$\mu=2,\,\nu=4$"),\
                numpoints=1, handlelen=0.05, handletextpad=0.4,\
                loc="upper right")
bx.draw_frame(False)
plt.xlim(-5,10)

plt.savefig("nc_student_t_pdf.pdf")
plt.savefig("nc_student_t_pdf.svg")

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution
This file is licensed under the Creative Commons Attribution 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 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.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

15 March 2010

File history

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

Date/TimeThumbnailDimensionsUserComment
current04:07, 15 March 2010Thumbnail for version as of 04:07, 15 March 2010360 × 288 (41 KB)Skbkekas{{Information |Description={{en|1=Graphs of the probability density functions for several members of the noncentral Student-t family.}} |Source={{own}} |Author=Skbkekas |Date=2010-03-15 |Permission= |other_versions= }} [[Category:Statis

The following page uses this file:

Global file usage

The following other wikis use this file: