build_estimated_fn: Build an estimated function that captures the estimated...

View source: R/builder_functions.R

build_estimated_fnR Documentation

Build an estimated function that captures the estimated parameters

Description

Build an estimated function that captures the estimated parameters

Usage

build_estimated_fn(prefix, dist_name, fn_estimate_params, x_data, noverlap = 1)

Arguments

prefix

The prefix (generally one of p, q, r or d).

dist_name

The name of the distribution.

fn_estimate_params

A function that takes the data and the extent of the overlap in the data, and returns a single object holding estimated parameters of the distribution being fitted. The method of estimation should be unbiased. Note that for many distributions, MLE only gives asymptotically unbiased parameters. Users should validate that their estimation functions are unbiased and if necessary adjust the threshold p-value to compensate for this.

x_data

The data from which the parameters will be estimated.

noverlap

The extent of any overlap in the data. 1 means no overlap.

Value

A function with captured estimated parameters that is called with a single argument (e.g. q for a p function).

Examples

x_data <- rnorm(100)
pnorm_est <- build_estimated_fn("p", "norm", estimate_mean_sd_ol, x_data)
pnorm_est(0)
pnorm(0, mean(x_data), sd(x_data))

PaulMTeggin/practechniques documentation built on Aug. 19, 2023, 4:44 p.m.