clusterQp {Qindex}R Documentation

Cluster-Specific Sample Quantiles

Description

Obtain vectors of sample quantiles in each cluster of observations

Usage

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

Arguments

formula

formula passed to aggregate.formula. To calculate the cluster-specific statistics for response yy, the user may use

y ~ id

to retain only the cluster id in the returned value

y ~ id + x1 + x2

to retain the cluster id and cluster-specific variables x1x_1 and x2x_2 in the returned value

y ~ .

to retain all (supposedly cluster-specific) variables from data in the returned value

data

data.frame

exclude

(optional) formula or character vector, (supposedly non-cluster-specific) variables to be excluded from aggregation. To remove variables z1z_1 and z2z_2, the user may use either

  • exclude = c('z1', 'z2'); or

  • exclude = . ~ . - z1 - z2

from, to, by

double scalars, the starting, end, and increment values to specify a sequence of probabilities p=(p1,,pN)p = (p_1,\cdots,p_N)' for the sample quantiles q=(q1,,qN)q = (q_1,\cdots,q_N)'

type

integer scalar, type of quantile algorithm

...

additional parameters, currently not in use

Details

Function clusterQp() calculates NN sample quantiles in each aggregated cluster of observations. The aggregation is specified by parameters formula and exclude.

Value

Function clusterQp() returns an aggregated data.frame. A double matrix of NN columns is created to store the sample quantiles qq of each aggregated cluster. The column names of this quantile matrix are the probabilities pp.

Examples

Ki67q = clusterQp(Marker ~ ., data = Ki67, exclude = c('tissueID','inner_x','inner_y'))
tmp = clusterQp(Marker ~ ., data = Ki67, exclude = . ~ . - tissueID - inner_x - inner_y)
# stopifnot(identical(Ki67q, tmp))
# stopifnot(!anyDuplicated.default(Ki67q$subjID))
head(Ki67q)
sapply(Ki67q, FUN = class)


[Package Qindex version 0.1.5 Index]