Skip to content

Commit 3d1ab36

Browse files
RJ-2024-011 remove blue text
1 parent cba9b6e commit 3d1ab36

File tree

2 files changed

+136
-136
lines changed

2 files changed

+136
-136
lines changed

_articles/RJ-2024-011/RJ-2024-011.Rmd

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ of syllables making up the songs as well as the lengths of
155155
inter-syllable intervals (ISIs). The data set `foxp2` included in the
156156
**BMRMM** package is taken from the simulation study of
157157
[@wu2021bayesian]. It is much shorter than the real FoxP2 data set but
158-
closely mimics its other aspects and is used]{style="color: blue"} in
158+
closely mimics its other aspects and is used] in
159159
this paper to demonstrate how to obtain detailed inferences for both
160160
syllable transitions and ISI dynamics for a comprehensive analysis of
161161
the vocal repertoire in mice with and without the FoxP2 mutation.
@@ -215,7 +215,7 @@ Bayesian M(R)MMs.
215215
Documentation for the functions of the **BMRMM** package is then
216216
provided. Next, we demonstrate the usage of our package in analyzing two
217217
different data sets. The final section contains some concluding remarks.
218-
]{style="color: blue"}
218+
]
219219

220220
## The Bayesian Markov (renewal) mixed models {#sec:models}
221221

@@ -276,7 +276,7 @@ $\boldsymbol\lambda_{trans,x_1=1,x_2,\dots,x_p}(\cdot\mid y_{t-1})$ and
276276
$\boldsymbol\lambda_{trans,x_1=2,x_2,\dots,x_p}(\cdot\mid y_{t-1})$ would be
277277
equal if levels 1 and 2 of covariate 1 have similar influences on
278278
transition dynamics for fixed levels for covariates
279-
$2, \dots, p$.]{style="color: blue"} A clustering mechanism for
279+
$2, \dots, p$.] A clustering mechanism for
280280
covariate levels allows the fixed component
281281
$\boldsymbol\lambda_{trans,x_1,\dots,x_p}(\cdot\mid y_{t-1})$ to be the same
282282
for all levels with a similar influence. In particular, for covariate
@@ -289,7 +289,7 @@ indicate the cluster index for the $\ell^{th}$ label of covariate $j$.
289289
[Two levels of the covariate $j$,
290290
$\ell_1, \ell_2 \in {\cal X}_j = \{1,\dots,d_j\}$, are clustered
291291
together if and only if
292-
$z_{trans,j,\ell_1} = z_{trans,j,\ell_2}$.]{style="color: blue"} For the
292+
$z_{trans,j,\ell_1} = z_{trans,j,\ell_2}$.] For the
293293
fixed effects, we then replace the covariate levels $x_1,\dots,x_p$'s
294294
with cluster indices $h_1,\dots,h_p$'s and present the fixed effect as
295295
$\boldsymbol\lambda_{trans,h_{1},\dots,h_{p}}(\cdot\mid y_{t-1})$.
@@ -410,7 +410,7 @@ Inference is based on samples drawn from the posterior using a
410410
[Metropolis-Hastings-within-Gibbs MCMC algorithm. Most full conditionals
411411
are available in closed form and can be directly sampled from. A
412412
Metropolis-Hastings step is however used for updating the discrete
413-
valued cluster configurations.]{style="color: blue"} There is, however,
413+
valued cluster configurations.] There is, however,
414414
no conjugate prior for gamma distributions with unknown shape parameters
415415
[@damsleth1975conjugate]. Recently, @miller2019fast designed a procedure
416416
that efficiently approximates the posterior full conditionals of gamma
@@ -428,7 +428,7 @@ out detailed analyses of the state transitions and their duration times
428428
package includes a number of supplementary functions that use the
429429
results of the main function to produce numerical summaries,
430430
visualizations, and diagnostics. Table \@ref(tab:fn) provides a brief
431-
description of all functions. ]{style="color: blue"}
431+
description of all functions. ]
432432

