# remember, you might need to install packages
library(psych) # for the describe() command
library(expss) # for the cross_cases() commandBasic Statistics Lab
Load Libraries
Load Data
d <- read.csv(file="Data/mydata.csv", header=T)
names(d)[1] "gender" "age" "socmeduse" "swb" "npi" "exploit"
[7] "efficacy"
Univariate Plots: Histograms & Tables
table(d$gender)
f m nb
1579 541 31
table(d$age)
1 between 18 and 25 2 between 26 and 35 3 between 36 and 45 4 over 45
1980 115 38 18
hist(d$socmeduse)hist(d$swb)hist(d$npi)hist(d$exploit)hist(d$efficacy)Univariate Normality
describe(d) vars n mean sd median trimmed mad min max range skew
gender* 1 2151 1.28 0.48 1.00 1.21 0.00 1.0 3 2.0 1.36
age* 2 2151 1.11 0.43 1.00 1.00 0.00 1.0 4 3.0 4.41
socmeduse 3 2151 34.26 8.59 35.00 34.53 7.41 11.0 55 44.0 -0.31
swb 4 2151 4.44 1.33 4.50 4.49 1.48 1.0 7 6.0 -0.35
npi 5 2151 0.27 0.30 0.15 0.23 0.23 0.0 1 1.0 0.99
exploit 6 2151 2.37 1.38 2.00 2.19 1.48 1.0 7 6.0 0.96
efficacy 7 2151 3.11 0.44 3.10 3.12 0.44 1.2 4 2.8 -0.19
kurtosis se
gender* 0.72 0.01
age* 21.06 0.01
socmeduse 0.20 0.19
swb -0.50 0.03
npi -0.56 0.01
exploit 0.37 0.03
efficacy 0.36 0.01
Bivariate Plots
Crosstabs
cross_cases(d, gender, age)| age | ||||
|---|---|---|---|---|
| 1 between 18 and 25 | 2 between 26 and 35 | 3 between 36 and 45 | 4 over 45 | |
| gender | ||||
| f | 1470 | 69 | 28 | 12 |
| m | 480 | 46 | 9 | 6 |
| nb | 30 | 1 | ||
| #Total cases | 1980 | 115 | 38 | 18 |
Scatterplots
plot(d$socmeduse, d$swb,
main="Social Media Use and Satisfaction with Life Scale",
xlab = "Social Media Use",
ylab = "Satisfaction with Life Scale")plot(d$socmeduse, d$npi,
main="Social Media Use and Narcissistic Personality Inventory",
xlab = "Social Media Use",
ylab = "Narcissistic Personality Inventory")plot(d$socmeduse, d$exploit,
main="Social Media Use and Interpersonal Exploitativeness Scale",
xlab = "Social Media Use",
ylab = "Interpersonal Exploitativeness Scale")plot(d$socmeduse, d$efficacy,
main="Social Media Use and General Self-Efficacy Scale",
xlab = "Social Media Use",
ylab = "General Self-Efficacy Scale")plot(d$swb, d$npi,
main="Satisfaction with Life Scale and Narcissistic Personality Inventory",
xlab = "Satisfaction with Life Scale",
ylab = "Narcissistic Personality Inventory")plot(d$swb, d$exploit,
main="Satisfaction with Life Scale and Interpersonal Exploitativeness Scale",
xlab = "Satisfaction with Life Scale",
ylab = "Interpersonal Exploitativeness Scale")plot(d$swb, d$efficacy,
main="Satisfaction with Life Scale and General Self-Efficacy Scale",
xlab = "Satisfaction with Life Scale",
ylab = "General Self-Efficacy Scale")plot(d$npi, d$exploit,
main="Narcissistic Personality Inventory and Interpersonal Exploitativeness Scale",
xlab = "Narcissistic Personality Inventory",
ylab = "Interpersonal Exploitativeness Scale")plot(d$npi, d$efficacy,
main="Narcissistic Personality Inventory and General Self-Efficacy Scale",
xlab = "Narcissistic Personality Inventory",
ylab = "General Self-Efficacy Scale")plot(d$exploit, d$efficacy,
main="Interpersonal Exploitativeness Scale and General Self-Efficacy Scale",
xlab = "Interpersonal Exploitativeness Scale",
ylab = "General Self-Efficacy Scale")Boxplots
boxplot(data=d, socmeduse~swb,
main="Boxplot of Social Media Use and Satisfaction with Life Scale",
xlab = "Satisfaction with Life Scale",
ylab = "Social Media Use")boxplot(data=d, socmeduse~npi,
main="Boxplot of Social Media Use and Narcissistic Personality Inventory",
xlab = "Narcissistic Personality Inventory",
ylab = "Social Media Use")Write-Up
We reviewed plots and descriptive statistics for our seven chosen variables. 1 variables had issues with skew and/or kurtosis: Interpersonal Exploitativeness Scale scores were negatively skewed (-3.0) and kurtotic (~780), and Narcissistic Personality Inventory scores were kurtotic (~990). The other 3 variables had skew and kurtosis within the accepted range (-2/+2).