Learn R Programming

VGAM (version 0.8-1)

triangle: Triangle Distribution Family Function

Description

Estimating the parameter of the triangle distribution by maximum likelihood estimation.

Usage

triangle(lower=0, upper=1, link="elogit",
         earg=if(link=="elogit") list(min = lower, max = upper) else
         list(), itheta=NULL)

Arguments

lower, upper
lower and upper limits of the distribution. Must be finite. Called $A$ and $B$ respectively below.
link
Parameter link function applied to the parameter $\theta$, which lies in $(A,B)$. See Links for more choices. The default constrains the estimate to lie in the interval.
earg
List. Extra argument for the link. See earg in Links for general information.
itheta
Optional initial value for the parameter. The default is to compute the value internally.

Value

  • An object of class "vglmff" (see vglmff-class). The object is used by modelling functions such as vglm and vgam.

Details

The triangle distribution has a probability density function that consists of two lines joined at $\theta$. The lines intersect the $y=0$ axis at $A$ and $B$. Here, Fisher scoring is used.

On fitting, the extra slot has components called lower and upper which contains the values of the above arguments (recycled to the right length). The fitted values are the mean of the distribution, which is a little messy to write.

See Also

Triangle.

Examples

Run this code
y  = rtriangle(n <- 3000, theta=3/4)
fit = vglm(y ~ 1, triangle(link="identity"), trace=TRUE)
coef(fit, matrix=TRUE)
Coef(fit)
head(fit@extra$lower)
head(fitted(fit))
mean(y)

Run the code above in your browser using DataLab