MLestimates: ML Estimate of Normal Parameters

Description Usage Arguments Details Value Comment Examples

View source: R/trap_MLestimates.R

Description

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

Usage

1

Arguments

x

A numeric vector.

Details

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

Value

A "list" object of two numeric components, μ and σ.

Comment

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# 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 July 1, 2020, 11:28 p.m.