Skip to contents

This function defines the S3 summary method for objects of class pvEBayes. It provides a detailed summary of the fitted model.

Usage

# S3 method for class 'pvEBayes'
summary(object, return = NULL, ...)

Arguments

object

a pvEBayes object, which is the output of the function pvEBayes or pvEBayes_tune.

return

a character string specifying which component the summary function should return.Valid options include: "prior parameters", "likelihood", "detected signal", "posterior draws" and "posterior draws long format". If set to NULL (default), a summary table will be returned (see 'summary_table_pvEBayes()'). Note that the input for 'return' is case-sensitive.

...

other input parameters. Currently unused.

Value

If return = NULL (default), the function returns a summary table generated by summary_table_pvEBayes(), after printing the fitted pvEBayes object.

If return is specified, the function returns the requested component:

prior parameters

A list of estimated prior parameters.

likelihood

The fitted model log marginal likelihood.

detected signal

A logical matrix indicating AE-drug pairs if \(P(\lambda > 1.001 \mid N) > 0.95\). For signal detection with specified threshold parameters, see 'get_posterior_prob()'

posterior draws

Posterior draws of the signal strength for each AE-drug pair in default array format.

posterior draws long format

Posterior draws of the signal strength for each AE-drug pair in stacked long format.

Examples


obj <- pvEBayes(
  contin_table = statin2025_44, model = "general-gamma",
  alpha = 0.5, n_posterior_draws = 10000
)
#>  Fitting general-gamma model...
#>  Fitting general-gamma model... [315ms]
#> 
#>  Generating 10000 posterior draws...
#>  Generating 10000 posterior draws... [273ms]
#> 
#> Object of class 'pvEBayes'
#> 
#> General-gamma model with hyperparameter alpha = 0.5.
#> Estimated prior is a mixture of 18 gamma distributions.
#> 
#> Running time of the general-gamma model fitting: 0.3222 seconds.
#> Optimizer convergence: successful.
#> Running time for posterior draws 
#> (10000 signal strength posterior draws per AE-drug pair):0.2814 seconds.
#> 
#> Extract estimated prior parameters, discovered signals
#> and signal strength posterior draws using `summary()`.

summary(obj)
#> Posterior probabilities with default threshold parameters is provided. To specify threshold parameter, see 'get_posterior_prob()'.
#> Object of class 'pvEBayes'
#> 
#> General-gamma model with hyperparameter alpha = 0.5.
#> Estimated prior is a mixture of 18 gamma distributions.
#> 
#> Running time of the general-gamma model fitting: 0.3222 seconds.
#> Optimizer convergence: successful.
#> Running time for posterior draws 
#> (10000 signal strength posterior draws per AE-drug pair):0.2814 seconds.
#> 
#> Extract estimated prior parameters, discovered signals
#> and signal strength posterior draws using `summary()`.
#>                       AE         drug     N      E post_prob         q05
#>                   <char>       <char> <int>  <num>     <num>       <num>
#>   1: Acute Kidney Injury Atorvastatin  1132 532.74    1.0000  2.09791208
#>   2: Acute Kidney Injury  Fluvastatin    23  50.91    0.0000  0.43552080
#>   3: Acute Kidney Injury   Lovastatin    23   4.97    1.0000  2.76649590
#>   4: Acute Kidney Injury  Pravastatin   153  74.39    1.0000  2.09594476
#>   5: Acute Kidney Injury Rosuvastatin  1141 424.95    1.0000  2.72852864
#>  ---                                                                    
#> 311:   Tendon Discomfort   Lovastatin     0   0.01    0.6092  0.10838008
#> 312:   Tendon Discomfort  Pravastatin     0   0.08    0.5287  0.10648696
#> 313:   Tendon Discomfort Rosuvastatin    10   0.45    1.0000 12.26633454
#> 314:   Tendon Discomfort  Simvastatin     0   0.31    0.4224  0.01744365
#> 315:   Tendon Discomfort  Other_drugs   205 205.00    0.4750  0.98403134
#>             q50        q95
#>           <num>      <num>
#>   1:  2.1179329  2.1381397
#>   2:  0.4457684  0.4567996
#>   3:  3.8892516  6.2789305
#>   4:  2.1173993  2.1379907
#>   5:  2.7494881  2.7701406
#>  ---                      
#> 311:  1.0094948 23.2037644
#> 312:  1.0028156  8.2842507
#> 313: 23.2032133 23.2074791
#> 314:  0.9969964  3.8764224
#> 315:  1.0003689  1.0169274