R Func Dnorm Pnorm
# R dnorm() pnorm() qnorm() Functions β Normal Distribution Function Family
[ R Language Examples](#)
R provides four core functions for the normal distribution: dnorm() for the density function, pnorm() for cumulative probability, qnorm() for the quantile function, and rnorm() for random number generation.
They answer different questions: What is the probability density at a given value? What is the cumulative probability? What is the quantile corresponding to a given probability?
The syntax for each function is as follows:
dnorm(x, mean = 0, sd = 1) # density function
pnorm(q, mean = 0, sd = 1) # cumulative distribution function P(X <= q)
qnorm(p, mean = 0, sd = 1) # quantile function
**Parameter Explanation:**
* **x/q** The value(s) to compute.
* **p** Probability value (between 0 and 1).
* **mean** Mean, default is 0.
* **sd** Standard deviation, default is 1.
## Examples
# Assume exam scores follow N(70, 10)
# dnorm: Probability density at score 70
print(paste("dnorm(70):", round(dnorm(70, mean=70, sd=10), 4)))
# pnorm: Probability that score is less than or equal to 85
print(paste("P(score 85):", round(1-pnorm(85, mean=70, sd=10), 4)))
# qnorm: Threshold for the top 10% (i.e., 90th percentile)
print(paste("Top 10% score threshold:", round(qnorm(0.9, mean=70, sd=10), 2)))
Executing the above code yields the following output:
"dnorm(70): 0.0399"
"P(score 85): 0.0668"
"Top 10% score threshold: 82.82"
[ R Language Examples](#)
YouTip