ind_fun_g: Zellner's g-prior

Description Usage Arguments Author(s) References See Also Examples

View source: R/ind_fun_g.R

Description

a log-marginal likelhood value of a model, based on the Zellner's g-prior on the regression coefficients.

Usage

1
ind_fun_g(X.ind,y,n,p,tuning)

Arguments

X.ind

the subset of covariates in a model

y

the response variable

n

the sample size

p

the total number of covariates

tuning

a value of the tuning parameter

Author(s)

Shin Minsuk and Ruoxuan Tian

References

Zellner, Arnold. "On assessing prior distributions and Bayesian regression analysis with g-prior distributions." Bayesian inference and decision techniques: Essays in Honor of Bruno De Finetti 6 (1986): 233-243.

See Also

ind_fun_pimom, ind_fun_g

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#p=5000
p = 10
n = 200

indx.beta = 1:5
xd0 = rep(0,p);xd0[indx.beta]=1
bt0 = rep(0,p); 
bt0[1:5]=c(1,1.25,1.5,1.75,2)*sample(c(1,-1),5,replace=TRUE)
xd=xd0
bt=bt0
X = matrix(rnorm(n*p),n,p)
y = crossprod(t(X),bt0) + rnorm(n)*sqrt(1.5)
X = scale(X)
y = y-mean(y)
y = as.vector(y)

C0 = 1 # the number of repetitions of S5 algorithms to explore the model space
tuning = p^2 # tuning parameter g for g-prior
ind_fun = ind_fun_g # choose the pror on the regression coefficients (g-prior in this case)
model = Uniform #choose the model prior (Uniform prior in this cases)
tem =  seq(0.4,1,length.out=20)^2 # the sequence of the temperatures

fit_g = S5(X,y,ind_fun=ind_fun,model=model, tuning=tuning,tem=tem,C0=C0)

Example output

[1] "#################################"
[1] "S5 starts running"
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.16
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5 9
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -265.6106
[1] "The Number of Total Searched Models"
[1] 50
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.1862604
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1]  1  2  3  4  5 10
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -265.6903
[1] "The Number of Total Searched Models"
[1] 69
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.2145152
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5 9
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -265.6106
[1] "The Number of Total Searched Models"
[1] 80
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.2447645
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -263.4072
[1] "The Number of Total Searched Models"
[1] 80
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.2770083
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5 6 7
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -267.5921
[1] "The Number of Total Searched Models"
[1] 86
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.3112465
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5 8
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -264.4167
[1] "The Number of Total Searched Models"
[1] 86
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.3474792
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -263.4072
[1] "The Number of Total Searched Models"
[1] 86
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.3857064
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -263.4072
[1] "The Number of Total Searched Models"
[1] 86
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.425928
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5 8
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -264.4167
[1] "The Number of Total Searched Models"
[1] 92
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.468144
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -263.4072
[1] "The Number of Total Searched Models"
[1] 92
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.5123546
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -263.4072
[1] "The Number of Total Searched Models"
[1] 92
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.5585596
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1]  1  2  3  4  5 10
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -265.6903
[1] "The Number of Total Searched Models"
[1] 92
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.606759
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -263.4072
[1] "The Number of Total Searched Models"
[1] 92
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.6569529
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5 8
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -264.4167
[1] "The Number of Total Searched Models"
[1] 97
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.7091413
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5 6
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -265.6769
[1] "The Number of Total Searched Models"
[1] 97
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.7633241
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -263.4072
[1] "The Number of Total Searched Models"
[1] 97
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.8195014
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5 6
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -265.6769
[1] "The Number of Total Searched Models"
[1] 97
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.8776731
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5 8
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -264.4167
[1] "The Number of Total Searched Models"
[1] 97
[1] "#################################"
[1] "Inverse Temperature"
[1] 0.9378393
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -263.4072
[1] "The Number of Total Searched Models"
[1] 97
[1] "#################################"
[1] "Inverse Temperature"
[1] 1
[1] "The Selected Variables in the Searched MAP Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Searched MAP Model"
[1] -263.4072
[1] "Current Model"
[1] 1 2 3 4 5
[1] "The Evaluated Object Value at the Current Model"
          [,1]
[1,] -263.4072
[1] "The Number of Total Searched Models"
[1] 97
   user  system elapsed 
  0.896   0.008   0.906 
[1] "#################################"
[1] "Post-process starts"
[1] "#################################"
[1] "Done!"

BayesS5 documentation built on March 26, 2020, 7:14 p.m.

Related to ind_fun_g in BayesS5...