gen.Family {gamlss.dist} | R Documentation |
There are five functions here. Only the functions Family
and gen.Family
should be used (see details).
Family.d(family = "NO", type = c("log", "logit"), ...) Family.p(family = "NO", type = c("log", "logit"), ...) Family.q(family = "NO", type = c("log", "logit"), ...) Family.r(family = "NO", type = c("log", "logit"), ...) Family(family = "NO", type = c("log", "logit"), local = TRUE, ...) gen.Family(family = "NO", type = c("log", "logit"), ...)
family |
a continuous |
type |
the type of transformation only "log" and "logit" are allowed |
local |
It is TRUE if is called within |
... |
for passing extra arguments |
The function gen.Family
creates the standard d,p,q,r
functions for the distribution plus the fitting gamlss.family
. For example gen.Family("NO", "logit")
will generate the functions
dlogitNO()
, plogitNO()
, qlogitNO()
, rlogitNO()
and dlogitNO()
.
The latest function can be used in family
argument of gamlss()
to fit a logic-Normal distribution i.e. family=logitNO
.
The same fitting can be achieved by using family=Family("NO", "logit")
. Here the required dlogitNO()
, plogitNO()
and
logitNO()
functions are generated locally within the gamlss()
environment.
The function gen.Family
returns the d
, p
, q
r
functions plus the fitting function.
Mikis Stasinopoulos mikis.stasinopoulos@gamlss.org and Bob Rigby
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.
Stasinopoulos D. M., Rigby R.A., Heller G., Voudouris V., and De Bastiani F., (2017) Flexible Regression and Smoothing: Using GAMLSS in R, Chapman and Hall/CRC.
# generating a log t distribution gen.Family("TF") # plotting the d, p, q, and r functions op<-par(mfrow=c(2,2)) curve(dlogTF(x, mu=0), 0, 10) curve(plogTF(x, mu=0), 0, 10) curve(qlogTF(x, mu=0), 0, 1) Y<- rlogTF(200) hist(Y) par(op) # different mu curve(dlogTF(x, mu=-1, sigma=1, nu=10), 0, 5, ylim=c(0,1)) curve(dlogTF(x, mu=0, sigma=1, nu=10), 0, 5, add=TRUE, col="red", lty=2) curve(dlogTF(x, mu=1, sigma=1, nu=10), 0, 5, add=TRUE, col="blue", lty=3) # different sigma curve(dlogTF(x, mu=0, sigma=.5, nu=10), 0, 5, ylim=c(0,1)) curve(dlogTF(x, mu=0, sigma=1, nu=10), 0, 5, add=TRUE, col="red", lty=2) curve(dlogTF(x, mu=0, sigma=2, nu=10), 0, 5, add=TRUE, col="blue", lty=3) # different degrees of freedom nu curve(dlogTF(x, mu=0, sigma=1, nu=1), 0, 5, ylim=c(0,.8), n = 1001) curve(dlogTF(x, mu=0, sigma=1, nu=2), 0, 5, add=TRUE, col="red", lty=2) curve(dlogTF(x, mu=0, sigma=1, nu=5), 0, 5, add=TRUE, col="blue", lty=3) # generating a logit t distribution gen.Family("TF", "logit") # plotting the d, p, q, and r functions op<-par(mfrow=c(2,2)) curve(dlogitTF(x, mu=0), 0, 1) curve(plogitTF(x, mu=0), 0, 1) curve(qlogitTF(x, mu=0), 0, 1) abline(v=1) Y<- rlogitTF(200) hist(Y) par(op) # different mu curve(dlogitTF(x, mu=-2, sigma=1, nu=10), 0, 1, ylim=c(0,5)) curve(dlogitTF(x, mu=0, sigma=1, nu=10), 0, 1, add=TRUE, col="red", lty=2) curve(dlogitTF(x, mu=2, sigma=1, nu=10), 0, 1, add=TRUE, col="blue", lty=3) # different sigma curve(dlogitTF(x, mu=0, sigma=1, nu=10), 0, 1, ylim=c(0,2.5)) curve(dlogitTF(x, mu=0, sigma=2, nu=10), 0, 1, add=TRUE, col="red", lty=2) curve(dlogitTF(x, mu=0, sigma=.7, nu=10), 0, 1, add=TRUE, col="blue", lty=3) # different degrees of freedom nu curve(dlogitTF(x, mu=0, sigma=1, nu=1), 0, 1, ylim=c(0,1.6)) curve(dlogitTF(x, mu=0, sigma=1, nu=2), 0, 1, add=TRUE, col="red", lty=2) curve(dlogitTF(x, mu=0, sigma=1, nu=5), 0, 1, add=TRUE, col="blue", lty=3)