In: Statistics and Probability
Monthly rent at an apartment complex is $500. Operating costs
follow a normal distribution with a mean of $15000 and a standard
deviation of $300 (minimum of 0). The number of apartments rented
follow a triangular distribution with a minimum of 30, most likely
34, and
a maximum of 40. Run the simulation and report the descriptive
statistics for the profit of the complex (mean, etc.). Also, report
percentile information on the level of profit. Finally, you are
concerned that the complex might lose money in a typical month and
you will be fired as a result. Should you be worried?
Let X be the operating cost of the complex. X has a normal distribution with mean and standard deviation
Let Y be the number of apartments rented. Y follows a triangular
distribution with a minimum of 30, most likely 34, and
a maximum of 40
The profit is Y*500 -X
R code to calculate the profit (all statements starting with # are comments)
#set the random seed
set.seed(123)
#set the number of simulations
n<-10000
#simulate n operating costs from normal(15000,300)
x<-rnorm(n,mean=15000,sd=300)
#set the minimum to 0
x<-ifelse(x<0,0,x)
#simulate n number of apartments rented from triangular
distribution
library(triangle)
y<-rtriangle(n, a=30, b=40, c=34)
#calculate the profit
profit<-500*y-x
#print the summary of profit
sprintf('The mean Profit is %.4f',mean(profit))
sprintf('The standard deviation of Profit is
%.4f',sd(profit))
#the five number summary of profit is
summary(profit)
# get this output
The 25 percentile of the profit is $1,554.0 and 75 percentile of profit is $3,097.4
Finally the complex loses money when the profit is less than 0.
the probability that profit is less than zero is
r code is below
#probability of losing money
p<-sum(profit<0)/n
sprintf('The probability that the complex might lose money is
%.4f',p)
## get this
There is only a 0.005 probability that the complex might loose money in a typical month. This is a pretty low number, and hence you should not be worried about getting fired.