metRology (version 0.9-28-1)

Scaled t distribution: Scaled and shifted t distribution.

Description

Student's t distribution for 'df' degrees of freedom, shifted by 'mean' and scaled by 'sd'.

Usage

dt.scaled(x, df, mean = 0, sd = 1, ncp, log = FALSE)
pt.scaled(q, df, mean = 0, sd = 1, ncp, lower.tail = TRUE, log.p = FALSE)
qt.scaled(p, df, mean = 0, sd = 1, ncp, lower.tail = TRUE, log.p = FALSE)
rt.scaled(n, df, mean = 0, sd = 1, ncp)

Arguments

x,q

vector of quantiles.

p

vector of probabilities.

n

number of observations. If length(n) > 1, the length is taken to be the number required.

df

degrees of freedom (> 0, maybe non-integer). df = Inf is allowed.

mean

mean value for the shifted, scaled distribution.

sd

Scale factor for the shifted, scaled distribution.

ncp

non-centrality parameter delta; currently except for rt(), only for abs(ncp) <= 37.62. If omitted, use the central t distribution.

lower.tail

logical; if TRUE (default), probabilities are P[X <= x]; otherwise, P[X > x].

log, log.p

logical; if TRUE, probabilities p are given as log(p).

Value

dt.scaled gives the density, pt.scaled gives the distribution function, qt.scaled gives the quantile function, and rt.scaled generates random deviates.

Invalid arguments will result in return value NaN, with a warning.

Details

These are wrappers for the corresponding t distribution functions in package stats.

The scaled, shifted t distribution has mean mean and variance sd^2 * df/(df-2)

The scaled, shifted t distribution is used for Monte Carlo evaluation when a value x has been assigned a standard uncertainty u associated with with df degrees of freedom; the corresponding distribution function for that is then t.scaled with mean=x, sd=u and df=df.

See Also

TDist

Examples

Run this code
# NOT RUN {
	u<-rt.scaled(20, df=5, mean=11, sd=0.7)
	
	qt.scaled(c(0.025,0.975), Inf, mean=10, sd=1) #10 +- 1.96*sd
	
	require(graphics)
	hist(rt.scaled(10000, df=4, mean=11, sd=0.7), breaks=50, probability=TRUE)
	x<-seq(0,25, 0.05)
	lines(x,dnorm(x,mean=11, sd=0.7), col=2)

# }

Run the code above in your browser using DataCamp Workspace