#Install packages install.packages(c(“psych”, “foreign”, “haven”, “QuantPsyc”, “ggcorrplot”))

#Load packages library(psych) library(foreign) library(haven) library(QuantPsyc) library(ggcorrplot)

Check data structure

str(hw1)

Calculate mean and standard deviation

describe(hw1)

Create centered scores

hw1$ceduc

6. Create standardized scores

hw1\(zeduc <- scale(hw1\)educ) hw1\(zsalbegin <- scale(hw1\)salbegin) hw1\(zprevexp <- scale(hw1\)prevexp)

7. Calculate Mean and Standard Deviation of centered and standardized scores

centered_standardized_stats <- describe(hw1[c(“ceduc”, “csalbegin”, “cprevexp”, “zeduc”, “zsalbegin”, “zprevexp”)]) centered_standardized_stats\(mean centered_standardized_stats\)sd

9. Calculate correlations and covariances

correlations <- round(cor(hw1, use = “pairwise”), 3) covariances <- round(cov(hw1, use = “pairwise”), 3) correlations covariances

10. Scatterplot

a. Create data frame for subset

sub_data <- data.frame(educ = c(19, 19, 20, 21, 19, 20, 19), salbegin = c(42510, 28740, 30000, 37500, 33000, 42480, 31250))

b. Create scatterplot

plot(sub_data\(educ, sub_data\)salbegin, xlab = “Years of Education”, ylab = “Beginning Salary”, main = “Scatterplot of Education vs. Salary”)