Distributions: Exercises


3. Default rate. You are told that there are an average of 10 defaults in a loan portfolio each month. Assume that the number of monthly defaults follows a Poisson distribution.

Simulate a time series of monthly defaults for 48 periods using rpois(n, lambda).


# Define the number of time periods. n <- ___ # Define the parameter lambda. lambda <- ___ # Simulate times series of defaults. defaults <- ___(n, ___) # Plot time series. plot(defaults) # Define the number of time periods. n <- 48 # Define the parameter lambda. lambda <- 10 # Simulate times series of defaults. defaults <- rpois(n, lambda) # Plot time series. plot(defaults) test_error() test_object("n", incorrect_msg="Check the number of months in the simulation.") test_object("lambda", incorrect_msg="Recall that the lambda paramter is equal to the mean (and variance) of the distribution.") success_msg("Excellent work.")
Check the problem description for the number of months and value of lambda.

Previous Exercise Next Exercise