gsMap3D 0.1.0a1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. gsMap/__init__.py +13 -0
  2. gsMap/__main__.py +4 -0
  3. gsMap/cauchy_combination_test.py +342 -0
  4. gsMap/cli.py +355 -0
  5. gsMap/config/__init__.py +72 -0
  6. gsMap/config/base.py +296 -0
  7. gsMap/config/cauchy_config.py +79 -0
  8. gsMap/config/dataclasses.py +235 -0
  9. gsMap/config/decorators.py +302 -0
  10. gsMap/config/find_latent_config.py +276 -0
  11. gsMap/config/format_sumstats_config.py +54 -0
  12. gsMap/config/latent2gene_config.py +461 -0
  13. gsMap/config/ldscore_config.py +261 -0
  14. gsMap/config/quick_mode_config.py +242 -0
  15. gsMap/config/report_config.py +81 -0
  16. gsMap/config/spatial_ldsc_config.py +334 -0
  17. gsMap/config/utils.py +286 -0
  18. gsMap/find_latent/__init__.py +3 -0
  19. gsMap/find_latent/find_latent_representation.py +312 -0
  20. gsMap/find_latent/gnn/distribution.py +498 -0
  21. gsMap/find_latent/gnn/encoder_decoder.py +186 -0
  22. gsMap/find_latent/gnn/gcn.py +85 -0
  23. gsMap/find_latent/gnn/gene_former.py +164 -0
  24. gsMap/find_latent/gnn/loss.py +18 -0
  25. gsMap/find_latent/gnn/st_model.py +125 -0
  26. gsMap/find_latent/gnn/train_step.py +177 -0
  27. gsMap/find_latent/st_process.py +781 -0
  28. gsMap/format_sumstats.py +446 -0
  29. gsMap/generate_ldscore.py +1018 -0
  30. gsMap/latent2gene/__init__.py +18 -0
  31. gsMap/latent2gene/connectivity.py +781 -0
  32. gsMap/latent2gene/entry_point.py +141 -0
  33. gsMap/latent2gene/marker_scores.py +1265 -0
  34. gsMap/latent2gene/memmap_io.py +766 -0
  35. gsMap/latent2gene/rank_calculator.py +590 -0
  36. gsMap/latent2gene/row_ordering.py +182 -0
  37. gsMap/latent2gene/row_ordering_jax.py +159 -0
  38. gsMap/ldscore/__init__.py +1 -0
  39. gsMap/ldscore/batch_construction.py +163 -0
  40. gsMap/ldscore/compute.py +126 -0
  41. gsMap/ldscore/constants.py +70 -0
  42. gsMap/ldscore/io.py +262 -0
  43. gsMap/ldscore/mapping.py +262 -0
  44. gsMap/ldscore/pipeline.py +615 -0
  45. gsMap/pipeline/quick_mode.py +134 -0
  46. gsMap/report/__init__.py +2 -0
  47. gsMap/report/diagnosis.py +375 -0
  48. gsMap/report/report.py +100 -0
  49. gsMap/report/report_data.py +1832 -0
  50. gsMap/report/static/js_lib/alpine.min.js +5 -0
  51. gsMap/report/static/js_lib/tailwindcss.js +83 -0
  52. gsMap/report/static/template.html +2242 -0
  53. gsMap/report/three_d_combine.py +312 -0
  54. gsMap/report/three_d_plot/three_d_plot_decorate.py +246 -0
  55. gsMap/report/three_d_plot/three_d_plot_prepare.py +202 -0
  56. gsMap/report/three_d_plot/three_d_plots.py +425 -0
  57. gsMap/report/visualize.py +1409 -0
  58. gsMap/setup.py +5 -0
  59. gsMap/spatial_ldsc/__init__.py +0 -0
  60. gsMap/spatial_ldsc/io.py +656 -0
  61. gsMap/spatial_ldsc/ldscore_quick_mode.py +912 -0
  62. gsMap/spatial_ldsc/spatial_ldsc_jax.py +382 -0
  63. gsMap/spatial_ldsc/spatial_ldsc_multiple_sumstats.py +439 -0
  64. gsMap/utils/__init__.py +0 -0
  65. gsMap/utils/generate_r2_matrix.py +610 -0
  66. gsMap/utils/jackknife.py +518 -0
  67. gsMap/utils/manhattan_plot.py +643 -0
  68. gsMap/utils/regression_read.py +177 -0
  69. gsMap/utils/torch_utils.py +23 -0
  70. gsmap3d-0.1.0a1.dist-info/METADATA +168 -0
  71. gsmap3d-0.1.0a1.dist-info/RECORD +74 -0
  72. gsmap3d-0.1.0a1.dist-info/WHEEL +4 -0
  73. gsmap3d-0.1.0a1.dist-info/entry_points.txt +2 -0
  74. gsmap3d-0.1.0a1.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,518 @@