433433
::: {#tab:fn}
434434
```{r fn, echo = FALSE, results = 'asis'}
@@ -453,7 +453,7 @@ BMRMM(data, num.cov, cov.labels = NULL, state.labels = NULL,
453453
```
454454

455455
[The parameter `data` specifies the target data set and needs to follow
456-
a certain structure. ]{style="color: blue"} The first column should list
456+
a certain structure. ] The first column should list
457457
the individual IDs $i_{s}$, followed by $p$ columns for the values of
458458
the $p$ associated covariates $x_{s,j}$, then two columns for the values
459459
of the previous state $y_{s,t-1}$, the current state $y_{s,t}$, and
@@ -462,7 +462,7 @@ one to five categorical covariates that take on values ${1,2,\dots}$.
462462
The duration times column is optional if the user would like to use BMMM
463463
instead of BMRMM to analyze just the state transitions. This is shown in
464464
Table [2](#tab:data-cols). The users can look at the included
465-
[simulated data set]{style="color: blue"} `foxp2` as an example.
465+
[simulated data set] `foxp2` as an example.
466466

467467
::: {#tab:data-cols}
468468
---------------------------------------------------------------------------------------------------
@@ -479,33 +479,33 @@ Table [2](#tab:data-cols). The users can look at the included
479479
names of covariate levels in the covariate order that is presented in
480480
`data` while the parameter `state.labels` is a vector providing the
481481
names of the transition states. The default labels are Arabic numerals.
482-
]{style="color: blue"} The [`random.effect`]{style="color: blue"}
482+
] The [`random.effect`]
483483
parameter gives users the option to exclude the random individual
484-
effects. If [`random.effect`]{style="color: blue"} is set to `FALSE`,
484+
effects. If [`random.effect`] is set to `FALSE`,
485485
the transition probabilities (and the mixture probabilities for duration
486486
times, if applicable) will only consider the influence of the covariate
487-
levels. Similarly, the [`fixed.effect`]{style="color: blue"} parameter
487+
levels. Similarly, the [`fixed.effect`] parameter
488488
allows users to exclude the fixed population effects. [The default
489489
values for `random.effect` and `fixed.effect` are both
490-
`TRUE`.]{style="color: blue"} The covariate indices for the two analyses
490+
`TRUE`.] The covariate indices for the two analyses
491491
can be specified by setting `trans.cov.index` and `duration.cov.index`.
492492
[We note that indices specified by `trans.cov.index` and
493493
`duration.cov.index` refer to the index of the covariate when the first
494494
covariate is given index 1, thus different from its index in
495-
`data`.]{style="color: blue"}
495+
`data`.]
496496

497497
[Users can define `duration.distr` in the following three
498-
ways.]{style="color: blue"}
498+
ways.]
499499

500500
1. [If users set `duration.distr` to be `NULL`, which is the default
501501
setting, then the duration times will be ignored and not modeled at
502-
all. ]{style="color: blue"} The BMMM described will be implemented
502+
all. ] The BMMM described will be implemented
503503
to analyze the existing state transitions alone.
504504

505505
2. [If `duration.distr` is set as `list(‘mixDirichlet’, unit)`, the
506506
duration times will be used to construct a new state `‘dur.state’`,
507507
which will be analyzed along with the original set of states.
508-
]{style="color: blue"} The additional argument `unit` must be
508+
] The additional argument `unit` must be
509509
defined and acts both as a threshold and as a block size for
510510
duration times. For example, if the `unit` is set to $5$, then for
511511
each duration value greater than $5$ units, each block of $5$ unit
@@ -515,7 +515,7 @@ ways.]{style="color: blue"}
515515
seconds, then the updated Markov sequence will contain three
516516
consecutive `‘dur.state’` states, i.e.,
517517
`(‘a’, ‘dur.state’, ‘dur.state’, ‘dur.state’, ‘b’)`.
518-
]{style="color: blue"} Since we adopt the floor operation, a
518+
] Since we adopt the floor operation, a
519519
duration time of say $17.68$ seconds will also be replaced by three
520520
consecutive instances of `’dur.state’` states in this example. The
521521
BMMM model will then be implemented to analyze the resulting
@@ -528,19 +528,19 @@ ways.]{style="color: blue"}
528528
3. [If `duration.distr` is set to be `list(‘mixgamma’, shape, rate)`,
529529
the duration times are modeled as a continuous random variable using
530530
a flexible mixture of gamma kernels, as described for a BMRMM
531-
model.]{style="color: blue"} In this case, users can specify the
531+
model.] In this case, users can specify the
532532
prior shape and rate parameters with the `shape` and `rate`
533533
arguments within the definition of `duration.distr`. We note that
534534
`shape` and `rate` must be numeric vectors of the same length.
535535

