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" and "posterior draws". 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.

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... [322ms]
#> 
#>  Generating 10000 posterior draws...
#>  Generating 10000 posterior draws... [448ms]
#> 
#> 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.3296 seconds.
#> Optimizer convergence: successful.
#> Running time for posterior draws 
#> (10000 signal strength posterior draws per AE-drug pair):0.4553 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.3296 seconds.
#> Optimizer convergence: successful.
#> Running time for posterior draws 
#> (10000 signal strength posterior draws per AE-drug pair):0.4553 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.09795818
#>   2: Acute Kidney Injury  Fluvastatin    23  50.91    0.0001  0.43557502
#>   3: Acute Kidney Injury   Lovastatin    23   4.97    1.0000  2.76796628
#>   4: Acute Kidney Injury  Pravastatin   153  74.39    1.0000  2.09621284
#>   5: Acute Kidney Injury Rosuvastatin  1141 424.95    1.0000  2.72908781
#>  ---                                                                    
#> 311:   Tendon Discomfort   Lovastatin     0   0.01    0.6029  0.10841846
#> 312:   Tendon Discomfort  Pravastatin     0   0.08    0.5211  0.10599733
#> 313:   Tendon Discomfort Rosuvastatin    10   0.45    1.0000 12.26673793
#> 314:   Tendon Discomfort  Simvastatin     0   0.31    0.4247  0.01740786
#> 315:   Tendon Discomfort  Other_drugs   205 205.00    0.4759  0.98442177
#>             q50        q95
#>           <num>      <num>
#>   1:  2.1180454  2.1381214
#>   2:  0.4457780  0.4568386
#>   3:  3.8889959  6.2793075
#>   4:  2.1173486  2.1382683
#>   5:  2.7494172  2.7700055
#>  ---                      
#> 311:  1.0090958 23.2038061
#> 312:  1.0021163  8.2764480
#> 313: 23.2032669 23.2074881
#> 314:  0.9968302  3.8767080
#> 315:  1.0003792  1.0166677