Compute statistics from a tatami::Matrix while skipping NaNs.
More...
|
| template<typename Value_ , typename Index_ , typename Group_ , typename Output_ , typename Count_ > |
| void | group_rss (bool row, const tatami::Matrix< Value_, Index_ > &mat, const Group_ *const group, const std::size_t num_groups, GroupRssBuffers< Output_, Count_ > &output, const GroupRssOptions &opt) |
| |
| template<typename Output_ , typename Count_ , typename Value_ , typename Index_ , typename Group_ > |
| GroupRssResult< Output_, Count_ > | group_rss (bool row, const tatami::Matrix< Value_, Index_ > &mat, const Group_ *const group, const std::size_t num_groups, const GroupRssOptions &opt) |
| |
| template<typename Value_ , typename Index_ , typename Output_ , typename Count_ > |
| void | rss (bool row, const tatami::Matrix< Value_, Index_ > &mat, RssBuffers< Output_, Count_ > &output, const RssOptions &opt) |
| |
| template<typename Output_ = double, typename Count_ , typename Value_ , typename Index_ > |
| RssResult< Output_, Count_ > | rss (bool row, const tatami::Matrix< Value_, Index_ > &mat, const RssOptions &opt) |
| |
Compute statistics from a tatami::Matrix while skipping NaNs.
◆ group_rss() [1/2]
template<typename Value_ , typename Index_ , typename Group_ , typename Output_ , typename Count_ >
| void tatami_stats::skip_nan::group_rss |
( |
bool | row, |
|
|
const tatami::Matrix< Value_, Index_ > & | mat, |
|
|
const Group_ *const | group, |
|
|
const std::size_t | num_groups, |
|
|
GroupRssBuffers< Output_, Count_ > & | output, |
|
|
const GroupRssOptions & | opt ) |
Compute per-group variances for each element of a chosen dimension of a tatami::Matrix.
- Template Parameters
-
| Value_ | Numeric type of the matrix value. |
| Index_ | Integer type of the row/column indices. |
| Group_ | Integer type of the group assignments for each row/column. |
| Output_ | Floating-point type of the output value. This should be capable of storing NaNs. |
| Count_ | Numeric type of the non-NaN counts. This is typically an integer type. |
- Parameters
-
| row | Whether to compute variances for the rows. |
| mat | Instance of a tatami::Matrix. |
| [in] | group | Pointer to an array of length equal to the number of columns (if row = true) or rows (otherwise). Each value should be an integer that specifies the group assignment. Values should lie in \([0, N)\) where \(N\) is the number of unique groups. |
| num_groups | Number of groups, i.e., \(N\). |
| [out] | output | Buffers in which to store the results. On output, each array stores the means and variances of the corresponding group. |
| opt | Further options. |
◆ group_rss() [2/2]
template<typename Output_ , typename Count_ , typename Value_ , typename Index_ , typename Group_ >
Compute per-group variances for each element of a chosen dimension of a tatami::Matrix.
- Template Parameters
-
| Output_ | Floating-point type of the output value. This should be capable of storing NaNs. |
| Count_ | Numeric type of the non-NaN counts. This is typically an integer type. |
| Value_ | Numeric type of the matrix value. |
| Index_ | Integer type of the row/column indices. |
| Group_ | Integer type of the group assignments for each row/column. |
- Parameters
-
| row | Whether to compute variances for the rows. |
| mat | Instance of a tatami::Matrix. |
| [in] | group | Pointer to an array of length equal to the number of columns (if row = true) or rows (otherwise). Each value should be an integer that specifies the group assignment. Values should lie in \([0, N)\) where \(N\) is the number of unique groups. |
| num_groups | Number of groups, i.e., \(N\). |
| opt | Further options. |
- Returns
- RSS and mean of each group for each row/column.
◆ rss() [1/2]
template<typename Value_ , typename Index_ , typename Output_ , typename Count_ >
Compute residual sums of squares (RSS) for each element of a chosen dimension of a tatami::Matrix, after skipping any NaNs. This may use either Welford's method or the standard two-pass method, depending on the dimension in row and the preferred access dimension of p.
- Template Parameters
-
| Value_ | Numeric type of the input data. |
| Index_ | Integer type of the row/column indices. |
| Output_ | Floating-point type of the output data. This should be capable of storing NaNs. |
| Count_ | Numeric type of the non-NaN counts. This is typically an integer type. |
- Parameters
-
| row | Whether to compute the RSS for each row. If false, the RSS is computed for each column instead. |
| mat | Instance of a tatami::Matrix. |
| [out] | output | Buffers to output arrays. On output, this will contain the row/column RSSs. |
| opt | Further options. |
◆ rss() [2/2]
template<typename Output_ = double, typename Count_ , typename Value_ , typename Index_ >
Overload of skip_nan::rss() that allocates memory for the output arrays.
- Template Parameters
-
| Output_ | Floating-point type of the output data. This should be capable of storing NaNs. |
| Count_ | Numeric type of the non-NaN counts. This is typically an integer type. |
| Value_ | Numeric type of the input data. |
| Index_ | Integer type of the row/column indices. |
- Parameters
-
| row | Whether to compute the RSS for each row. If false, the RSS is computed for each column instead. |
| mat | Instance of a tatami::Matrix. |
| opt | Further options. |
- Returns
- The mean and RSS of each row/column.