Posts

Final Project

Image
 For the final project, the goal is to experience data analysis using statistical tools learned in this course. The dataset will be used to examine the life expectancy across U.S. states in 2021, based on males and females and identifying states with the highest and lowest overall life expectancy. We will also be trying to figure out which sex lives longer, in what states, and by how much. Using the statistical tools that we learned in class, this project combines descriptive statistics, inferential testing, and visualizations to draw meaningful conclusions from this dataset. The dataset comes from the CDC website under the National Center for Health Statistics. Below is a table with all the abbreviations for each variable that was given based on the dataset. Variable Description state              U.S. state name sex            “Male” or “Female” le             ...

Module 12 Assignment

Image
  The table below represents charges for a student credit card. a. Construct a time series plot using R. b. Employ E xponential Smoothing Model  as outlined in  Avril Voghlan Links to an external site. 's notes  and report the statistical outcome c.  Provide a discussion on time series and Exponential Smoothing Model results that you obtained .   First, I entered all the given data into one vector and called it "Charge". Next, I converted it into a time series and called it "Chargetimeseries" and added a frequency of 12 with a starting point of January 2012.   > plot.ts(Charge) After inputting all the data into a time series, I made a plot of the time series data using the plot.ts() function. The result is above, and it shows the number of charges made over time. The charges increased over time but slowed down for a little bit and then increased again. I used the HoltWinters() function to perform an exponential smoothing model as shown in the Avril ...

Module 11 Assignment

  12.1: Set up additive model for the ashina data, as part of ISwR package. This data contains additive effects on subjects, period, and treatment. Compare the results with those obtained from t test. > # 12.1 > library(ISwR) > data(ashina) > str(ashina) 'data.frame': 16 obs. of 3 variables: $ vas.active: int -167 -127 -58 -103 -35 -164 -3 25 -61 -45 ... $ vas.plac : int -102 -39 32 28 16 -42 -27 -30 -47 8 ... $ grp : int 1 1 1 1 1 1 1 1 1 1 ... > # Add subject as a factor > ashina$subject <-factor(1:16) > # Create two data frames: active and placebo > attach(ashina) > act <- data.frame(vas = vas.active, subject, treat = 1, period = grp) > plac <- data.frame(vas = vas.plac, subject, treat = 0, period = grp) > combined <- rbind(act, plac) > combined$treat <- factor(combined$treat) > combined$period <- factor(combined$period) > # Fit the additive model > model <- lm(vas ~ subject + period + treat, dat...