You are on page 1of 2

2023-05-30

library(readxl)
data <- read_excel("C:/Users/pc/Documents/janohan.xlsx")
head(data)

## # A tibble: 6 × 12
## Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 DV IV
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 4 3 3 3 4 3 3 4 3 3 87 3.3
## 2 2 3 3 3 3 3 2 3 3 3 90 2.8
## 3 4 4 3 3 2 2 5 4 4 4 85 3.5
## 4 4 4 3 3 4 3 5 5 4 3 88 3.8
## 5 4 4 3 2 4 5 5 4 3 3 86 3.7
## 6 5 5 5 5 5 5 4 5 4 5 90 4.8

#Mean of Data
colMeans(data)

## Q1 Q2 Q3 Q4 Q5 Q6 Q7
Q8
## 3.833333 3.600000 3.233333 3.466667 3.800000 3.966667 4.033333
4.300000
## Q9 Q10 DV IV
## 3.400000 4.000000 87.566667 3.763333

#Standard Deiation of Data


apply(data, 2, sd)

## Q1 Q2 Q3 Q4 Q5 Q6 Q7
Q8
## 0.7914776 0.9684684 0.8976342 0.8995529 0.8866831 0.8502873 0.9643055
0.7022132
## Q9 Q10 DV IV
## 0.6214555 1.0827806 3.8298585 0.5372236

#Normality Test
shapiro.test(data$DV)

##
## Shapiro-Wilk normality test
##
## data: data$DV
## W = 0.98343, p-value = 0.9076

shapiro.test(data$IV)
##
## Shapiro-Wilk normality test
##
## data: data$IV
## W = 0.9682, p-value = 0.4911

cor.test(data$DV, data$IV, method = "pearson", conf.level = 0.95)

##
## Pearson's product-moment correlation
##
## data: data$DV and data$IV
## t = 2.0575, df = 28, p-value = 0.04906
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.002449451 0.639211852
## sample estimates:
## cor
## 0.3623989

You might also like