Say that global temperatures could change over the next several decades and you have it on good advice that the change (in degrees Celsius) is equal to the percentage change in CO^2 use in the USA times .2 and then you would add the percentage change in CO^2 use in the rest of the world times .8. Over the time period the percentage change in CO^2 use in the USA is expected to fall with a uniform distribution between -10 and -6 percent and the percentage change in CO^2 use in the rest of the world has a normal distribution with mean of 2.2 percent increase and a standard deviation of .1. (Think of 2.2 percent, for example, as 2.2 and not 0.022.)
R code with comments
-------
#set the random seed
set.seed(123)
#a simulate 1000 trials of change
#Set the number of trials
R<-1000
#the percentage change in CO^2 use in the USA
pusa<-runif(R,-10,-6)
#the percentage change in CO^2 use in the rest of the world
prest<-rnorm(R,2.2,0.1)
# global temperatures change is (in degrees celsius)
gtemp<-pusa*0.2+prest*0.8
#b)
#number of times the global temp change is negative (that is
declined)
gcount<-sum(gtemp<0)
#the probability that global temperatures will DECLINE
sprintf('the probability that global temperatures will DECLINE
%.4f',gcount/R)
----
#get this
Get Answers For Free
Most questions answered within 1 hours.