true knitr
knitr::opts_chunk$set(echo = TRUE)
my working directory
setwd("B:/OneDrive - Yale University/Documents/Yale University/2semester/BIS628 Longitudinal Multilevel Analysis/HW/3")
remove environment
rm(list = ls())
detach packages
attach my favorite packages
library(tidyverse)
library(nlme)
library(pscl)
library(broom)
library(formatR)
library(mgcv)
Definition of linear mixed effects models
1.a Re-write a LME model in which the random intercept and random slope of one covariate (i.e. only two fixed effects and only two random effects are present) have independent correlation structure (G matrix has ‘0’ on the off-diagonal) and the error terms also have independent correlation structure (R matrix has ‘0s’ on the off-diagonal) into an equivalent LME model in which the only random effect present is the slope (there is no random intercept), and there is also an error term.