Review Continuous
On your USB drive, create a new directory, copy model.R to that directory,
rename the file in the new directory, double click on the file to open Rstudio.
Then copy all of the text below the line and paste it into your Rstudio editor pane.
# quick review of Aplfelton and Blummenkopf
#
# for Apfelton
source("../apfelton.R")
#
# find P(X<1.34)
papfelton( 1.34 )
# find P( X > 1.34)
1 - papfelton( 1.34 ) # first way to do this
papfelton( 1.34, lower.tail=FALSE) # second way
#
# find P( -0.43 < X < 1.73 )
papfelton( 1.73 ) - papfelton( -0.43 )
#
# find P( X < -0.75 or X > 1.14 )
# first way
papfelton( -0.75 ) + ( 1 - papfelton(1.14))
# second way
papfelton( -0.75 ) + papfelton(1.14, lower.tail=FALSE)
# third way
1 - ( papfelton(1.14)-papfelton( -0.75) )
#
# find the value of x such that
# P( X < x ) = 0.23
qapfelton( 0.23 )
# find the value of x such that
# P( X > x ) = 0.23
qapfelton( 1 - 0.23 ) # first way
qapfelton( 0.23, lower.tail=FALSE) # second way
# for Blumenkopf
#
source("../blumenkopf.R")
#
# find P(X<1.34)
pblumenkopf( 1.34 )
# find P( X > 1.34)
1 - pblumenkopf( 1.34 ) # first way to do this
pblumenkopf( 1.34, lower.tail=FALSE)
#
# find P( -0.43 < X < 1.73 )
pblumenkopf( 1.73 ) - pblumenkopf( -0.43 )
#
# find P( X < -0.75 or X > 1.14 )
# first way
pblumenkopf( -0.75 ) + ( 1 - pblumenkopf(1.14))
# second way
pblumenkopf( -0.75 ) + pblumenkopf(1.14, lower.tail=FALSE)
# third way
1 - ( pblumenkopf(1.14)-pblumenkopf( -0.75) )
#
# find the value of x such that
# P( X < x ) = 0.23
qblumenkopf( 0.23 )
# find the value of x such that
# P( X > x ) = 0.23
qblumenkopf( 1 - 0.23 ) # first way
qblumenkopf( 0.23, lower.tail=FALSE) # second way
# there is another type of problem that we can
# do because the Blumenkopf distribution is symmetric.
# find x such that
# P( -x < X < x ) = 0.58
# we can find -x by
qblumenkopf( (1 - 0.58)/2)
# we can find x by
qblumenkopf( 0.21, lower.tail= FALSE)
# or
qblumenkopf( 0.79 )
#
# or find x such that
# P( X <-x or X>x ) = 0.075
# Because we have a symmetric distribution we
# also know that this means
# that P( X < -x ) = 0.075/2 = 0.0375
qblumenkopf( 0.0375 ) # which gives the value for -x
# or we could do
qblumenkopf(0.0375, lower.tail=FALSE) # to get x