# Statistics In R With According Grahs Using The Structions Given In The Heads

Posted Under: System Analysis And Design

Hire Experts For Answers

Order Now

#### Related Study Services

DESCRIPTION
Posted
Modified
Viewed 14
working code, I'm having trouble completing the assessment, I have done most of the code but some are not working especially task 2 and 4. would appreciate some help

This order does not have tags, yet.

Attachments
################################################################################ # MATH 2032 - Continuous Assessment Test 3 # SOLUTIONS ################################################################################ # This is a graded test worth 15% of your final mark. # Complete tasks listed below. Type your code in each section. # Provide your discussion where required as comments. # Meaningful discussion is equally important as a correct code # and will be marked accordingly. # Save this file with your code and submit it through LearnOnline # Task 1 - (15 points) --------------------------------------------------------- # This is a repeat of the question 4 (part 1) from Test 2. Produce the same # calculations and appropriate data visualisation BUT using different tools: # 1. use apply() family functions from base package, no loops # 2. use dplyr or purrr package, no loops # 3. use ggplot2 for data visualisation # 4. no discussion required on the results # Hint: Don't forget to load libraries you use! ################################################################################ # Some researchers propose an alternative measure of tailedness. It is # calculated as a standard deviation divided by mean absolute deviations. # Please google "calculate mean absolute deviations in R". # 1. Make a code that calculates kurtosis and new measure proposed above for # each column of the data set below. You will get values of kurtosis and # corresponding values of new measure. Plot the graph to study a relationship # between these two variables. ################################################################################ mydata <- datasets::volcano # ---- your code and comments here ---- # # Task 2 - (35 points) --------------------------------------------------------- # Load data set "brca" from the package "dslabs". Check the help file for the # description. The data are provided as a list, we need it as data frame temp <- dslabs::brca ?dslabs::brca df <- cbind(as.data.frame(temp\$x), outcome = temp\$y) # We are interested what variables might be the best indicators for the "outcome" # malignant ("M") or benign ("B"). There are 30 features (variables) and we # want to select three variables that have the largest difference between means # for groups M and B. # 1. Use "dplyr" functionality to find these variables - no loops. # 2. Create data visualisation to show the difference in distributions for these # variables in two groups (M/B) - use ggplot2 package, plot them all on one graph. # 3. Briefly discuss the result - can you predict outcome based on these # distributions. # Hints: # 1. All variables have different measurements, to be able to compare # them you need to "standardise" the data - check function scale() # 2. To find the difference you can use subtraction or function diff(). Remember # that difference can be positive or negative - you need three largest # differences by absolute values. # 3. To plot three selected variables together you might need to transform # the data set from wide table into long table. # 4. Use your common sense and data understanding for results reporting and # interpretation. E.g. if the graph does not make sense, then you have to # change it. # ---- your code and comments here ---- # # Task 3 - (25 points) --------------------------------------------------------- # Load data set "ToothGrowth" from the package "datasets". # Check the help file for the description. df <- datasets::ToothGrowth ?datasets::ToothGrowth # We are interested in the relationship between tooth length and supplement # type/dosage. The variable "dose" - does in milligrams per day - is a numerical # variable, however it has a very limited variability. print(unique(df\$dose)) # There are just three values for "dose" - that is, we can treat them as three # groups. You need to do appropriate data conversion for analysis/plotting. # 1. Get statistical and graphical summaries for two groups of supplements (OJ # and VC). Provide a discussion what supplement is better for tooth growth. # 2. Get statistical and graphical summaries for groups of supplements and dosages. # Provide a discussion what combinations of supplement and dosages are better # for tooth growth. # ---- your code and comments here ---- # # Task 4 - (25 points) --------------------------------------------------------- # Load data set "trump_tweets" from the package "dslabs". # Check the help file for the description. df <- dslabs::trump_tweets ?dslabs::trump_tweets # Former US presendent Donald Trump is remembered as a prolific tweeter user. # The data set includes all tweets from Donald Trump's twitter account # from 2009 to 2017. We want to analyse how "productive" was Donald Trump. # You have to find out: # 1. How many tweets in average per week were created by Donald Trump? How many # retweets in average per week were created in response to Donald Trump's # tweets, that is, how popular were his tweets? Provide a brief summary of # your findings. # 2. Make a historical plot of tweets per week created by Donald Trump over # eight years? Provide brief comments on his "performance". # 3. Make a graph showing a relationship between the number of tweets and the # number of retweets per week. Provide brief comments on a possible relationship. # Hint: There is a variable "created_at" that you can use to group data in weeks. # Package "lubridate" has a set of functions to deal with date/time related # variables. E.g. day(), week(), month(), year(), etc. You can find them useful. # However you are free to use any other functions or packages. # Beware: there are several years of data, so the week with the same number might # appear in the data several times. # ---- your code and comments here ---- # # THE END - DON'T FORGET TO SAVE YOUR R-SCRIPT ---------------------------------
Explanations and Answers 0

No answers posted

### Post your Answer - free or at a fee

#### Login to your tutor account to post an answer

Posting a free answer earns you +20 points.

Login

Get answers to: Statistics In R With According Grahs Using The Structions Given In The Heads or similar questions only at Tutlance.

Related Questions