data.fake {StratSel}R Documentation

Fake Data for Illustration

Description

This data is just for illustration. The code to generate it is:

set.seed(124)
n <- 1000
x24 <- cbind(rnorm(n), rnorm(n))
error <- rmnorm(n,c(0,0),matrix(c(1,0.6,0.6,1),2,2))
e24 <- error[,2]
y24.latent <- x24%*%c(1,1) + e24
y2 <- rep(NA,n)
y2[y24.latent>0] <- 1
y2[y24.latent<0] <- 0
mod2 <- glm(y2 ~ x24, family=binomial(link=probit))
p24 <- pnorm(predict(mod2))
x11 <- cbind(rnorm(n, sd=0.2), rnorm(n, sd=0.2))
x14 <- cbind(x24[,2],rnorm(n))
e14 <- error[,1]
y14.latent <- x14%*%c(2,1) * p24 - x11%*%c(1,1) + e14
y1 <- rep(NA,n)
y1[y14.latent>0] <- 1
y1[y14.latent<0] <- 0
Y <- rep(NA,n)
Y[y1==0] <- 1
Y[y1==1&y2==0] <- 3
Y[y1==1&y2==1] <- 4
colnames(x11) <- c("var A", "var B")
colnames(x14) <- c("var C", "var D")
colnames(x24) <- c("var E", "var C")
data.fake <- data.frame(Y,x11,x14,x24)

Usage

data(data.fake)

Format

A data frame with 1000 observations on the following 7 variables.

Y

A numeric vector with values 1,3, and 4 depending on which outcome occurred.

var.A

A numeric vector mimicking an explanatory variable as part of X11.

var.B

A numeric vector mimicking an explanatory variable as part of X11.

var.C

A numeric vector mimicking an explanatory variable as part of X14 and of X24.

var.D

A numeric vector mimicking an explanatory variable as part of X14.

var.E

A numeric vector mimicking an explanatory variable as part of X24.

var.C.1

A numeric vector mimicking an explanatory variable as part of X14 and of X24. Identical to var.C.

Source

Can be independently re-created by anybody.

Examples

data(data.fake)
summary(data.fake)
## Not run: out1 <- StratSel(Y ~ var.A + var.B | var.C + var.D | 
	var.E + var.C, data=data.fake, corr=TRUE)
## End(Not run)
## Not run: summary(out1)
# True parameters are 1 or 2 except the three constant terms (which are 0). 
# The correlation parameter was set to +0.6. 

[Package StratSel version 1.3 Index]