Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/IndivdRUMIndMH.R

`IndivdRUMIndMH`

simulates the posterior distribution of the regression coefficients of a binary logit model and returns the MCMC draws. The sampling procedure is based on an algorithm using data augmentation, where the regression coefficients are estimated by rewriting the binary logit model as a latent variable model called difference random utility model (dRUM). This dRUM representation of the binary logit model is equivalent to the individual dRUM representation of the binomial logit model. The logistic distribution of the error in the dRUM representation is approximated by a normal distribution with same mean and variance. The posterior of this approximate regression model is then used as independence proposal density for the regression coefficients.

1 2 | ```
IndivdRUMIndMH(y, X, sim = 12000, burn = 2000, acc = 0, b0, B0,
start, verbose = 500)
``` |

`y` |
logical or coercible to integer with values 0 and 1 (Bernoulli data). |

`X` |
a design matrix of predictors. |

`sim` |
number of MCMC draws including burn-in. The default value is 12000 draws. |

`burn` |
number of MCMC draws discarded as burn-in. Default is a burn-in of 2000 draws. |

`acc` |
number of MCMC draws at the beginning of the burn-in phase where each proposed parameter vector is accepted with probability 1 rather than according to the MH acceptance rule. Choose a small number |

`b0` |
an optional vector of length |

`B0` |
an optional |

`start` |
an optional vector of length |

`verbose` |
an optional non-negative integer indicating that in each |

For details concerning the algorithm see the papers by Fussl, Fruehwirth-Schnatter and Fruehwirth (2013) and Fruehwirth-Schnatter and Fruehwirth (2010).

The output is a list object of class `c("binomlogitIndiv","binomlogitMH",`

`"binomlogit")`

containing

`beta` |
a |

`sim` |
the argument |

`burn` |
the argument |

`acc` |
the argument |

`dims` |
number of covariates ( |

`N` |
number of binary observations |

`b0` |
the argument |

`B0` |
the argument |

`duration` |
a numeric value indicating the total time (in secs) used for the function call |

`duration_wBI` |
a numeric value indicating the time (in secs) used for the |

`rate` |
acceptance rate based on the |

To display the output use `print`

, `summary`

and `plot`

. The `print`

method prints the number of observations and covariates entered in the routine, the total number of MCMC draws (including burn-in), the number of draws discarded as burn-in, the runtime used for the whole algorithm and for the `sim-burn`

MCMC draws after burn-in and the acceptance rate. The `summary`

method additionally returns the length of the acceptance phase during burn-in, the used prior parameters `b0`

and `B0`

and the posterior mean for the regression coefficients without burn-in. The `plot`

method plots the MCMC draws and their acf for each regression coefficient, both without burn-in.

To perform auxiliary mixture sampling for the binary logit model use `dRUMAuxMix`

and follow the instructions given there.

Agnes Fussl <[email protected]>

Agnes Fussl, Sylvia Fruehwirth-Schnatter and Rudolf Fruehwirth (2013),
"Efficient MCMC for Binomial Logit Models". *ACM Transactions on Modeling and Computer Simulation 23*, 1, Article 3, 21 pages.

Sylvia Fruehwirth-Schnatter and Rudolf Fruehwirth (2010),
"Data augmentation and MCMC for binary and multinomial logit models."
In *Statistical Modelling and Regression Structures - Festschrift in Honour
of Ludwig Fahrmeir*, T. Kneib and G. Tutz, Eds. Physica-Verlag, Heidelberg, pp. 111-132.

`dRUMIndMH`

, `dRUMAuxMix`

, `dRUMHAM`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ```
## Data-augmented independence Metropolis-Hastings sampling for the
## binary logit model
## load caesarean birth data
data(caesarean_binary)
y <- as.numeric(caesarean_binary[,1])
X <- as.matrix(caesarean_binary[,-1])
## start independence MH sampler
indivMH1 <- IndivdRUMIndMH(y,X)
print(indivMH1)
summary(indivMH1)
plot(indivMH1)
## Not run:
## load simulated data set
data(simul_binary)
y <- as.numeric(simul_binary[,1])
X <- as.matrix(simul_binary[,-1])
## use a small acc>0 (e.g. acc=50), otherwise the sampler gets stuck at
## the starting values
indivMH2 <- IndivdRUMIndMH(y,X,acc=50)
print(indivMH2)
summary(indivMH2)
plot(indivMH2)
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.