bang1 | R Documentation |
A subset of data from the 1989 Bangladesh Fertility Survey, consisting of 1934 women across 60 districts.
bang1
A data frame with 1934 observations on the following 11 variables:
Identifying code for each woman (level 1 unit).
Identifying code for each district (level 2 unit).
Contraceptive use status at time of survey; a factor with levels
Not_using
and Using
.
Number of living children at time of survey; an ordered factor with
levels None
, One_child
, Two_children
,
Three_plus
.
Age of woman at time of survey (in years), centred on sample mean of 30 years.
Type of region of residence; a factor with levels Rural
and Urban
.
Woman's level of education; an ordered factor with levels
None
, Lower_primary
, Upper_primary
,
Secondary_and_above
.
Woman's religion; a factor with levels Muslim
and
Hindu
.
Proportion of women in district who are literate.
Proportion of Muslim women in district who pray every day (a measure of religiosity).
A column of ones. If included as an explanatory variable in a regression model (e.g. in MLwiN), its coefficient is the intercept.
The bang1
dataset is one of the sample datasets provided with the
multilevel-modelling software package MLwiN (Rasbash et al., 2009), and is a
subset of data from the 1989 Bangladesh Fertility Survey (Huq and Cleland,
1990) used by Browne (2012) as an example when fitting logistic models for
binary and binomial responses. The full sample was analysed in Amin et al.
(1997).
Amin, S., Diamond, I., Steele, F. (1997) Contraception and religiosity in Bangladesh. In: G. W. Jones, J. C. Caldwell, R. M. Douglas, R. M. D'Souza (eds) The Continuing Demographic Transition, 268–289. Oxford: Oxford University Press.
Browne, W. J. (2012) MCMC Estimation in MLwiN Version 2.26. University of Bristol: Centre for Multilevel Modelling.
Huq, N. M., Cleland, J. (1990) Bangladesh fertility survey, 1989. Dhaka: National Institute of Population Research and Training (NIPORT).
Rasbash, J., Charlton, C., Browne, W.J., Healy, M. and Cameron, B. (2009) MLwiN Version 2.1. Centre for Multilevel Modelling, University of Bristol.
See mlmRev
package for an alternative format of the same
dataset, with fewer variables.
## Not run:
data(bang1, package = "R2MLwiN")
bang1$denomb <- 1
# Change contrasts if wish to avoid warning indicating that, by default,
# specified contrasts for ordered predictors will be ignored by runMLwiN
# (they will be fitted as "contr.treatment" regardless of this setting). To
# enable specified contrasts, set allowcontrast to TRUE (this will be the
# default in future package releases).
my_contrasts <- options("contrasts")$contrasts
options(contrasts = c(unordered = "contr.treatment",
ordered = "contr.treatment"))
# As an alternative to changing contrasts, can instead use C() to specify
# contrasts for ordered predictors in formula object, e.g.:
# F1 <- logit(use, denomb) ~ 1 + age + C(lc, "contr.treatment") + urban +
# (1 + urban | district)
# (mymodel <- runMLwiN(Formula = F1,
# D = "Binomial",
# estoptions = list(EstM = 1),
# data = bang1,
# allowcontrast = TRUE))
F1 <- logit(use, denomb) ~ 1 + age + lc + urban + (1 + urban | district)
(mymodel <- runMLwiN(Formula = F1,
D = "Binomial",
estoptions = list(EstM = 1),
data = bang1))
# Change contrasts back to pre-existing:
options(contrasts = my_contrasts)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.