Last data update: 2014.03.03

R: Estimation of parameters of the Gamma distribution
gammafitR Documentation

Estimation of parameters of the Gamma distribution

Description

Likelihood estimation of parameters of the Gamma distribution. Data can be right censored.

Usage

gammafit(time, event)

Arguments

time

numeric vector. For right censored data, this is the follow up time.

event

status indicator vector, 0=alive, 1=dead.

Value

A list with the following components:

par

best estimate of parameter vector c(shape, scale)

value

value of the likelihood at termination.

feval

number of times the likelihood was evaluated.

restarts

number of times the algorithm had to be restarted when it stagnated.

convergence

an integer code indicating type of convergence. 0 indicates successful convergence. Positive integer codes indicate failure to converge.

message

a text message indicating the type of convergence or failure.

Author(s)

Josef Brejcha

Examples

n <- 30
t <- rgamma(n, shape=2, scale=100)
ev <- round(runif(n), 0)
gammafit(t, ev)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BivarP)
Loading required package: dfoptim
Loading required package: survival
Loading required package: copula
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BivarP/gammafit.Rd_%03d_medium.png", width=480, height=480)
> ### Name: gammafit
> ### Title: Estimation of parameters of the Gamma distribution
> ### Aliases: gammafit
> ### Keywords: ~kwd1 ~kwd2
> 
> ### ** Examples
> 
> n <- 30
> t <- rgamma(n, shape=2, scale=100)
> ev <- round(runif(n), 0)
> gammafit(t, ev)
$par
[1]  3.440186 99.036348

$value
[1] 88.70361

$feval
[1] 68

$restarts
[1] 0

$convergence
[1] 0

$message
[1] "Successful convergence"

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>