resampling
MC_resample(metamodel, nresamps=3000)
Use Monte Carlo resampling to estimate whether ML parameters are accurate or not. See section 5 here for details: https://github.com/sievers/phys512-2025/blob/main/notes/mcmc.pdf
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metamodel
|
MetaModel
|
Metamodel containing our fit model/parameters |
required |
nresamps
|
int, default; 3000
|
Number of points to resample at. |
3000
|
Returns:
| Name | Type | Description |
|---|---|---|
samps |
ndarray
|
Array of resampled parameters |
likelihood_chain |
ndarray
|
Array of likelihood ratios |
Source code in witch/resampling.py
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 | |
draw_samps(par_means, cov, nsamps=3000)
Given a maximum likelihood computed parameter means and covariance, draw a sample assuming gaussian distribution under that mean, cov. See this stack exchange on how to generate samples from a given cov, p: https://stats.stackexchange.com/questions/120179/generating-data-with-a-given-sample-covariance-matrix
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
par_means
|
Array
|
Array of parameters means |
required |
cov
|
Array
|
Covariance of parameters |
required |
nsamps
|
int, default; 3000
|
Number of samples to draw |
3000
|
Returns:
| Name | Type | Description |
|---|---|---|
X |
Array
|
Sample of p drawn from par_means, cov. |
Source code in witch/resampling.py
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 | |