Description Usage Arguments Details Value Note See Also Examples
View source: R/make_quantile_matrix_WQS.R
Scores quantiles from a numeric matrix. If the matrix has values missing between zero and some threshold, say the detection limit, all these missing values (indicated by NA) are placed into the first quantile.
1 2 3 4 5 6 7 |
X |
A numeric matrix. Any missing values are indicated by NA's. |
n.quantiles |
An integer specifying the number of quantiles in categorizing the columns of X, e.g. in quartiles (q = 4), deciles (q = 10), or percentiles (q = 100). Default: 4L. |
place.bdls.in.Q1 |
Logical; if TRUE or X has any missing values, missing values in X are placed in the first quantile of the weighted sum. Otherwise, the data is complete (no missing data) and the data is equally split into quantiles. |
... |
further arguments passed to or from other methods. |
verbose |
Logical; if TRUE, prints more information. Useful to check for any errors in the code. Default: FALSE. |
Produces sample quantiles for a matrix X using quantile
() function. Names are kept and the 7th quantile algorithm is used. As ties between quantiles may exist, .bincode
() is used.
When there is missing data (as indicated by NA's), make.quantile.matrix
places all of the censored data into the first quantile. The remaining quantiles are evenly spread over the observed data. A printed message is displaced what the function does.
A matrix of quantiles with rows = nrow(X) and with columns = n.quantiles.
Developed as an accessory function for estimate.wqs()
.
Other wqs:
analyze.individually()
,
coef.wqs()
,
do.many.wqs()
,
estimate.wqs.formula()
,
estimate.wqs()
,
plot.wqs()
,
print.wqs()
1 2 3 4 5 6 7 8 9 | # Example 1: Make quantiles for first nine chemicals using complete chemical data
data(simdata87)
q <- make.quantile.matrix(simdata87$X.true[, 1:9], 4)
q <- apply(q, 2, as.factor)
summary(q)
# Example 2: Place missing values of first nine chemicals in first quantiles
q2 <- make.quantile.matrix(simdata87$X.bdl[, 1:9], 4, verbose = TRUE)
summary(q2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.