MLestimates: ML Estimate of Normal Parameters

View source: R/trap_MLestimates.R

MLestimatesR Documentation

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)

Arguments

x

A numeric vector.

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.

Value

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

Comment

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

Examples

# 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)


ROCit documentation built on May 29, 2024, 2:15 a.m.