games {causalweight} | R Documentation |
Sales of video games
Description
A dataset containing information on 3956 video games, including sales as well as expert and user ratings.
Usage
games
Format
A data frame with 3956 rows and 9 variables:
- name
factor variable providing the name of the video game
- genre
factor variable indicating the genre of the game (e.g. Action, Sports...)
- platform
factor variable indicating the hardware platform of the game (e.g. PC,...)
- esrbrating
factor variable indicating the age recommendation for the game(E is age 6+, T is 13+, M is 17+)
- publisher
factor variable indicating the publisher of the game
- year
numeric variable indicating the year the video game was released
- metascore
numeric variable providing a weighted average rating of the game by professional critics
- userscore
numeric variable providing the average user rating of the game
- sales
numeric variable indicating the total global sales (in millions) of the game up to the year 2018
References
Wittwer, J. (2020): "Der Erfolg von Videospielen - eine empirische Untersuchung moeglicher Erfolgsfaktoren", BA thesis, University of Fribourg.
Examples
## Not run:
#load data
data(games)
#select non-missing observations
games_nomis=na.omit(games)
#turn year into a factor variable
games_nomis$year=factor(games_nomis$year)
#attach data
attach(games_nomis)
#load library for generating dummies
library(fastDummies)
#generate dummies for genre
dummies=dummy_cols(genre, remove_most_frequent_dummy = TRUE)
#drop original variable
genredummies=dummies[,2:ncol(dummies)]
#make dummies numeric
genredummies=apply(genredummies, 2, function(genredummies) as.numeric(genredummies))
#generate dummies for year
dummies=dummy_cols(year, remove_most_frequent_dummy = TRUE)
#drop original variable
yeardummies=dummies[,2:ncol(dummies)]
#make dummies numeric
yeardummies=apply(yeardummies, 2, function(yeardummies) as.numeric(yeardummies))
# mediation analysis with metascore as treatment, userscore as mediator, sales as outcome
x=cbind(genredummies,yeardummies)
output=medweightcont(y=sales,d=metascore, d0=60, d1=80, m=userscore, x=x, boot=199)
round(output$results,3)
output$ntrimmed
## End(Not run)