dist.Normal.Variance {LaplacesDemon}R Documentation

Normal Distribution: Variance Parameterization

Description

These functions provide the density, distribution function, quantile function, and random generation for the univariate normal distribution with mean \mu and variance \sigma^2.

Usage

dnormv(x, mean=0, var=1, log=FALSE)
pnormv(q, mean=0, var=1, lower.tail=TRUE, log.p=FALSE)
qnormv(p, mean=0, var=1, lower.tail=TRUE, log.p=FALSE)
rnormv(n, mean=0, var=1)

Arguments

x, q

These are each a vector of quantiles.

p

This is a vector of probabilities.

n

This is the number of observations, which must be a positive integer that has length 1.

mean

This is the mean parameter \mu.

var

This is the variance parameter \sigma^2, which must be positive.

log, log.p

Logical. If TRUE, then probabilities p are given as \log(p).

lower.tail

Logical. If TRUE (default), then probabilities are Pr[X \le x], otherwise, Pr[X > x].

Details

The normal distribution, also called the Gaussian distribution and the Second Law of Laplace, is usually parameterized with mean and variance. Base R uses the mean and standard deviation. These functions provide the variance parameterization for convenience and familiarity. For example, it is easier to code dnormv(1,1,1000) than dnorm(1,1,sqrt(1000)).

Some authors attribute credit for the normal distribution to Abraham de Moivre in 1738. In 1809, Carl Friedrich Gauss published his monograph “Theoria motus corporum coelestium in sectionibus conicis solem ambientium”, in which he introduced the method of least squares, method of maximum likelihood, and normal distribution, among many other innovations.

Gauss, himself, characterized this distribution according to mean and precision, though his definition of precision differed from the modern one.

Although the normal distribution is very common, it often does not fit data as well as more robust alternatives with fatter tails, such as the Laplace or Student t distribution.

A flat distribution is obtained in the limit as \sigma^2 \rightarrow \infty.

For models where the dependent variable, y, is specified to be normally distributed given the model, the Jarque-Bera test (see plot.demonoid.ppc or plot.laplace.ppc) may be used to test the residuals.

These functions are similar to those in base R.

Value

dnormv gives the density, pnormv gives the distribution function, qnormv gives the quantile function, and rnormv generates random deviates.

Author(s)

Statisticat, LLC. software@bayesian-inference.com

See Also

dlaplace, dnorm, dnormp, dst, dt, plot.demonoid.ppc, and plot.laplace.ppc.

Examples

library(LaplacesDemon)
x <- dnormv(1,0,1)
x <- pnormv(1,0,1)
x <- qnormv(0.5,0,1)
x <- rnormv(100,0,1)

#Plot Probability Functions
x <- seq(from=-5, to=5, by=0.1)
plot(x, dnormv(x,0,0.5), ylim=c(0,1), type="l", main="Probability Function",
     ylab="density", col="red")
lines(x, dnormv(x,0,1), type="l", col="green")
lines(x, dnormv(x,0,5), type="l", col="blue")
legend(2, 0.9, expression(paste(mu==0, ", ", sigma^2==0.5),
     paste(mu==0, ", ", sigma^2==1), paste(mu==0, ", ", sigma^2==5)),
     lty=c(1,1,1), col=c("red","green","blue"))

[Package LaplacesDemon version 16.1.6 Index]