536536
By default, we consider the previous state $y_{s,t-1}$ as a covariate
537537
when we model the duration times as continuous variables, i.e.,
538-
[`duration.incl.prev.state`]{style="color: blue"} is set to `TRUE`.
538+
[`duration.incl.prev.state`] is set to `TRUE`.
539539
Users can set this parameter to `FALSE` if they wish to exclude the
540540
previous state when analyzing the duration times. [The remaining
541541
parameters `simsize` and `burnin` denote the total number of MCMC
542542
iterations and the number of burn-ins, respectively.
543-
]{style="color: blue"}
543+
]
544544

545545
::: {#tab:bmrmm}
546546
----------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -550,21 +550,21 @@ iterations and the number of burn-ins, respectively.
550550

551551
`num.cov` an integer giving the number of observed covariates in `data`
552552

553-
[`cov.labels`]{style="color: blue"} a list of vectors giving names of all covariate levels [`NULL`]{style="color: blue"}
553+
[`cov.labels`] a list of vectors giving names of all covariate levels [`NULL`]
554554

555-
[`state.labels`]{style="color: blue"} a vector giving names of the states [`NULL`]{style="color: blue"}
555+
[`state.labels`] a vector giving names of the states [`NULL`]
556556

557-
[`random.effect`]{style="color: blue"} `TRUE` if random individual effects are included [`TRUE`]{style="color: blue"}
557+
[`random.effect`] `TRUE` if random individual effects are included [`TRUE`]
558558

559-
[`fixed.effect`]{style="color: blue"} `TRUE` if fixed population effects are included [`TRUE`]{style="color: blue"}
559+
[`fixed.effect`] `TRUE` if fixed population effects are included [`TRUE`]
560560

561561
`trans.cov.index` selects the covariates to analyze for transition probabilities `1:num.cov`
562562

563563
`duration.cov.index` selects the covariates to analyze for duration times `1:num.cov`
564564

565565
`duration.distr` specifies the distribution for duration times `NULL`
566566

567-
[`duration.incl.prev.state`]{style="color: blue"} `TRUE` if $y_{t-1}$ acts as a covariate for the analysis of duration times [`TRUE`]{style="color: blue"}
567+
[`duration.incl.prev.state`] `TRUE` if $y_{t-1}$ acts as a covariate for the analysis of duration times [`TRUE`]
568568

569569
`simsize` number of MCMC iterations 10000
570570

@@ -577,7 +577,7 @@ iterations and the number of burn-ins, respectively.
577577
The `BMRMM` function returns [an object of class `BMRMM`, which either
578578
contains only `results.trans` or both of `results.trans` and
579579
`results.duration` if duration times follow a mixture gamma
580-
distribution.]{style="color: blue"} For the state transitions, the
580+
distribution.] For the state transitions, the
581581
posterior mean transition probability matrices for each combination of
582582
the covariate levels and each individual are given by
583583
`results.trans$tp.exgns.post.mean` and
@@ -593,10 +593,10 @@ transition probabilities, `results.duration$clusters` gives the cluster
593593
configurations of the covariates. Other elements of `results.trans` and
594594
`results.duration` can be found in the detailed R function description.
595595

596-
### [Summarizing BMRMM results]{style="color: blue"}
596+
### [Summarizing BMRMM results]
597597

598598
[The **BMRMM** package provides an S3 method for summarizing results of
599-
a `BMRMM` object as follows. ]{style="color: blue"}
599+
a `BMRMM` object as follows. ]
600600

