Q7

pdf

School

University of Waterloo *

*We aren’t endorsed by this school

Course

442

Subject

Statistics

Date

Apr 3, 2024

Type

pdf

Pages

7

Uploaded by BailiffJellyfishMaster1195

Report
STAT 442/842 CM 762: Assignment 3 Umaid M Zaffar 20963456 NOTES This assignment has two parts - A reading assignment (questions 1-6) and a programming question (question 7). Each part should be submitted as a .pdf format via Crowdmark. (Crowdmark should be able to split this for you, but make sure before submitting) The purpose of this assignment is, in part, to help you with your final projects. It’s meant to take less than half as long as a typical assignment, hence the shorter deadline. Even the programming question comes with a detailed guide. 1
Question 7, Pokemon Radar Graphs (20 points). Use the radar chart guide at https://www.datanovia.com/en/blog/beautiful-radar-chart-in-r-using-fmsb-and- ggplot-packages/ and the pokemon.csv dataset provided to recreate a 5-point radar for the first 9 pokemon (Bulbasaur to Blastoise) using the variables: (base_happiness, hp, attack, defense, speed) in that order, with base_happiness being at the top. You don’t need the accent mark on Pokemon. Your radar plot should look like the 10 students graph at the end of the guide, but with five points instead of nine. It should have: A radar background of the five stats listed, with labels and dashed lines (6 points) Faceted in a 3x3 grid, in pokedex order. (e.g. 1 in top left, 9 in bottom right) (2 points) A thick solid line and points around the stats that each pokemon has. (4 points) The colour of each line should be green (00FF00) for grass types, red for fire types, and blue for water types, going by type1. (2 points) A shaded region in a gray colour for the average stats across all 9 pokemon. (4 points) A proper title for the whole picture (1 point) A proper title for each Pokemon (1 point) library(fmsb) library(scales) library(dplyr) ## ## Attaching package: ' dplyr ' ## The following objects are masked from ' package:stats ' : ## ## filter, lag ## The following objects are masked from ' package:base ' : ## ## intersect, setdiff, setequal, union getColor <- function (type){ if (type == ' grass ' ){ return( ' #00FF00 ' ) } else if (type == ' fire ' ){ return( ' #FF0000 ' ) } else { return( ' #0000FF ' ) } } data = read.csv( ' pokemon.csv ' ) data = head(data, n= 9 ) df <- as.data.frame(data) df <- select(df, ' base_happiness ' , ' hp ' , ' attack ' , ' defense ' , ' speed ' ) rownames(df) <- data$name df_scaled = round(apply(df, 2 , scales::rescale), 2 ) df_scaled <- as.data.frame(df_scaled) 2
col_max <- apply(df_scaled, 2 , max) col_min <- apply(df_scaled, 2 , min) # Calculate the average profile col_mean <- apply(df_scaled, 2 , mean) # Put together the summary of columns col_min[ 1 ] <- 0.0 col_max[ 1 ] <- 1.0 col_summary <- t(data.frame( Max = col_max, Min = col_min, Average = col_mean)) # Bind variables summary to the data df_scaled2 <- as.data.frame(rbind(col_summary, df_scaled)) df_scaled2$type <- c(NA, NA, NA, data$type1) opar <- par() # Define settings for plotting in a 3x3 grid, with appropriate margins: par( oma= c( 0 , 0 , 3 , 0 )) par( mar = c( 3 , 3 , 3 , 3 )) par( mfrow = c( 3 , 3 )) for (i in 4 :nrow(df_scaled2)) { radarchart( df_scaled2[c( 1 : 3 , i), 1 : 5 ], pfcol = c( "#99999980" ,NA), pcol= c(NA,getColor(df_scaled2[i, 6 ])), plty = 1 , plwd = 2 , title = row.names(df_scaled2)[i] ) } mtext( "Pokemon Statistics as seen on Pokedex" , outer = TRUE, cex = 1.5 , font= 4 , col= rgb( 0 , 0 , 0 , 0.5 ) ) 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Bulbasaur base_happiness hp attack defense speed Ivysaur base_happiness hp attack defense speed Venusaur base_happiness hp attack defense speed Charmander base_happiness hp attack defense speed Charmeleon base_happiness hp attack defense speed Charizard base_happiness hp attack defense speed Squirtle base_happiness hp attack defense speed Wartortle base_happiness hp attack defense speed Blastoise base_happiness hp attack defense speed Pokemon Statistics as seen on Pokedex 4
5
6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Partial Key (Try to answer the questions first without looking at these, but do look at these because they’re meant to help you with your final project) Question 1. There are many answers. Possible answer a: Fig. 12 - Dark Scorigami, first appears around 8:45. The use of this graph has several elements like the lego pieces that wouldn’t come from an off-the-shelf geometry that we have encountered. It would take a substantial effort to include those. It also has a picture-in-picture aspect to it which would be homebrewed. Possible Answer b: Points scored by winner (or tyer) vs. loser by year. First appears around 1:00. This graph is a binary response, as a function of x (winning score), y (losing score), and t (year). Year first appears around 3 minute mark. Possible Answer c: Diagram of the Chiefs-Browns game that appears around 13:30. It uses an image and video overlay of an actual football field, giving it a continuous (x,y,t) element. It also has annotated ball movements like “Taunting penalty”, which is a function of (x,t). Possible Answer c: NFL Extra Point Accuracy by year, appears around 12:00. This has both accuracy and season. It’s not fully continuous in either case, because accuracy is in jumps of 1/(Number of attempts) and year is in jumps of 1, but there are enough small gradients for it to be treated continuously. Question 3. 1 points for a summary sentence or two. 3 points for describing the layout. Possible answer: Title: American football has some bizarre scoring implications. Using the better poster layout, on the left, I would have some additional information about the rules of American football to explain the scoring system, and some of the explanation about why this could lead to some scores being much easier to attain than others. on the right, from top to bottom I would put the table of all scores, the lego brick piles (as a bar graph), and the scoring plays of the Chiefs-Browns game as a table instead of lego bricks. If space, I would consider the chart of number of scorigami by year. 7