Learn R Programming

gamlss (version 4.2-4)

pdf.plot: Plots Probability Distribution Functions for GAMLSS Family

Description

A function to plot probability distribution functions (pdf) belonging to the gamlss family of distributions. This function allows either plotting of the fitted distributions for up to eight observations or plotting specified distributions belonging in the gamlss family

Usage

pdf.plot(obj = NULL, obs = c(1), family = NO(), mu = NULL, 
         sigma = NULL, nu = NULL, tau = NULL, min = NULL, 
         max = NULL, step = NULL, allinone = FALSE, 
         no.title = FALSE, ...)

Arguments

obj
An gamlss object e.g. obj=model1 where model1 is a fitted gamlss object
obs
A number or vector of up to length eight indicating the case numbers of the observations for which fitted distributions are to be displayed, e.g. obs=c(23,58) will display the fitted distribution for the 23th and 58th observations
family
This must be a gamlss family i.e. family=NO
mu
The value(s) of the location parameter mu for which the distribution has to be evaluated e.g mu=c(3,7)
sigma
The value(s) the scale parameter sigma for which the distribution has to be evaluated e.g sigma=c(3,7)
nu
The value(s) the parameter nu for which the distribution has to be evaluated e.g. nu=3
tau
The value(s) the parameter tau for which the distribution has be evaluated e.g. tau=5
min
Minimum value of the random variable y e.g. min=0
max
Maximum value of y e.g. max=10
step
Steps for the evaluation of y e.g. step=0.5
allinone
This will go
no.title
Whether you need title in the plot, default is no.title=FALSE
...
for extra arguments

Value

  • plot(s) of the required pdf(s) are returned

Warning

The range of some distributions depends on the fitted parameters

Details

This function can be used to plot distributions of the GAMLSS family. If the first argument obj is specified and it is a GAMLSS fitted object, then the fitted distribution of this model at specified observation values (given by the second argument obs) is plotted for a specified y-variable range (arguments min, max, and step). If the first argument is not given then the family argument has to be specified and the pdf is plotted at specified values of the parameters mu, sigma, nu, tau. Again the range of the y-variable has to be given.

References

Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape,(with discussion), Appl. Statist., 54, part 3, pp 507-554. Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use the GAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (see also http://www.gamlss.org/). Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R. Journal of Statistical Software, Vol. 23, Issue 7, Dec 2007, http://www.jstatsoft.org/v23/i07.

See Also

gamlss

Examples

Run this code
pdf.plot(family=BCT, min=1, max=20, step=.05, mu=10, sigma=0.15, nu=-1, tau=c(4,10,20,40) )
# now using an gamlss object
# library(gamlss)
#data(abdom)
#h<-gamlss(y~pb(x), sigma.formula=~pb(x), family=BCT, data=abdom) # fits 
#pdf.plot(obj=h , obs=c(23,67), min=50, max=150, step=.5)

Run the code above in your browser using DataLab