1
+ """
2
+ (c) 2014 Brendan Bulik-Sullivan and Hilary Finucane
3
+
4
+ Fast block jackknives.
5
+
6
+ Everything in this module deals with 2D numpy arrays. 1D data are represented as arrays
7
+ with dimension (N, 1) or (1, N), to avoid bugs arising from numpy treating (N, ) as
8
+ a fundamentally different shape from (N, 1). The convention in this module is for the
9
+ first dimension to represent # of data points (or # of blocks in a block jackknife, since
10
+ a block is like a datapoint), and for the second dimension to represent the dimensionality
11
+ of the data.
12
+
13
+ """
14
+
15
+ import numpy as np
16
+ from scipy.optimize import nnls
17
+
18
+ np.seterr(divide="raise", invalid="raise")
19
+ xrange = range
20
+
21
+
22
+ def _check_shape(x, y):
23
+ """Check that x and y have the correct shapes (for regression jackknives)."""
24
+ if len(x.shape) != 2 or len(y.shape) != 2:
25
+ raise ValueError("x and y must be 2D arrays.")
26
+ if x.shape[0] != y.shape[0]:
27
+ raise ValueError("Number of datapoints in x != number of datapoints in y.")
28
+ if y.shape[1] != 1:
29
+ raise ValueError("y must have shape (n_snp, 1)")
30
+ n, p = x.shape
31
+ if p > n:
32
+ raise ValueError("More dimensions than datapoints.")
33
+
34
+ return (n, p)
35
+
36
+
37
+ def _check_shape_block(xty_block_values, xtx_block_values):
38
+ """Check that xty_block_values and xtx_block_values have correct shapes."""
39
+ if xtx_block_values.shape[0:2] != xty_block_values.shape:
40
+ raise ValueError(
41
+ "Shape of xty_block_values must equal shape of first two dimensions of xty_block_values."
42
+ )
43
+ if len(xtx_block_values.shape) < 3:
44
+ raise ValueError("xtx_block_values must be a 3D array.")
45
+ if xtx_block_values.shape[1] != xtx_block_values.shape[2]:
46
+ raise ValueError("Last two axes of xtx_block_values must have same dimension.")
47
+
48
+ return xtx_block_values.shape[0:2]
49
+
50
+
51
+ class Jackknife:
52
+ """
53
+ Base class for jackknife objects. Input involves x,y, so this base class is tailored
54
+ for statistics computed from independent and dependent variables (e.g., regressions).
55
+ The __delete_vals_to_pseudovalues__ and __jknife__ methods will still be useful for other
56
+ sorts of statistics, but the __init__ method will need to be overriden.
57
+
58
+ Parameters
59
+ ----------
60
+ x : np.matrix with shape (n, p)
61
+ Independent variable.
62
+ y : np.matrix with shape (n, 1)
63
+ Dependent variable.
64
+ n_blocks : int
65
+ Number of jackknife blocks
66
+ *args, **kwargs :
67
+ Arguments for inheriting jackknives.
68
+
69
+ Attributes
70
+ ----------
71
+ n_blocks : int
72
+ Number of jackknife blocks
73
+ p : int
74
+ Dimensionality of the independent varianble
75
+ N : int
76
+ Number of datapoints (equal to x.shape[0])
77
+
78
+ Methods
79
+ -------
80
+ jknife(pseudovalues):
81
+ Computes jackknife estimate and variance from the jackknife pseudovalues.
82
+ delete_vals_to_pseudovalues(delete_vals, est):
83
+ Converts delete values and the whole-data estimate to pseudovalues.
84
+ get_separators():
85
+ Returns (approximately) evenly-spaced jackknife block boundaries.
86
+ """
87
+
88
+ def __init__(self, x, y, n_blocks=None, separators=None):
89
+ self.N, self.p = _check_shape(x, y)
90
+ if separators is not None:
91
+ if max(separators) != self.N:
92
+ raise ValueError("Max(separators) must be equal to number of data points.")
93
+ if min(separators) != 0:
94
+ raise ValueError("Max(separators) must be equal to 0.")
95
+ self.separators = sorted(separators)
96
+ self.n_blocks = len(separators) - 1
97
+ elif n_blocks is not None:
98
+ self.n_blocks = n_blocks
99
+ self.separators = self.get_separators(self.N, self.n_blocks)
100
+ else:
101
+ raise ValueError("Must specify either n_blocks are separators.")
102
+
103
+ if self.n_blocks > self.N:
104
+ raise ValueError("More blocks than data points.")
105
+
106
+ @classmethod
107
+ def jknife(cls, pseudovalues):
108
+ """
109
+ Converts pseudovalues to jackknife estimate and variance.
110
+
111
+ Parameters
112
+ ----------
113
+ pseudovalues : np.matrix pf floats with shape (n_blocks, p)
114
+
115
+ Returns
116
+ -------
117
+ jknife_est : np.matrix with shape (1, p)
118
+ Jackknifed estimate.
119
+ jknife_var : np.matrix with shape (1, p)
120
+ Variance of jackknifed estimate.
121
+ jknife_se : np.matrix with shape (1, p)
122
+ Standard error of jackknifed estimate, equal to sqrt(jknife_var).
123
+ jknife_cov : np.matrix with shape (p, p)
124
+ Covariance matrix of jackknifed estimate.
125
+
126
+ """
127
+ n_blocks = pseudovalues.shape[0]
128
+ jknife_cov = np.atleast_2d(np.cov(pseudovalues.T, ddof=1) / n_blocks)
129
+ jknife_var = np.atleast_2d(np.diag(jknife_cov))
130
+ jknife_se = np.atleast_2d(np.sqrt(jknife_var))
131
+ jknife_est = np.atleast_2d(np.mean(pseudovalues, axis=0))
132
+ return (jknife_est, jknife_var, jknife_se, jknife_cov)
133
+
134
+ @classmethod
135
+ def delete_values_to_pseudovalues(cls, delete_values, est):
136
+ """
137
+ Converts whole-data estimate and delete values to pseudovalues.
138
+
139
+ Parameters
140
+ ----------
141
+ delete_values : np.matrix with shape (n_blocks, p)
142
+ Delete values.
143
+ est : np.matrix with shape (1, p):
144
+ Whole-data estimate.
145
+
146
+ Returns
147
+ -------
148
+ pseudovalues : np.matrix with shape (n_blocks, p)
149
+ Psuedovalues.
150
+
151
+ Raises
152
+ ------
153
+ ValueError :
154
+ If est.shape != (1, delete_values.shape[1])
155
+
156
+ """
157
+ n_blocks, p = delete_values.shape
158
+ if est.shape != (1, p):
159
+ raise ValueError("Different number of parameters in delete_values than in est.")
160
+
161
+ return n_blocks * est - (n_blocks - 1) * delete_values
162
+
163
+ @classmethod
164
+ def get_separators(cls, N, n_blocks):
165
+ """Define evenly-spaced block boundaries."""
166
+ return np.floor(np.linspace(0, N, n_blocks + 1)).astype(int)
167
+
168
+
169
+ class LstsqJackknifeSlow(Jackknife):
170
+ """
171
+ Slow linear-regression block jackknife. This class computes delete values directly,
172
+ rather than forming delete values from block values. Useful for testing and for
173
+ non-negative least squares (which as far as I am aware does not admit a fast block
174
+ jackknife algorithm).
175
+
176
+ Inherits from Jackknife class.
177
+
178
+ Parameters
179
+ ----------
180
+ x : np.matrix with shape (n, p)
181
+ Independent variable.
182
+ y : np.matrix with shape (n, 1)
183
+ Dependent variable.
184
+ n_blocks : int
185
+ Number of jackknife blocks
186
+ nn: bool
187
+ Non-negative least-squares?
188
+
189
+ Attributes
190
+ ----------
191
+ est : np.matrix with shape (1, p)
192
+ FWLS estimate.
193
+ jknife_est : np.matrix with shape (1, p)
194
+ Jackknifed estimate.
195
+ jknife_var : np.matrix with shape (1, p)
196
+ Variance of jackknifed estimate.
197
+ jknife_se : np.matrix with shape (1, p)
198
+ Standard error of jackknifed estimate, equal to sqrt(jknife_var).
199
+ jknife_cov : np.matrix with shape (p, p)
200
+ Covariance matrix of jackknifed estimate.
201
+ delete_vals : np.matrix with shape (n_blocks, p)
202
+ Jackknife delete values.
203
+
204
+ Methods
205
+ -------
206
+ delete_values(x, y, func, s):
207
+ Compute delete values of func(x, y) the slow way, with blocks defined by s.
208
+
209
+ """
210
+
211
+ def __init__(self, x, y, n_blocks=None, nn=False, separators=None):
212
+ Jackknife.__init__(self, x, y, n_blocks, separators)
213
+ if nn: # non-negative least squares
214
+
215
+ def func(x, y):
216
+ return np.atleast_2d(nnls(x, np.array(y).T[0])[0])
217
+ else:
218
+
219
+ def func(x, y):
220
+ return np.atleast_2d(np.linalg.lstsq(x, np.array(y).T[0])[0])
221
+
222
+ self.est = func(x, y)
223
+ self.delete_values = self.delete_values(x, y, func, self.separators)
224
+ self.pseudovalues = self.delete_values_to_pseudovalues(self.delete_values, self.est)
225
+ (self.jknife_est, self.jknife_var, self.jknife_se, self.jknife_cov) = self.jknife(
226
+ self.pseudovalues
227
+ )
228
+
229
+ @classmethod
230
+ def delete_values(cls, x, y, func, s):
231
+ """
232
+ Compute delete values by deleting one block at a time.
233
+
234
+ Parameters
235
+ ----------
236
+ x : np.matrix with shape (n, p)
237
+ Independent variable.
238
+ y : np.matrix with shape (n, 1)
239
+ Dependent variable.
240
+ func : function (n, p) , (n, 1) --> (1, p)
241
+ Function of x and y to be jackknived.
242
+ s : list of ints
243
+ Block separators.
244
+
245
+ Returns
246
+ -------
247
+ delete_values : np.matrix with shape (n_blocks, p)
248
+ Delete block values (with n_blocks blocks defined by parameter s).
249
+
250
+ Raises
251
+ ------
252
+ ValueError :
253
+ If x.shape[0] does not equal y.shape[0] or x and y are not 2D.
254
+
255
+ """
256
+ _check_shape(x, y)
257
+ d = [
258
+ func(
259
+ np.vstack([x[0 : s[i], ...], x[s[i + 1] :, ...]]),
260
+ np.vstack([y[0 : s[i], ...], y[s[i + 1] :, ...]]),
261
+ )
262
+ for i in xrange(len(s) - 1)
263
+ ]
264
+
265
+ return np.concatenate(d, axis=0)
266
+
267
+
268
+ class LstsqJackknifeFast(Jackknife):
269
+ """
270
+ Fast block jackknife for linear regression.
271
+
272
+ Inherits from Jackknife class.
273
+
274
+ Parameters
275
+ ----------
276
+ x : np.matrix with shape (n, p)
277
+ Independent variable.
278
+ y : np.matrix with shape (n, 1)
279
+ Dependent variable.
280
+ n_blocks : int
281
+ Number of jackknife blocks
282
+
283
+ Attributes
284
+ ----------
285
+ est : np.matrix with shape (1, p)
286
+ FWLS estimate.
287
+ jknife_est : np.matrix with shape (1, p)
288
+ Jackknifed estimate.
289
+ jknife_var : np.matrix with shape (1, p)
290
+ Variance of jackknifed estimate.
291
+ jknife_se : np.matrix with shape (1, p)
292
+ Standard error of jackknifed estimate, equal to sqrt(jknife_var).
293
+ jknife_cov : np.matrix with shape (p, p)
294
+ Covariance matrix of jackknifed estimate.
295
+ delete_vals : np.matrix with shape (n_blocks, p)
296
+ Jackknife delete values.
297
+
298
+ Methods
299
+ -------
300
+ block_values(x, y, n_blocks) :
301
+ Computes block values for the regression y~x.
302
+ block_values_to_est(block_values) :
303
+ Computes whole-data estimate from block values.
304
+ block_values_to_pseudovalues(block_values, est) :
305
+ Computes pseudovalues and delete values in a single pass over the block values.
306
+
307
+ """
308
+
309
+ def __init__(self, x, y, n_blocks=None, separators=None):
310
+ Jackknife.__init__(self, x, y, n_blocks, separators)
311
+ xty, xtx = self.block_values(x, y, self.separators)
312
+ self.est = self.block_values_to_est(xty, xtx)
313
+ self.delete_values = self.block_values_to_delete_values(xty, xtx)
314
+ self.pseudovalues = self.delete_values_to_pseudovalues(self.delete_values, self.est)
315
+ (self.jknife_est, self.jknife_var, self.jknife_se, self.jknife_cov) = self.jknife(
316
+ self.pseudovalues
317
+ )
318
+
319
+ @classmethod
320
+ def block_values(cls, x, y, s):
321
+ """
322
+ Compute block values.
323
+
324
+ Parameters
325
+ ----------
326
+ x : np.matrix with shape (n, p)
327
+ Independent variable.
328
+ y : np.matrix with shape (n, 1)
329
+ Dependent variable.
330
+ n_blocks : int
331
+ Number of jackknife blocks
332
+ s : list of ints
333
+ Block separators.
334
+
335
+ Returns
336
+ -------
337
+ xty_block_values : np.matrix with shape (n_blocks, p)
338
+ Block values of X^T Y.
339
+ xtx_block_values : 3d np array with shape (n_blocks, p, p)
340
+ Block values of X^T X.
341
+
342
+ Raises
343
+ ------
344
+ ValueError :
345
+ If x.shape[0] does not equal y.shape[0] or x and y are not 2D.
346
+
347
+ """
348
+ n, p = _check_shape(x, y)
349
+ n_blocks = len(s) - 1
350
+ xtx_block_values = np.zeros((n_blocks, p, p))
351
+ xty_block_values = np.zeros((n_blocks, p))
352
+ for i in range(n_blocks):
353
+ xty_block_values[i, ...] = np.dot(
354
+ x[s[i] : s[i + 1], ...].T, y[s[i] : s[i + 1], ...]
355
+ ).reshape((1, p))
356
+ xtx_block_values[i, ...] = np.dot(x[s[i] : s[i + 1], ...].T, x[s[i] : s[i + 1], ...])
357
+
358
+ return (xty_block_values, xtx_block_values)
359
+
360
+ @classmethod
361
+ def block_values_to_est(cls, xty_block_values, xtx_block_values):
362
+ """
363
+ Converts block values to the whole-data linear regression estimate.
364
+
365
+ Parameters
366
+ ----------
367
+ xty_block_values : np.matrix with shape (n_blocks, p)
368
+ Block values of X^T Y.
369
+ xtx_block_values : 3D np.array with shape (n_blocks, p, p)
370
+ Block values of X^T X
371
+
372
+ Returns
373
+ -------
374
+ est : np.matrix with shape (1, p)
375
+ Whole data estimate.
376
+
377
+ Raises
378
+ ------
379
+ LinAlgError :
380
+ If design matrix is singular.
381
+ ValueError :
382
+ If the last two dimensions of xtx_block_values are not equal or if the first two
383
+ dimensions of xtx_block_values do not equal the shape of xty_block_values.
384
+
385
+ """
386
+ n_blocks, p = _check_shape_block(xty_block_values, xtx_block_values)
387
+ xty = np.sum(xty_block_values, axis=0)
388
+ xtx = np.sum(xtx_block_values, axis=0)
389
+ return np.linalg.solve(xtx, xty).reshape((1, p))
390
+
391
+ @classmethod
392
+ def block_values_to_delete_values(cls, xty_block_values, xtx_block_values):
393
+ """
394
+ Converts block values to delete values.
395
+
396
+ Parameters
397
+ ----------
398
+ xty_block_values : np.matrix with shape (n_blocks, p)
399
+ Block values of X^T Y.
400
+ xtx_block_values : 3D np.array with shape (n_blocks, p, p)
401
+ Block values of X^T X
402
+ est : np.matrix with shape (1, p)
403
+ Whole data estimate
404
+
405
+ Returns
406
+ -------
407
+ delete_values : np.matrix with shape (n_blocks, p)
408
+ Delete Values.
409
+
410
+ Raises
411
+ ------
412
+ LinAlgError :
413
+ If delete design matrix is singular.
414
+ ValueError :
415
+ If the last two dimensions of xtx_block_values are not equal or if the first two
416
+ dimensions of xtx_block_values do not equal the shape of xty_block_values.
417
+
418
+ """
419
+ n_blocks, p = _check_shape_block(xty_block_values, xtx_block_values)
420
+ delete_values = np.zeros((n_blocks, p))
421
+ xty_tot = np.sum(xty_block_values, axis=0)
422
+ xtx_tot = np.sum(xtx_block_values, axis=0)
423
+ for j in range(n_blocks):
424
+ delete_xty = xty_tot - xty_block_values[j]
425
+ delete_xtx = xtx_tot - xtx_block_values[j]
426
+ delete_values[j, ...] = np.linalg.solve(delete_xtx, delete_xty).reshape((1, p))
427
+
428
+ return delete_values
429
+
430
+
431
+ class RatioJackknife(Jackknife):
432
+ """
433
+ Block jackknife ratio estimate.
434
+
435
+ Jackknife.
436
+
437
+ Parameters
438
+ ----------
439
+ est : float or np.array with shape (1, p)
440
+ Whole data ratio estimate
441
+ numer_delete_values : np.matrix with shape (n_blocks, p)
442
+ Delete values for the numerator.
443
+ denom_delete_values: np.matrix with shape (n_blocks, p)
444
+ Delete values for the denominator.
445
+
446
+ Methods
447
+ -------
448
+ delete_vals_to_pseudovalues(est, denom, num):
449
+ Converts denominator/ numerator delete values and the whole-data estimate to
450
+ pseudovalues.
451
+
452
+ Raises
453
+ ------
454
+ FloatingPointError :
455
+ If any entry of denom_delete_values is zero.
456
+
457
+ Note that it is possible for the denominator to cross zero (i.e., be both positive
458
+ and negative) and still have a finite ratio estimate and SE, for example if the
459
+ numerator is fixed to 0 and the denominator is either -1 or 1. If the denominator
460
+ is noisily close to zero, then it is unlikely that the denominator will yield zero
461
+ exactly (and therefore yield an inf or nan), but delete values will be of the form
462
+ (numerator / close to zero) and -(numerator / close to zero), i.e., (big) and -(big),
463
+ and so the jackknife will (correctly) yield huge SE.
464
+
465
+ """
466
+
467
+ def __init__(self, est, numer_delete_values, denom_delete_values):
468
+ if numer_delete_values.shape != denom_delete_values.shape:
469
+ raise ValueError("numer_delete_values.shape != denom_delete_values.shape.")
470
+ if len(numer_delete_values.shape) != 2:
471
+ raise ValueError("Delete values must be matrices.")
472
+ if (
473
+ len(est.shape) != 2
474
+ or est.shape[0] != 1
475
+ or est.shape[1] != numer_delete_values.shape[1]
476
+ ):
477
+ raise ValueError("Shape of est does not match shape of delete values.")
478
+
479
+ self.n_blocks = numer_delete_values.shape[0]
480
+ self.est = est
481
+ self.pseudovalues = self.delete_values_to_pseudovalues(
482
+ self.est, denom_delete_values, numer_delete_values
483
+ )
484
+ (self.jknife_est, self.jknife_var, self.jknife_se, self.jknife_cov) = self.jknife(
485
+ self.pseudovalues
486
+ )
487
+
488
+ @classmethod
489
+ def delete_values_to_pseudovalues(cls, est, denom, numer):
490
+ """
491
+ Converts delete values to pseudovalues.
492
+
493
+ Parameters
494
+ ----------
495
+ est : np.matrix with shape (1, p)
496
+ Whole-data ratio estimate.
497
+ denom : np.matrix with shape (n_blocks, p)
498
+ Denominator delete values.
499
+ numer : np.matrix with shape (n_blocks, p)
500
+ Numerator delete values.
501
+
502
+ Returns
503
+ -------
504
+ pseudovalues :
505
+ Ratio Jackknife Pseudovalues.
506
+
507
+ Raises
508
+ ------
509
+ ValueError :
510
+ If numer.shape != denom.shape.
511
+
512
+ """
513
+ n_blocks, p = denom.shape
514
+ pseudovalues = np.zeros((n_blocks, p))
515
+ for j in range(0, n_blocks):
516
+ pseudovalues[j, ...] = n_blocks * est - (n_blocks - 1) * numer[j, ...] / denom[j, ...]
517
+
518
+ return pseudovalues