Last active
December 18, 2020 17:11
-
-
Save audhiaprilliant/47a02032135469be83857a17898bf22e to your computer and use it in GitHub Desktop.
Simulation of Autocorrelation in Linear Regression Model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install package | |
install.packages('tidyr') | |
# Load the package | |
library(tidyr) | |
# Data melting | |
long = df %>% | |
gather(Coefficient, Value, -c(Rho)) | |
# Create a new column indicating whether it is intercept or slope | |
long$Status = ifelse(substring(long$Coefficient, 1, 9) == 'intercept', 'Intercept', 'Slope') | |
# View the result | |
View(long) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment