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 y, 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 x_1 and x_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 z_1 and z_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 = (p_1,\cdots,p_N)' for the sample quantiles q = (q_1,\cdots,q_N)'

type

integer scalar, type of quantile algorithm

...

additional parameters, currently not in use

Details

Function clusterQp() calculates N 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 N columns is created to store the sample quantiles q of each aggregated cluster. The column names of this quantile matrix are the probabilities p.

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]