ScanBMA: Bayesian Model Averaging for linear regression models.

Description Usage Arguments Details Value References See Also Examples

View source: R/ScanBMA.R

Description

Bayesian Model Averaging accounts for the model uncertainty inherent in the variable selection problem by averaging over the best models in the model class according to approximate posterior model probability.

Usage

1
2
ScanBMA(x, y, prior.prob = NULL,
        control = ScanBMAcontrol(), verbose = FALSE) 

Arguments

x

A matrix of independent variables.

y

A vector of values for the dependent variable.

prior.prob

If included as input, either a single positive fraction representing the probability of an independent variable being present in the true model, or else a vector assigning an estimated prior probability for each independent variable individually. The default value is NULL, which implies that no prior information will be used.

control

A list of control variables affecting the ScanBMA computations. The function ScanBMAcontrol is provided to faciltate this setting, and the default is ScanBMAcontrol().

verbose

A logical variable indicating whether or not a detailed information should be output as the computation progresses. The default value is FALSE.

Details

Bayesian Model Averaging accounts for the model uncertainty inherent in the variable selection problem by averaging over the best models in the model class according to approximate posterior model probability. ScanBMA is an algorithm for searching the model space efficiently when a large number of independent variables are present.

Value

Returns an object of classbicreg (see the BMA package). In addition, it adds nmodelschecked, which gives the number of models looked at in the ScanBMA model search, and g, which gives the final value of g used if Zellner's g-prior was used to evaluate model likelihood.

References

Raftery, Adrian E. (1995). Bayesian model selection in social research (with Discussion). Sociological Methodology 1995 (Peter V. Marsden, ed.), pp. 111-196, Cambridge, Mass.: Blackwells.

See Also

networkBMA, ScanBMAcontrol, gControl

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(dream4)

# there are a total of 5 datasets (networks) in the dream4ts10 data
network <- 1

scanBMA.res <- ScanBMA( x = dream4ts10[[network]][,-(1:2)],
                        y = dream4ts10[[network]][,3],
                        prior.prob = 0.01)

summary(scanBMA.res)

Example output

Loading required package: BMA
Loading required package: survival
Loading required package: leaps
Loading required package: robustbase

Attaching package: 'robustbase'

The following object is masked from 'package:survival':

    heart

Loading required package: inline
Loading required package: rrcov
Scalable Robust Estimators with High Breakdown Point (version 1.4-7)

Loading required package: Rcpp

Attaching package: 'Rcpp'

The following object is masked from 'package:inline':

    registerPlugin

Loading required package: RcppArmadillo
Loading required package: RcppEigen

Attaching package: 'RcppEigen'

The following objects are masked from 'package:RcppArmadillo':

    fastLm, fastLmPure


Call:
FastScanBMA.g(x = x, y = y, prior.probs = prior.probs, OR = OR,     g = gcur)


  1  models were selected
 Best  1  models (cumulative posterior probability =  1 ): 

           p!=0   EV  SD         model 1
Intercept  100   0    4.827e-18     .   
G1         100   1    7.908e-18     1.0 
G2           0   0    0.000e+00     .   
G3           0   0    0.000e+00     .   
G4           0   0    0.000e+00     .   
G5           0   0    0.000e+00     .   
G6           0   0    0.000e+00     .   
G7           0   0    0.000e+00     .   
G8           0   0    0.000e+00     .   
G9           0   0    0.000e+00     .   
G10          0   0    0.000e+00     .   
                                        
nVar                                 0  
r2                                 1    
BIC                              -471.1 
post prob                          1    

networkBMA documentation built on Jan. 28, 2021, 2:02 a.m.