Learn R Programming

Qindex (version 0.1.6)

clusterQp: Cluster-Specific Sample Quantiles

Description

Sample quantiles in each cluster of observations.

Usage

clusterQp(
  formula,
  data,
  f_sum_ = mean,
  from = 0.01,
  to = 0.99,
  by = 0.01,
  type = 7,
  ...
)

Value

Function clusterQp returns an aggregated data.frame, in which

  • cluster(s) \(c\)'s and cluster-specific covariate(s) \(x\)'s are retained.

    • If the input formula takes form of y ~ . | c1 or y ~ . - z1 | c1, then all covariates (except for \(z_1\)) are considered cluster-specific thus are all retained;

    • Currently, only the highest cluster \(c_1\) is retained. Sample quantiles from lower-level clusters are summarized using f_sum_.

  • response \(y\) is removed; instead, a double matrix of \(N\) columns stores the cluster-specific sample quantiles \(\mathbf{q}\) of the response \(y\). This matrix

    • is named after the parsed expression of response \(y\) in formula;

    • colnames are the probabilities \(\mathbf{p}\), for the ease of subsequent programming.

Arguments

formula

formula to specify the response \(y\), cluster(s) \(c\)'s, cluster-specific covariate(s) \(x\)'s to be retained, and cluster-specific covariate(s) \(z\)'s to be removed from data, e.g.,

y ~ 1 | c1

cluster \(c_1\), without cluster-specific covariate

y ~ 1 | c1/c2

cluster \(c_1\), and cluster \(c_2\) nested in \(c_1\), without cluster-specific covariate

y ~ x1 + x2 | c1

cluster \(c_1\), and cluster-specific covariates \(x_1\) and \(x_2\)

y ~ . | c1

cluster \(c_1\), and all (supposedly cluster-specific) covariates from data

y ~ . - z1 - z2 | c1

cluster \(c_1\), and all (supposedly cluster-specific) covariates, except for \(z_1\) and \(z_2\), from data

data

data.frame

f_sum_

function to summarize the sample quantiles from lower-level cluster \(c_2\) (if present), such as mean (default), median, max, min, etc.

from, to, by

double scalars, the starting, end, and increment values of a probability sequence \(\mathbf{p} = (p_1,\cdots,p_N)'\) shared by all clusters, where the cluster-specific sample quantiles \(\mathbf{q} = (q_1,\cdots,q_N)'\) of response \(y\) are calculated

type

integer scalar, see argument type of function quantile

...

additional parameters, currently not in use

Examples

Run this code
# see ?`Qindex-package` for examples

Run the code above in your browser using DataLab