Description Usage Arguments Details Value Author(s) References See Also Examples
Builds a price sensitivity function which is piecewise linear in price, in an automated manner, with built-in checks for possible infelicities.
1 |
alpha |
A list of functions of |
beta |
A list of functions of |
kn |
The knots (with respect to price) of the piecewise linear
price sensitivity function. The zero knot (which is always
the first knot) is not included in |
tmax |
The maximum time value to which the price sensitivity function is to be applied. Needed for internal consistency checks. |
The price sensitivity function is assumed to be of the form
S(x,t) = alpha_k(t) + beta_k(t)*x
for x_{k-1} <= x <=
x_k where x_1, x_2, ..., x_K are the
(non-zero) knots of the function. It is assumed that x_0
= 0. The variable x
represents price and the variable
t
represents residual time.
The function is defined over the rectangle [0,x_K] x [0,tmax].
Checks are done to make sure that
A function of two variables x
and t
, which is
a price sensitivity function. The argument x
represents
price and the argument t
represents (residual) time.
The value of the function is interpreted as the probability
that a customer “arriving” at time t
will purchase
an item offered at price x
.
Rolf Turner r.turner@auckland.ac.nz http://www.stat.auckland.ac.nz/~rolf
P. K. Banerjee, and T. R. Turner (2012). A flexible model for the pricing of perishable assets. Omega 40:5, 533–540. DOI https://doi.org/10.1016/j.omega.2011.10.001
Rolf Turner, Pradeep Banerjee and Rayomand Shahlori (2014). Optimal Asset Pricing. Journal of Statistical Software 58:11, 1–25. DOI https://doi.org/10.18637/jss.v058.i11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | lambda <- function(t) {
tn <- 1:4
A <- matrix(c(0,12,12,12,
0,-16,16,64,
20,30,30,0),nrow=4)
B <- matrix(c(12,0,0,0,
0,16,0,-16,
0,-10,-10,0),nrow=4)
s <- cut(t,breaks=c(0,tn),include.lowest=TRUE,labels=tn)
s <- as.numeric(levels(s)[s])
M <- matrix(A[s,] + B[s,]*t,ncol=ncol(A))
M[!is.finite(M)] <- 0
M
}
alpha <- vector("list",4)
beta <- vector("list",4)
alpha[[1]] <- with(list(lambda=lambda),
function(t) {
A <- c(1,1,1)
lll <- lambda(t)
dnm <- apply(lll,1,sum)
dnm[dnm==0] <- 1
lll%*%A/dnm
})
beta[[1]] <- with(list(lambda=lambda),
function(t) {
B <- c(0,0,0)
lll <- lambda(t)
dnm <- apply(lll,1,sum)
dnm[dnm==0] <- 1
lll%*%B/dnm
})
alpha[[2]] <- with(list(lambda=lambda),
function(t) {
A <- c(1.495,1,1)
lll <- lambda(t)
dnm <- apply(lll,1,sum)
dnm[dnm==0] <- 1
lll%*%A/dnm
})
beta[[2]] <- with(list(lambda=lambda),
function(t) {
B <- c(-0.2475,0,0)
lll <- lambda(t)
dnm <- apply(lll,1,sum)
dnm[dnm==0] <- 1
lll%*%B/dnm
})
alpha[[3]] <- with(list(lambda=lambda),
function(t) {
A <- c(0.01,2.485,1)
lll <- lambda(t)
dnm <- apply(lll,1,sum)
dnm[dnm==0] <- 1
lll%*%A/dnm
})
beta[[3]] <- with(list(lambda=lambda),
function(t) {
B <- c(0,-0.2475,0)
lll <- lambda(t)
dnm <- apply(lll,1,sum)
dnm[dnm==0] <- 1
lll%*%B/dnm
})
alpha[[4]] <- with(list(lambda=lambda),
function(t) {
A <- c(0.01,0.01,3.475)
lll <- lambda(t)
dnm <- apply(lll,1,sum)
dnm[dnm==0] <- 1
lll%*%A/dnm
})
beta[[4]] <- with(list(lambda=lambda),
function(t) {
B <- c(0,0,-0.2475)
lll <- lambda(t)
dnm <- apply(lll,1,sum)
dnm[dnm==0] <- 1
lll%*%B/dnm
})
kn <- c(2,6,10,14)
S <- buildS(alpha,beta,kn,4)
x <- seq(0,14,length=41)
t <- seq(0,4,length=41)
z <- S(x,t)
## Not run:
persp(x,t,z,theta=150,phi=40,d=4,xlab="price",ylab="time",
zlab="probability",ticktype="detailed")
## End(Not run)
|
AssetPricing 1.0-1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.