cmidecdf: Mid-distribution Functions

View source: R/Qtools_mid.R

cmidecdfR Documentation

Mid-distribution Functions

Description

Compute conditional mid-cumulative probabilities

Usage

cmidecdf(formula, data, ecdf_est = "npc", npc_args = list(),
	theta = NULL, subset, weights, na.action,
	contrasts = NULL)
cmidecdf.fit(x, y, intercept, ecdf_est, npc_args = list(),
	theta = NULL)

Arguments

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under ‘Details’.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. By default the variables are taken from the environment from which the call is made.

ecdf_est

estimator of the (standard) conditional cumulative distribution. The options are: npc (default) for kernel estimator (Li and Racine, 2008); logit, probit, cloglog for binomial regression; ao for Aranda-Ordaz binomial regression.

npc_args

named list of arguments for npcdistbw when ecdf_est = npc.

theta

values of the Aranda-Ordaz transformation parameter for grid search when ecdf_est = "ao".

subset

an optional vector specifying a subset of observations to be used in the fitting process.

weights

an optional vector of weights to be used in the fitting process. Not currently implemented.

na.action

a function which indicates what should happen when the data contain NAs.

contrasts

an optional list. See the contrasts.arg of model.matrix.default.

x

design matrix of dimension n * p.

y

vector of observations of length n.

intercept

logical flag. Does x include a vector of ones?

Value

An object of class class cmidecdf with mid-cumulative probabilities. This is a list that contains:

G

Estimated conditional mid-probabilities. This is a n * k matrix, where n is the sample size and k is the number of unique values of y.

Fhat

Estimated (standard) cumulative probabilities.

Fse

Standard error for Fhat.

yo

unique values of y.

bw

npcdistbw object.

ecdf_est

estimator used.

Author(s)

Marco Geraci with contributions from Alessio Farcomeni

References

Geraci, M. and A. Farcomeni. Mid-quantile regression for discrete responses. arXiv:1907.01945 [stat.ME]. URL: https://arxiv.org/abs/1907.01945.

Li, Q. and J. S. Racine (2008). Nonparametric estimation of conditional cdf and quantile functions with mixed categorical and continuous data. Journal of Business and Economic Statistics 26(4), 423-434.

Peracchi, F. (2002). On estimating conditional quantiles and distribution functions. Computational Statistics and Data Analysis 38(4), 433-447.

See Also

midecdf

Examples


## Not run: 
n <- 100
x <- rnorm(n, 0, 3)
y <- floor(1 + 2*x) + sample(1:5, n, replace = TRUE)
cmidecdf(y ~ x, ecdf_est = "logit")

## End(Not run)


Qtools documentation built on Nov. 2, 2023, 6:11 p.m.