rStats.js v1.3.0
    Preparing search index...

    Function dnorm

    • Density of the normal distribution. Equivalent to R's dnorm(x, mean = 0, sd = 1, log = FALSE).

      Type Parameters

      Parameters

      • x: T

        Value(s) at which to evaluate: a number, number[] or Float64Array. The result has the same shape.

      • options: { log?: boolean; mean?: number; sd?: number } = {}

        Distribution parameters and output scale.

        • Optionallog?: boolean

          If true, return the log density. Default false.

        • Optionalmean?: number

          Mean. Default 0.

        • Optionalsd?: number

          Standard deviation. Default 1.

      Returns VectorResult<T>

      The density (or log density).

      dnorm(0);                                  // 0.3989422804014327
      dnorm([-1, 0, 1]); // [0.24197072451914337, 0.3989422804014327, 0.24197072451914337]
      dnorm(1, { mean: 1, sd: 2, log: true }); // -1.612085713764618