You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/create_comparison_matrix.R
+34-16Lines changed: 34 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -1,27 +1,45 @@
1
1
2
2
3
-
# comparisons = "one-v-all"
4
-
# comparisons = "prop-realloc"
5
-
# comparisons = "one-v-one"
6
3
4
+
#' Creates row-wise perturbations of compositions from the mean composition
5
+
#'
6
+
#' @param comparisons currently two choices: \code{"one-v-one"} or \code{"prop-realloc"} (default).
7
+
#' @param comps the names (character vector) of the compositional variables
8
+
#' @param mean_comps the mean composition of \code{comps}
9
+
#' @details
10
+
#' \code{comparisons = "one-v-one"} creates a matrix with \code{length(comps)} columns and \code{length(comps) * (length(comps) - 1)} rows.
11
+
#' The rows contain all pairs of variables with 1 and -1 values.
12
+
#'
13
+
#' \code{comparisons = "prop-realloc"} creates a matrix with \code{length(comps)} columns and \code{length(comps)} rows.
14
+
#' Each rows contains a 1 value for a compositional variable and the remaining values sum to -1 proportional to the \code{mean_comps} value for those variables.
15
+
#'
16
+
#' Note that for both \code{comparisons} options the net change is 0 (each row sums to 0).
Copy file name to clipboardExpand all lines: R/fairclough.R
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
#' Data from Fairclough (2017). Fitness, fatness and the reallocation of time between children’s daily movement behaviours: an analysis of compositional data
1
+
#' Data from Fairclough (2017). Fitness, fatness and the reallocation of time between children's daily movement behaviours: an analysis of compositional data
2
2
#'
3
3
#' A dataset containing z_bmi (outcome), time-use compositions (sl,sb,lpa,mvpa), and covariates
4
4
#' from the Fairclough (2017) paper. The data can be found in supp file 7 of the paper
0 commit comments