Sample quantiles in each cluster of observations.
clusterQp(
formula,
data,
f_sum_ = mean,
from = 0.01,
to = 0.99,
by = 0.01,
type = 7,
...
)
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.
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
function to summarize the sample quantiles from lower-level cluster \(c_2\) (if present), such as mean (default), median, max, min, etc.
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
additional parameters, currently not in use
# see ?`Qindex-package` for examples
Run the code above in your browser using DataLab