Box cox transformation and shapiro wilk test using apply function


#1

I am having issues with an assignment. We are supposed to use the Movies dataset and then split it by rating variable. Afterwards, we are to apply a box cox transformation and shapiro wilks test on the "GrossTake" variable of the split data using one of the "apply" family of functions. I can do those using a single loop but our professor is adamant in using one of those special functions.

#Getting the dataset

library(MindOnStats)

data(Movies)

str(Movies)

head(Movies)

#changing name of dataset

d3 <- Movies

head(d3)

summary(d3)

#packages for Box Cox Transformation

library(Matrix) # ... for matrix operations

library(car) # ... for ellipse plots

library(stats) # ... for statistical operations

library(MASS) # ... for Multivariate Normal Distribution

library(graphics) # ... for arrows

#splitting the data by Rating

d4 <- with(d3,split(d3,Rating))

head(d4)

length(d4)