View source: R/Risk_Objective.R
Risk_Objective_Import | R Documentation |
Risk_Objective_Import
imports the Risk objective's data from an excel file.
The required data are a sheet containing parcels' Sigma and a sheet containing parcels' Correlation.
Function creates a list named Risk_Objective
, where Risk_Objective[["Sigma"]]
stores the the sigmas of parcels,
Risk_Objective[["Correlation"]]
stores the the Correlation of parcels.
This function is not sensitive to the order the parcels are stored in the sheet and will automatically store parcels sorted with the same order they were stored in Parcels
.
Risk_Objective_Import(Address, Sigma_Sheet = "Sigma",
Correlation_Sheet= "Correlation", Silence = FALSE,
Env= .GlobalEnv)
Address |
A string: the location and name of the excel file. |
Sigma_Sheet |
A string: the name of the sheet holding the parcels' sigmas' data. (Default: "Sigma") |
Correlation_Sheet |
A string: the name of the sheet holding the parcels' Correlations' data. (Default: "Correlation") |
Silence |
A binary parameter: if |
Env |
the environment where the package should create or access variables. By default the package works in the R's Global environment. (Default: .GlobalEnv) |
Risk objective is a quadratic function representing the portfolio optimization problem, and this function is to be Minimized.
The optimal value for this objective is zero and the optimal solution is to have all parcels divested (unprotected).
Therefore, there is no single objective optimizer for this objective, as its optimal solution is priorly known. (For more information refer to the paper)
To import the data, the excel file should include two sheets. A sheet including parcels' sigmas, and the name of the sheet is passed as Sigma_Sheet
.
The first row of this sheet will be ignored as captions. The first column of the sheet should include names, and the second column should include sigmas.
Here is an example Sigma table:
The second sheet should include the matrix of parcels' correlation, and the name of the sheet is passed as Correlation_Sheet
.
The first row of this sheet will be ignored. If the problem has n
parcels, then the correlation sheet should
have n+1
columns. The first column of the sheet should include names and the other n
columns should have the
n*n
correlation matrix. The Correlation matrix should be a symmetric matrix whose diogonal elements are all one.
The member in the i+1
'th row and j+1
'th column will then be the correlation between the parcels whose names are in the i+1
and j+1
row in the first column. Remember the first column has the parcel names.
Here is an example Correlation table:
NULL (creates some variables in the environment but returns nothing)
Other Risk Objective:
Risk_Objective_Create()
Other Import Functions:
First_Objective_Import()
,
Import_data()
,
Parcels_Import()
,
Second_Objective_Import()
## Not run:
Risk_Objective_Import("C:\\example.xlsx", Sigma_Sheet = "Sigma",
Correlation_Sheet= "Correlation")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.