601601
``` r
602602
summary.BMRMM(object, delta = 0.02, digits = 2, ...)
@@ -607,14 +607,14 @@ associated with local tests for transition probabilities, which we will
607607
explain further. The `digit` parameter is an integer used for number
608608
formatting, as in the general `summary` function. The `summary.BMRMM`
609609
function returns an object of class `BMRMMsummary` with the following
610-
fields. ]{style="color: blue"}
610+
fields. ]
611611

612612
- `trans.global` and `dur.global`
613613

614614
[These two fields give the global test results from the inference of
615615
transition probabilities and duration times. Global tests show the
616616
significance of the covariates in affecting the state transitions
617-
and duration times. ]{style="color: blue"} Specifically, for each
617+
and duration times. ] Specifically, for each
618618
covariate, the empirical distribution of the size of the clusters in
619619
the stored MCMC iterations is calculated. The null hypothesis that a
620620
covariate is not important is equivalent to the event that all its
@@ -633,15 +633,15 @@ fields. ]{style="color: blue"}
633633
transition probabilities. Local tests analyze the differences
634634
between the transition probabilities associated with two different
635635
levels of a covariate $j$, fixing the levels of the other
636-
covariates.]{style="color: blue"} For every pair of levels of
636+
covariates.] For every pair of levels of
637637
covariate $j$, `trans.local.mean.diff` gives the absolute
638638
differences in transition probabilities for each transition type in
639639
the MCMC iterations. The local null hypothesis we test for each
640640
transition type is that this difference is at least the
641641
pre-specified value `delta`. [Meanwhile, `trans.local.null.test`
642642
gives the probability of the null hypothesis that the difference
643643
between two covariate levels is not significant under each
644-
transition type. ]{style="color: blue"}
644+
transition type. ]
645645

646646
- `dur.mix.params` and `dur.mix.probs`
647647

@@ -651,7 +651,7 @@ fields. ]{style="color: blue"}
651651
probabilities by calling the field `dur.mix.probs`, which can be
652652
further used to estimate the length of the duration times.
653653

654-
### [Visualizing results with BMRMM plotting functions]{style="color: blue"}
654+
### [Visualizing results with BMRMM plotting functions]
655655

656656
[The main plotting function of the package, `plot.BMRMMsummary`, is an
657657
S3 method for class `BMRMMsummary`. It gives the barplots for global
@@ -661,7 +661,7 @@ mixture parameters and probabilities for duration times. The parameters
661661
of `plot.BMRMMsummary` include `x`, which must be an object of class
662662
`BMRMMsummary` and `type`, which is a single string representing the
663663
field of `x` that needs to be plotted. The function also takes general
664-
plotting arguments such as `xlab`, `ylab`, etc. ]{style="color: blue"}
664+
plotting arguments such as `xlab`, `ylab`, etc. ]
665665

666666
``` r
667667
plot.BMRMMsummary(x, type, xlab = NULL, ylab = NULL, main = NULL, col = NULL, ...)
@@ -681,7 +681,7 @@ component `comp` will be presented alongside the mixture gamma
681681
distribution with the shape and rate parameters from the last MCMC
682682
iteration. Users can refer to the documentation of the general `hist`
683683
function to see the interpretation for the rest of the parameters.
684-
]{style="color: blue"}
684+
]
685685

686686
``` r
687687
hist.BMRMM(x, comp = NULL, xlim = NULL, breaks = NULL, main = NULL,
@@ -696,13 +696,13 @@ state transitions they are interested in by defining `cov.combs` and
696696
`transitions`, respectively. For duration times, users can define
697697
`components`, a numeric vector, to obtain the diagnostic plots for shape
698698
and rate parameters of the specific component
699-
kernels.]{style="color: blue"}
699+
kernels.]
700700

701701
``` r
702702
diag.BMRMM(object, cov.combs = NULL, transitions = NULL, components = NULL)
703703
```
704704

705-
### [Model selection scores for continuous duration times]{style="color: blue"}
705+
### [Model selection scores for continuous duration times]
706706

707707
When the duration times are modeled using mixtures of gamma
708708
distributions, model selection can be performed on the number of mixture
@@ -713,7 +713,7 @@ model.selection.scores(object)
713713
```
714714

