dnorm {salad} | R Documentation |
Normal distribution
Description
Density for the normal distribution, accepting objects of class 'dual'
Usage
dnorm(x, mean = 0, sd = 1, log = FALSE)
dnorm.dual(x, mean = 0, sd = 1, log = FALSE)
Arguments
x |
vector of values |
mean |
vector of means |
sd |
vector of standard deviations |
log |
logical. If TRUE, log of densities are returned |
Details
'dnorm.dual' will make straightfoward a computation (in R), that works both with numeric or dual objects. 'dnorm' will call 'dnorm.dual' if any of the objects is of class dual, or 'stats::dnorm' is all objects are of class numeric. As 'stats::dnorm' is in written in C it is factor.
If you care for performance, use 'stats::dnorm' directly for non dual numbers, and 'dnorm.dual' for dual numbers.
Value
a dual object.
Examples
x <- dual(0)
dnx <- dnorm(x)
dnx
d(dnx)
[Package salad version 1.0 Index]