M. Drew LaMar
September 12, 2016
Definition: A
model is a simplified abstract or concrete representation of objects and their representations or processes in the real world.
Let's create two uncorrelated continuous variables (\( \rho = 0 \)), each with a gaussian/normal distribution.
S <- matrix(c(1,0.0,0.0,1),2,2) #Correlation matrix
X <- rmvnorm(mean=c(0,0), sig=S, n=100)
head(X)
Activities: Check that each column of X is normally distributed. What is the resulting correlation coefficient? Use the cor.test function to find a confidence interval.
Let's create a response variable \( Y \) that depends on the two variables \( X_{1} \) and \( X_{2} \).
X1 <- X[,1]
X2 <- X[,2]
Y <- 1 + 2*X1 + 4*X2
ucor.data <- data.frame(X1 = X1, X2 = X2, Y = Y)
Activities: Construct 3 linear models: (1) using \( X_{1} \) and \( X_{2} \) to predict \( Y \), (2) using only \( X_{1} \), and (3) using only \( X_{2} \).
Activities: Repeat the above with a correlation coefficient of \( \rho=0.9 \) between \( X_{1} \) and \( X_{2} \). What do you notice?