Learn R Programming

GLMpack (version 0.1.0)

mexico: Data on Mexico from the Mexican Family Life Survey

Description

Data for the Mexico example used in chapter 7

Usage

data(mexico)

Arguments

Format

A data frame with 644 rows and 11 variables:

SUBJECT

Subject ID

HOUSEHOLD

Household ID

STATE

State indicator, here 5 for the state of Coahuila

MIGR

Dummy variable indicating whether respondents have thought of migrating

NCRIME

Number of crimes of which the female respondent has been the victim

SEV

Mean seriousness of the crime

PAST

Evaluations of past life conditions

FUT

Evaluations of future community conditions

INC

Respondents' income

AGE

Respondents' age

WAVE

Indicator for the wave under analysis

...

Examples

Run this code
# NOT RUN {
data(mexico)
attach(mexico)

## Table 7.3
library(lme4)
cs <- function(x) scale(x,scale=TRUE,center=TRUE) # Function to re-scale
mexico.out <- glmer(MIGR ~ cs(NCRIME) + cs(SEV) + cs(PAST) +
                cs(FUT) +cs(INC) + cs(AGE) + WAVE
              + (1|SUBJECT), data=mexico, family=binomial("logit"),
              glmerControl(optimizer="bobyqa", tolPwrss=5e-2, optCtrl = list(maxfun=10000)))
summary(mexico.out)
se <- sqrt(diag(vcov(mexico.out)))
(cis.mexico.out <- cbind(Est = fixef(mexico.out),
                        LL = fixef(mexico.out) - 1.96 * se,
                        UL = fixef(mexico.out) + 1.96 * se))
# }

Run the code above in your browser using DataLab