Learn R Programming

frm (version 1.2.2)

frm: Fitting Fractional Regression Models

Description

frm is used to fit fractional regression models, i.e. regression models for proportions, percentages or fractions.

Usage

frm(y, x, x2 = x, linkbin, linkfrac, type = "1P", inflation = 0, intercept = T, table = T, variance = T, var.type = "default", var.eim = T, var.cluster, dfc = F,...)

Arguments

y
a numeric vector containing the values of the response variable.
x
a numeric matrix, with column names, containing the values of the covariates.
x2
a numeric matrix, with column names, containing the values of the covariates in the fractional component of two-part models if option type = "2P" is defined. Defaults to x.
linkbin
a description of the link function to use in the binary component of a two-part fractional regression model. Available options: logit, probit, cauchit, loglog, cloglog.
linkfrac
a description of the link function to use in standard fractional regression models or in the fractional component of a two-part fractional regression model. Available options: logit, probit, cauchit, loglog, cloglog.
type
a description of the model to estimate: a standard one-part model (1P, the default), a two-part model (2P), the binary component of a two-part model (2Pbin) or the fractional component of a two-part model (2Pfrac).
inflation
a numeric value indicating which of the extreme values of 0 (the default) or 1 is the relevant boundary value for defining two-part fractional regression models.
intercept
a logical value indicating whether the model should include a constant term or not.
table
a logical value indicating whether a summary table with the regression results should be printed.
variance
a logical value indicating whether the variance of the estimated parameters should be calculated. Defaults to TRUE whenever table = TRUE.
var.type
a description of the type of variance of the estimated parameters to be calculated. Options are standard (recommended for models estimated by maximum likelihood, such as the binary component of two-part models), robust (recommended for models estimated by quasi-maximum likelihood, such as standard fractional regression models or the fractional component of a two-part fractional regression model), cluster (recommended in the case of panel data) and default (implements the standard or robust versions as appropriate).
var.eim
a logical value indicating whether the expected information matrix should be used in the calculation of the variance. When false, the observation information matrix will be used. Defaults to TRUE.
var.cluster
a numeric vector containing the values of the variable that specifies to which cluster each observation belongs.
dfc
a logical value indicating whether a degrees of freedom correction should be applied to the covariance matrix. Defaults to FALSE.
...
Arguments to pass to glm.

Value

When type = "1P" or "2Pfrac", frm returns a list with the following elements:
class
"frm".
formula
the model formula.
type
the name of the estimated model.
link
the name of the specified link.
method
estimation method. Currently, "QML" (quasi-maximum likelihood) for fractional components or models and "ML" (maximum likelihood) for the binary component of two-part models.
p
a named vector of coefficients.
yhat
the fitted mean values.
xbhat
the fitted mean values of the linear predictor.
converged
logical. Was the algorithm judged to have converged?
x.names
a vector containing the names of the covariates.
If variance = TRUE or table = TRUE, the previous list also contains the following elements:
p.var
a named covariance matrix.
var.type
covariance matrix type.
var.eim
logical. Was the expected information matrix used in the computation of the covariance matrix?
dfc
logical. Was a degrees of freedom correction used for the computation of the covariance matrix?
If var.type = "cluster", the list also contains the following element:
var.cluster
the variable that specifies to which cluster each observation belongs.
When type = "2Pbin", frm returns a similar list with the following additional element:
LL
the value of the log-likelihood.
When type = "2P", frm returns the previous lists, indexed by the prefixes resBIN and resFRAC, and the following additional elements:
class
"frm".
type
"2P".
ybase
a numeric vector containing the values of the response variable.
x2base
a numeric matrix containing the values of the covariates.
yhat2P
the overall fitted mean values.
converged
logical. Were the algorithms judged to have converged in both parts of the model?

Details

frm estimates one- and two-part fractional regression models; see Ramalho, Ramalho and Murteira (2011) for details on those models. The one-part models and the fractional component of two-part models are estimated by Bernoulli-based quasi-maximum likelihood, while the binary component of two-part models is estimated by maximum likelihood. frm uses the standard glm command to perform the estimations. Therefore, frm is essentially a convenience command, allowing estimation of several alternative fractional regression models using the same command. In addition, frm provides an R-squared measure for all models (calculated as the square of the correlation coefficient between the actual and fitted values of the dependent variable), calculates the fitted values of the dependent variable in two-part models and stores the information needed to implement some very useful commands for fractional regression models: frm.reset (RESET test), frm.ptest (P test), frm.ggoff (GGOFF tests) and frm.pe (partial effects).

References

Ramalho, E.A., J.J.S. Ramalho and J.M.R. Murteira (2011), "Alternative estimating and testing empirical strategies for fractional regression models", Journal of Economic Surveys, 25(1), 19-68.

See Also

frm.reset and frm.ggoff, for specification tests. frm.ptest, for non-nested hypothesis tests. frm.pe, for computing partial effects. frmhet, for fitting cross-sectional fractional regression models with unobserved heterogeneity. frmpd, for fitting panel data fractional regression models.

Examples

Run this code
N <- 250
u <- rnorm(N)

X <- cbind(rnorm(N),rnorm(N))
dimnames(X)[[2]] <- c("X1","X2")

ym <- exp(X[,1]+X[,2]+u)/(1+exp(X[,1]+X[,2]+u))
y <- rbeta(N,ym*20,20*(1-ym))
y[y > 0.9] <- 1

#frm estimation of a logit fractional regression model
frm(y,X,linkfrac="logit")

#frm estimation of the binary logit component of the two-part fractional
#regression model with y=1 as the relevant boundary value
frm(y,X,linkbin="logit",type="2Pbin",inf=1)

#frm estimation of the fractional component of the two-part fractional
#regression model with y=1 as the relevant boundary value and using a
#probit link function
frm(y,X,linkfrac="probit",type="2Pfrac",inf=1)

#frm estimation of both components of a two-part fractional regression model
#with y=1 as the relevant boundary value and using a cloglog binary link
#function and a logit fractional link function
frm(y,X,linkbin="cloglog",linkfrac="logit",type="2P",inf=1)

## See the website http://evunix.uevora.pt/~jsr/FRM.htm for more examples.

Run the code above in your browser using DataLab