Learn R Programming

ROCit (version 2.1.1)

MLestimates: ML Estimate of Normal Parameters

Description

The function calculates the maximum likelihood (ML) estimates of the two parameters \(\mu\) and \(\sigma\), when a set of numbers are assumed to be normally distributed.

Usage

MLestimates(x)

Value

A "list" object of two numeric components, \(\mu\) and \(\sigma\).

Arguments

x

A numeric vector.

Comment

MLestimates is used internally in other function(s) of ROCit.

Details

If a set of observations are assumed to be normally distributed, two parameters, mean \(\mu\) and the variance (the square of \(\sigma\)) are to be estimated. In theory, the ML estimate of \(\mu\) is the mean of the observations. And the ML estimate of square of \(\sigma\) is the mean squared deviation of the observations from the estimated \(\mu\).

Examples

Run this code
# Find the two parameters
set.seed(10)
points <- rnorm(200, 10, 5)
ML <- MLestimates(points)
message("The ML estimates are: mean = ", round(ML$mu, 3),
        " , SD = ", round(ML$sigma, 3))

#-----------------------------------------

# Superimpose smooth curve over hostogram
set.seed(100)
x <- rnorm(400)
hist(x, probability = TRUE, col = "gray90")
ML <- MLestimates(x)
x <- seq(-3, 3, 0.01)
density <- dnorm(x, mean = ML$mu, sd = ML$sigma)
lines(density~x, lwd = 2)

Run the code above in your browser using DataLab