Last chance! 50% off unlimited learning
Sale ends in
These functions provide the density, distribution function, quantile
function, and random generation for the univariate normal distribution
with mean
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)
These are each a vector of quantiles.
This is a vector of probabilities.
This is the number of observations, which must be a positive integer that has length 1.
This is the mean parameter
This is the variance parameter
Logical. If TRUE
, then probabilities
Logical. If TRUE
(default), then probabilities
are
dnormv
gives the density,
pnormv
gives the distribution function,
qnormv
gives the quantile function, and
rnormv
generates random deviates.
Application: Continuous Univariate
Density:
Inventor: Carl Friedrich Gauss or Abraham De Moivre
Notation 1:
Notation 2:
Parameter 1: mean parameter
Parameter 2: variance parameter
Mean:
Variance:
Mode:
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
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
.
dlaplace
,
dnorm
,
dnormp
,
dst
,
dt
,
plot.demonoid.ppc
, and
plot.laplace.ppc
.
# NOT RUN {
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"))
# }
Run the code above in your browser using DataLab