715715
[The function takes an `object` as its input, which must be an object of
716-
class `BMRMM`. It returns a list consisting of]{style="color: blue"} the
716+
class `BMRMM`. It returns a list consisting of] the
717717
log pseudo marginal likelihood (LPML) [@geisser1979predictive] and the
718718
widely applicable information criterion (WAIC) [@watanabe2010asymptotic]
719719
scores of the model. Larger values of LPML and smaller values of WAIC
@@ -738,7 +738,7 @@ gene on human vocal communication abilities and related deficiencies.
738738
simulated a data set that closely mimics the real one. For demonstrating
739739
the **BMRMM** package, we included in it a shortened version of this
740740
synthetic data set which we refer to as the `foxp2` data set.
741-
]{style="color: blue"} The `foxp2` synthetic data set has $17391$ rows
741+
] The `foxp2` synthetic data set has $17391$ rows
742742
and $6$ columns, which are Id, Genotype, Context, Prev_State, Cur_State,
743743
and Transformed_ISI. The original FoxP2 data set records ISIs in
744744
seconds. In the simulated data set `foxp2`, following @wu2021bayesian,
@@ -818,7 +818,7 @@ test results for identifying the significant covariates can be found by
818818
calling the fields `trans.global` and `dur.global`. The function
819819
`plot.BMRMMsummary` is called to visualize the global tests using
820820
barplots, as presented in Figure \@ref(fig:figglobal).
821-
]{style="color: blue"} We recall that a covariate is significant when
821+
] We recall that a covariate is significant when
822822
its levels formed more than one cluster with very high posterior
823823
probability (the bar heights). Figure \@ref(fig:figglobal) and the
824824
printed results suggest that every covariate is significant for the ISIs
@@ -848,7 +848,7 @@ knitr::include_graphics(c("figs/global_trans_foxp2.png", "figs/global_isi_foxp2.
848848

849849
[The plotting function can be called to visualize the posterior
850850
transition probabilities under different combinations of the covariate
851-
levels. ]{style="color: blue"} We show in Figure \@ref(fig:figpost-mean)
851+
levels. ] We show in Figure \@ref(fig:figpost-mean)
852852
the heatmaps for the posterior mean and standard deviation of the
853853
transition probabilities for each transition type for the following
854854
combinations of covariates: $(F,A)$ and $(W,L)$.
@@ -877,7 +877,7 @@ results if we set the `type` to be `‘trans.local.mean.diff’` or
877877
`‘trans.local.null.test’`. Here, we show the results of local tests for
878878
the covariate 1 (i.e., genotype) with `delta` equaling the default value
879879
of 0.02, and present the plots in
880-
Figure \@ref(fig:figlocal).]{style="color: blue"} From the figure, we
880+
Figure \@ref(fig:figlocal).] From the figure, we
881881
see that the posterior probabilities of the null hypotheses are
882882
generally large for most transition types (e.g., transitions to the
883883
syllable $u$) regardless of the social context, indicating that genotype
@@ -993,7 +993,7 @@ duration times.
993993

994994
[The `asthma` data set we use here is from the **SemiMarkov** package
995995
[@listwon2015semimarkov]. We have renamed and reordered the columns such
996-
that the data set fits the required format.]{style="color: blue"}
996+
that the data set fits the required format.]
997997
Specifically, the data set has $928$ rows, recording the asthma control
998998
states of $371$ patients, which is one of the following three transient
999999
states: Optimal control (State 1), sub-optimal control (State 2), and
@@ -1190,9 +1190,9 @@ the package in the future. [Future improvements to the package may
11901190
include more options for the distribution types of transition
11911191
probabilities and duration times beyond the currently available mixture
11921192
Dirichlet and mixture gamma distributions,
1193-
respectively.]{style="color: blue"}
1193+
respectively.]
11941194

1195-
::: {style="color: blue"}
1195+
:::
11961196
## Acknowledgements {#sec:ack}
11971197

11981198
We thank two anonymous reviewers very much for their careful review of

0 commit comments

Comments
 (0)