在概率论和统计学中,t-分布(t-distribution)用于根据小样本来估计呈正态分布且方差未知的总体的均值。如果总体方差已知(例如在样本数量足够多时),则应该用正态分布来估计总体均值。
t分布曲线形态与n(确切地说与自由度df)大小有关。与标准正态分布曲线相比,自由度df越小,t分布曲线愈平坦,曲线中间愈低,曲线双侧尾部翘得愈高;自由度df愈大,t分布曲线愈接近正态分布曲线,当自由度df=∞时,t分布曲线为标准正态分布曲线。
The Student t Distribution
Description
Density, distribution function, quantile function and random generation for the t distribution withdf
degrees of freedom (and optional non-centrality parameterncp
).
Usage
dt(x, df, ncp, log = FALSE)pt(q, df, ncp, lower.tail = TRUE, log.p = FALSE)qt(p, df, ncp, lower.tail = TRUE, log.p = FALSE)rt(n, df, ncp)
Arguments
####t分布# 1.t分布中抽样函数rt# location:x0; scale:gamman = 100df <- 10rt(n, df=df)# 2.t分布概率密度函数x <- seq(-10,10,0.1)y <- dt(x,df)plot(x,y)# 3.t分布累积概率# x <- seq(-20,20,0.1)# plot(x,dt(x,df))# P[X ≤ x]pt(1,df=df)# P[X > x]pt(1,df=df,lower.tail = FALSE)# probabilities p are given as log(p).pt(1,df=df,log.p = TRUE)# 4.qt函数(pt的反函数)# 累积概率为0.95时的x值# x <- seq(-10,10,0.1)# plot(x,pt(x,df))qt(0.95, df=df)qt(0.995, df=df)