util {sgmodel} | R Documentation |
Util
Description
The function util
computes values for different types of utility functions and different parameters. See sgmodel_vignette
for detailed functional forms.
Usage
util(x, A, prefparam, type = c("log", "CRRA", "CARA", "Cobb-Douglas", "CES"),
ngoods, ...)
Arguments
x |
A numeric vector of length ngoods with values to compute utility for. |
A |
A numerical value that will premultiply the utility function. Default value set to 1. |
prefparam |
A numerical value, the preference parameter applied to the utility function depending on type. |
type |
A character for the Type of utility function. Can be "log", "CRRA", "CARA", "Cobb-Douglas", "CES". Default type set to "log". |
ngoods |
Numerical value for the number of goods to consider. Default value set to 1. |
... |
Additional arguments. |
Value
A numerical value, the utility function evaluated at the arguments.
References
Merton R. C (1971), Optimum consumption and portfolio rules in a continuous-time model. Journal of Economic Theory, 3(4), 373–413. URL https://www.sciencedirect.com/science/article/pii/002205317190038X.
Examples
x <- c(exp(1), exp(1))
A <- 2
type <- "log"
ngoods <- 2
util(x = x, A = A, type = type, ngoods = ngoods)