core_normal_pdf: Normal density (C backend)

View source: R/core.R

core_normal_pdfR Documentation

Normal density (C backend)

Description

Vectorised over x; mean and sd are length-1.

Usage

core_normal_pdf(x, mean = 0, sd = 1)

Arguments

x

Numeric vector of quantiles.

mean

Distribution mean (length-1, default 0).

sd

Distribution standard deviation (length-1, default 1, > 0).

Value

A numeric vector the length of x. Equivalent to stats::dnorm(x, mean, sd).

Examples

# Standard normal density at a few quantiles.
core_normal_pdf(c(-1, 0, 1))

# Peak of the standard normal is 1/sqrt(2*pi) at x = 0.
core_normal_pdf(0)

# Shift and scale via `mean` and `sd`.
core_normal_pdf(5, mean = 5, sd = 2)       # peak of N(5, 2)
core_normal_pdf(c(0, 5, 10), mean = 5, sd = 2)

# Identical to stats::dnorm().
all.equal(core_normal_pdf(-2:2, 0, 1), stats::dnorm(-2:2, 0, 1))

rmoriebricklayer documentation built on Aug. 5, 2026, 9:08 a.m.