Description Usage Format Examples
The script that generated this data is given below.
1 | data("hivif")
|
A data frame with 1000 observations on the following 10 variables.
x1a numeric vector
x2a numeric vector
x3a numeric vector
x4a numeric vector
x5a numeric vector
x6a numeric vector
x7a numeric vector
x8a numeric vector
x9a numeric vector
ya numeric vector
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 | #Simple example
data(hivif)
lm(y ~ ., data=hivif)
#
#This example shows how the original data was simulated and
#how additional test data may be simulated.
## Not run:
set.seed(778851) #needed for original training data
n <- 100
p <- 9 #9 covariates plus intercept
sig <- toeplitz(0.9^(0:(p-1)))
X <- MASS::mvrnorm(n=n, rep(0, p), Sigma=sig)
colnames(X) <- paste0("x", 1:p)
b <- c(0,-0.3,0,0,-0.3,0,0,0.3,0.3) #
names(b) <- paste0("x", 1:p)
y <- 1 + X
Xy <- cbind(as.data.frame.matrix(X), y=y) #=hivif
#Test data
nTe <- 10^3
XTe <- MASS::mvrnorm(n=nTe, rep(0, p), Sigma=sig)
colnames(XTe) <- paste0("x", 1:p)
yTe <- 1 + XTe
XyTe <- cbind(as.data.frame.matrix(XTe), y=yTe) #test data
ans <- lm(y ~ ., data=Xy) #fit training data
mean((XyTe$y - predict(ans, newdata=XyTe))^2) #MSE on test data
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.