03-multivariate-stats (1)

.html

School

University of Iowa *

*We aren’t endorsed by this school

Course

4143

Subject

Statistics

Date

Apr 25, 2024

Type

html

Pages

8

Uploaded by GeneralRiver11920

Report
Activity 3 - Explore Multivariate Statistics and Distributions Due on Monday, February 19th by 11:59 pm You will be asked to complete a short survey on ICON that asks questions about the output generated below. Furthermore, there are additional questions to consider sprinkled throughout the notebook below, these do not need to be explicitly answered, but can provide a bit of a guide to thinking and interpreting the following statistical output. If you want to view the code as the assignment was sent to you, you can use the version that is found on the public course repository . Setup This first code cell needs to be executed ("Run") everytime this notebook is opened. For example, if you stop working on this activity and come back to the activity, this first code cell will need to be executed again to load the data, even though output may still show up from the prior time you worked on the activity. In [1]: library(tidyverse) library(ggformula) library(mosaic) library(lubridate) theme_set(theme_bw(base_size = 16)) mae <- function(x, na.rm = TRUE, ...) { avg <- mean(x, na.rm = na.rm, ...) abs_avg <- abs(x - avg) mean(abs_avg) } Riders <- Riders |> select(date, day, highT, lowT, precip, clouds, riders, weekday) |> mutate(month = month(date, label = TRUE), precip_two = ifelse(precip > 0, 'Rained', 'No-Rain'), precip_two_num = ifelse(precip > 0, 1, 0)) ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ── dplyr 1.1.4 readr 2.1.4 forcats 1.0.0 stringr 1.5.1 ggplot2 3.4.4 tibble 3.2.1 lubridate 1.9.3 tidyr 1.3.0 purrr 1.0.2 ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ── dplyr::filter() masks stats::filter() dplyr::lag() masks stats::lag() Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to
become errors Loading required package: scales Attaching package: ‘scales’ The following object is masked from ‘package:purrr’: discard The following object is masked from ‘package:readr’: col_factor Loading required package: ggridges New to ggformula? Try the tutorials: learnr::run_tutorial("introduction", package = "ggformula") learnr::run_tutorial("refining", package = "ggformula") Registered S3 method overwritten by 'mosaic': method from fortify.SpatialPolygonsDataFrame ggplot2 The 'mosaic' package masks several functions from core packages in order to add additional features. The original behavior of these functions should not be affected by this. Attaching package: ‘mosaic’ The following object is masked from ‘package:Matrix’: mean The following object is masked from ‘package:scales’: rescale The following objects are masked from ‘package:dplyr’: count, do, tally
The following object is masked from ‘package:purrr’: cross The following object is masked from ‘package:ggplot2’: stat The following objects are masked from ‘package:stats’: binom.test, cor, cor.test, cov, fivenum, IQR, median, prop.test, quantile, sd, t.test, var The following objects are masked from ‘package:base’: max, mean, min, prod, range, sample, sum Riders data Some data that already come with R collected data on the number of users on a Massachusetts Rail Trail over a 90 day period from April 5, 2005 to November 15, 2005. Below is some information about the attributes in the data. date : date of data collection day : Day of the week highT : High temperature for the day lowT : Low temperature for the day precip : Precipitation amount in inches clouds : A measure of cloud cover (in oktas; higher is more cloud cover, 0 = no cloud cover, 8 = completely overcast). riders : Number of riders counted weekday : N = weekday or holiday; Y = non-holiday weekday month : Month of the year precip_two : Dichtomous variable indicating whether the day had any rain or not precip_two_num : Dichotomous variable where 1 = rained during the day; 0 = no rain In [2]: head(Riders, n = 10) A data.frame: 10 × 11
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