#Install packages install.packages(c(“psych”, “foreign”, “haven”, “QuantPsyc”, “ggcorrplot”))
#Load packages library(psych) library(foreign) library(haven) library(QuantPsyc) library(ggcorrplot)
str(hw1)
describe(hw1)
hw1$ceduc
hw1\(zeduc <- scale(hw1\)educ) hw1\(zsalbegin <- scale(hw1\)salbegin) hw1\(zprevexp <- scale(hw1\)prevexp)
centered_standardized_stats <- describe(hw1[c(“ceduc”, “csalbegin”, “cprevexp”, “zeduc”, “zsalbegin”, “zprevexp”)]) centered_standardized_stats\(mean centered_standardized_stats\)sd
correlations <- round(cor(hw1, use = “pairwise”), 3) covariances <- round(cov(hw1, use = “pairwise”), 3) correlations covariances
sub_data <- data.frame(educ = c(19, 19, 20, 21, 19, 20, 19), salbegin = c(42510, 28740, 30000, 37500, 33000, 42480, 31250))
plot(sub_data\(educ, sub_data\)salbegin, xlab = “Years of Education”, ylab = “Beginning Salary”, main = “Scatterplot of Education vs. Salary”)