Aan de slagGa gratis aan de slag

Simulating sales under new market conditions

The company's financial analyst is predicting that next quarter, the worth of each sale will increase by 20% and the volatility, or standard deviation, of each sale's worth will increase by 30%. To see what Amir's sales might look like next quarter under these new market conditions, you'll simulate new sales amounts using the normal distribution and store these in the new_sales data frame, which has already been created for you.

In addition, dplyr and ggplot2 libraries are loaded.

Deze oefening maakt deel uit van de cursus

Introduction to Statistics in R

Cursus bekijken

Oefeninstructies

  • Currently, Amir's average sale amount is $5000. Calculate what his new average amount will be if it increases by 20% and store this in new_mean.
  • Amir's current standard deviation is $2000. Calculate what his new standard deviation will be if it increases by 30% and store this in new_sd.
  • Add a new column called amount to the data frame new_sales, which contains 36 simulated amounts from a normal distribution with a mean of new_mean and a standard deviation of new_sd.
  • Plot the distribution of the new_sales amounts using a histogram with 10 bins.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Calculate new average amount
new_mean <- ___

# Calculate new standard deviation
new_sd <- ___

# Simulate 36 sales
new_sales <- new_sales %>% 
  mutate(amount = ___)

# Create histogram with 10 bins
___
Code bewerken en uitvoeren