Learn R Programming

R2MLwiN (version 0.8-9)

cvd: Data from the 1998 Scottish Health Survey on cardiovascular disease status of 8804 respondents

Description

Data from the 1998 Scottish Health Survey, with 8804 respondents aged between 18 and 64. The outcome, cvddef, is a self-report of a doctor-diagnosed cardiovascular disease (CVD) condition (angina, diabetes, hypertension, acute myocardial infarction, etc.). This is a binary response, whether (1) or not (0) respondents have CVD condition.

Usage

cvd

Arguments

Format

A data frame with 8804 observations on the following 9 variables:

age

Age.

sex

Gender (factor with levels: male, female).

sc

Social class (factor with levels: 12 (social class 1 and 2), 3 (social class 3), 45 (social class 4 and 5)).

cvddef

Self-reported cardiovascular disease (0 = does not have condition, 1 = has condition)

carstair

Carstairs score.

smoke

Smoking frequency (factor with levels: lite (<10 a day), mod (10-19 a day), hvy (20+ a day), ex (ex-smoker), nevr (never smoked)).

id

Respondent identifier.

area

Postcode sector

Details

The cvd dataset is one of the example datasets analysed in Leyland and Groenewegen (2020), and provided with the multilevel-modelling software package MLwiN (Charlton et al., 2024), as cvd_data.

Examples

Run this code

if (FALSE) {

data(cvd, package = "R2MLwiN")

# Example taken from Leyland and Groenewegen (2020)

F1 <- logit(cvddef) ~ 1 + I(age^3) + I(age^3):I(log(age)) +
  sex + sex:I(age^3) + sex:I(age^3):I(log(age)) +
  (1 | area)

(mod_MQL1 <- runMLwiN(Formula = F1,
                      D = "Binomial",
                      data = cvd))

(mod_PQL2 <- runMLwiN(Formula = F1,
                      D = "Binomial",
                      data = cvd,
                      estoptions = list(
                        nonlinear = c(N = 1, M = 2),
                        startval = list(FP.b = mod_MQL1@FP,
                                        FP.v = mod_MQL1@FP.cov,
                                        RP.b = mod_MQL1@RP,
                                        RP.v = mod_MQL1@RP.cov))))
}

Run the code above in your browser using DataLab