| Qfamily | R Documentation |
Family objects are used to specify the model to be fitted by Qest.
Qnorm()
Qgamma()
Qpois(offset = NULL)
Qunif(min = TRUE)
offset |
an optional vector of offsets for a Poisson model. |
min |
logical. If TRUE, fit a |
A Qfamily object can be used to identify a certain type of distribution within a call to Qest. You can supply either the name of the family, or the function itself, or a call to it. For example, the following are equivalent: Qest(formula, "Qpois"), Qest(formula, Qpois), and Qest(formula, Qpois()). The latter syntax can be used to pass additional arguments, if any.
The Qnorm family fits a normal homoskedastic model in which the mean is described by a linear predictor. The parameters are: log(sigma), beta. Qest(formula, Qnorm) is equivalent to Qlm(formula), but returns a very basic output. However, Qest allows for censored and truncated data, while Qlm does not.
The Qgamma family fits a Gamma distribution in which the log-scale is modeled by a linear predictor. The model parameters are: log(shape), beta.
The Qpois family fits a Poisson distribution in which the log-rate is modeled by a linear predictor. In reality, to obtain a continuous quantile function, qpois is replaced by the inverse, with respect to y, of the upper regularized gamma function, Q(y,\lambda). It is recommended to apply Qpois to a jittered response (i.e., y + runif(n)).
The Qunif family fits a Uniform distribution U(a,b) in which both a and b are modeled by linear predictors. The design matrix, however, is the same for a and b. Use Qunif(min = FALSE) to fit a U(0,b) model. The parameters are: beta_a, beta_b, or only beta_b if min = FALSE.
The families Qnorm and Qgamma can be used when the data are censored or truncated, while Qpois and Qunif cannot. All families can be estimated without covariates, using formula = ~ 1.
An object of class "Qfamily" that contains all the necessary information to be passed to Qest.
Gianluca Sottile <gianluca.sottile@unipa.it>, Paolo Frumento <paolo.frumento@unipi.it>
Qest.
n <- 250
x <- runif(n)
eta <- 1 + 2*x # linear predictor
# Normal model
y <- rnorm(n, eta, exp(1))
m1 <- Qest(y ~ x, Qnorm)
# Use Qlm(y ~ x) instead!
# Gamma model
y <- rgamma(n, shape = exp(1), scale = exp(eta))
m2 <- Qest(y ~ x, Qgamma)
# Poisson model
y <- rpois(n, exp(eta))
m3 <- Qest(y ~ x, Qpois)
m4 <- Qest(y + runif(n) ~ x, Qpois) # Jittering is recommended
# Uniform model
y <- runif(n, 0, eta)
m5 <- Qest(y ~ x, Qunif(min = TRUE)) # U(a,b)
m6 <- Qest(y ~ x, Qunif(min = FALSE)) # U(0,b)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.