Skip to contents

This function will estimate the prob parameter for a Zero-Truncated Geometric distribution from a given vector .x. The function returns a list with a parameter table, and if .auto_gen_empirical is set to TRUE, the empirical data is combined with the estimated distribution data.

Usage

util_zero_truncated_geometric_param_estimate(.x, .auto_gen_empirical = TRUE)

Arguments

.x

The vector of data to be passed to the function. Must contain non-negative integers and should have no zeros.

.auto_gen_empirical

Boolean value (default TRUE) that, when set to TRUE, will generate tidy_empirical() output for .x and combine it with the estimated distribution data.

Value

A tibble/list

Details

This function will attempt to estimate the prob parameter of the Zero-Truncated Geometric distribution using given vector .x as input data. If the parameter .auto_gen_empirical is set to TRUE, the empirical data in .x will be run through the tidy_empirical() function and combined with the estimated zero-truncated geometric data.

Examples

library(actuar)
library(dplyr)
library(ggplot2)
library(actuar)

set.seed(123)
ztg <- rztgeom(100, prob = 0.2)
output <- util_zero_truncated_geometric_param_estimate(ztg)

output$parameter_tbl
#> # A tibble: 1 × 9
#>   dist_type              samp_size   min   max  mean variance sum_x method  prob
#>   <chr>                      <int> <dbl> <dbl> <dbl>    <dbl> <dbl> <chr>  <dbl>
#> 1 Zero-Truncated Geomet…       100     1    16  4.78     13.5   478 Momen… 0.209

output$combined_data_tbl |>
  tidy_combined_autoplot()