rpsg_getfunctionsensetivity: PSG Functions sensetivity calculation

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/rpsg_getfunctionsensetivity.R

Description

Calculates sensetivity (gradient) of a PSG function on some point.

Usage

1
2
3
rpsg_getfunctionsensetivity(function_description, point_argument,
  rho = parent.frame(), allowExt = TRUE, rpsg_suppress.Messages = FALSE,
  allowFunVal = TRUE)

Arguments

function_description

character with PSG function description: "risk_function(<parameter>,matrix_<name>)". This input depends on type of PSG function (parameter is present or absent, one, two or more matrices, ect.). matrix_<name> should be created as variable before calling function rpsg_getfunctionvalue.

point_argument

vector with names of members that correspond to names of optimization variables.

rho

optional parameter for setting frame. Default is rho = parent.frame().

allowExt

optional parameter to specify if a solver can use variables from data frame defined in rho (by the default allowExt = TRUE) or not (allowExt = FALSE).

rpsg_suppress.Messages

optional parameter specifying if messages, that may appear when you run this function, should be suppressed (rpsg_suppress.Messages = TRUE) or not (by the default: rpsg_suppress.Messages = FALSE).

allowFunVal

optional parameter specifying if output.list will include value of the PSG function on the given point (by the default allowFunVal = TRUE) or not (allowFunVal = FALSE)

Value

output.list list with the following components:

results$Fun_Value

numeric value of PSG function on the given point;

results$Fun_Sensetivity

vector of a function sensetivity (gradient) calculated on the given point.

Author(s)

Stan Uryasev [aut, cre, cph], Grigoriy Zrazhevsky [aut], Viktor Kuzmenko [aut], Alex Zrazhevsky [aut]

Maintainer: Stan Uryasev <stan.uryasev@aorda.com>

References

American Optimal Decisions
Portfolio Safeguard Help

See Also

rpsg_getfunctionincrement rpsg_getfunctionvalue

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#Create Matrix
matrix_scenarios <- matrix(c(1,4,8,3, 7,-5,4,-6, -2,8,-1,0,0,-3,-4,9),nrow=4, byrow=TRUE)
colnames(matrix_scenarios) <- colnames(matrix_scenarios,do.NULL = FALSE, prefix = "x")
scenario_benchmark <- c(-2, 11, 6, 10)
scenario_probability <- c(0.2, 0.2, 0.3, 0.3)
matrix_scenarios <- cbind(matrix_scenarios,scenario_benchmark,scenario_probability)

#Create Point
point_a <- c(1,1,1,1)
names(point_a) <-c("x1","x2","x3","x4")

val1<- rpsg_getfunctionsensetivity("cvar_risk(0.65,matrix_scenarios)",point_a)

print(val1)

PSGExpress documentation built on July 26, 2019, 5:02 p.m.