-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
112 lines (90 loc) · 3.31 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# muscadet
<!-- badges: start -->
[![check-standard](https://github.com/LMJL-Alea/muscadet/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/LMJL-Alea/muscadet/actions/workflows/check-standard.yaml)
[![pkgdown](https://github.com/LMJL-Alea/muscadet/actions/workflows/pkgdown.yaml/badge.svg)](https://github.com/LMJL-Alea/muscadet/actions/workflows/pkgdown.yaml)
[![Codecov test coverage](https://codecov.io/gh/LMJL-Alea/muscadet/branch/master/graph/badge.svg)](https://app.codecov.io/gh/LMJL-Alea/muscadet?branch=master)
[![test-coverage](https://github.com/LMJL-Alea/muscadet/actions/workflows/test-coverage.yaml/badge.svg)](https://github.com/LMJL-Alea/muscadet/actions/workflows/test-coverage.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/muscadet)](https://CRAN.R-project.org/package=muscadet)
<!-- badges: end -->
The goal of **muscadet** is to provide ways of simulating and estimating planar
point patterns according to various two-mark DPP models. It currently provides
support for Gaussian and Bessel DPPs. Estimation can be performed either by
minimizing the pair correlation function contrast or by maximizing the
likelihood.
## Installation
You can install the development version of **muscadet** from
[GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("LMJL-Alea/muscadet")
```
## Example
The typical way of using **muscadet** for studying two-mark planar DPPs is to
use the
[`TwoMarkDPP`](https://lmjl-alea.github.io/muscadet/reference/TwoMarkDPP.html)
class:
```{r}
library(muscadet)
mod <- TwoMarkDPP$new(model = "Gauss")
mod
```
As one can see, the model is initially empty, in the sense that no parameter is
provided. You can start setting them manually one at a time:
```{r}
mod$first_intensity <- 100
mod
```
You can notice how the model gets updated and gives you intervals of feasible
values for some parameters as soon as it is able to compute this information
given the set of already known parameters.
```{r}
mod$second_intensity <- 100
mod$first_repulsion_rate <- 0.03
mod$second_repulsion_rate <- 0.03
mod
```
```{r}
mod$cross_repulsion_rate <- 0.035
mod
```
```{r}
mod$between_mark_correlation <- 0.5
mod$window_size <- 1
mod
```
Now the model is fully specified and you can simulate a point pattern from it
via the `$random()` method:
```{r}
progressr::handlers("rstudio")
withr::with_seed(1234, {
progressr::with_progress({
df <- mod$random(n = 1)
})
})
```
Note that the computations are parallelized over the sample size using the
[**futureverse**](https://future.futureverse.org) framework.
If you have an observed two-mark planar point pattern, you can also use it to
fit the model which automatically adjusts the parameter set and bounds. This is
achieved via the `$fit()` method:
```{r}
mod$fit(df[[1]])
mod
```
If you want finer control over the estimation methods, you can use the functions
[`fit_via_pcf()`](https://lmjl-alea.github.io/muscadet/reference/fit_via_pcf.html)
and
[`fit_via_mle()`](https://lmjl-alea.github.io/muscadet/reference/fit_via_mle.html)
from outside the model class.