estimate_read_csv | R Documentation |
This function reads an estimate
from the specified csv files. In this context, an
estimate of several variables is defined by its marginal distribution types, its marginal
90%-confidence intervals [lower,upper]
and, optionally, its correlations.
estimate_read_csv_old
reads an estimate from CSV file(s) according to the deprecated
standard. This function is for backward compatibility only.
estimate_read_csv(fileName, strip.white = TRUE, ...)
estimate_read_csv_old(fileName, strip.white = TRUE, ...)
fileName |
Name of the file containing the marginal information of the estimate that should be read. |
strip.white |
logical. Used only when |
... |
Further parameters to be passed to |
An estimate might consists of uncorrelated and correlated variables. This is reflected in the input file structure, which is described in the following.
The estimate is read from one or two csv files: the marginal csv file which is mandatory and the correlation csv file which is optional. The marginal csv file contains the definition of the distribution of all variables ignoring potential correlations. The correlation csv file only defines correlations.
File name structure: <marginal-filename>.csv
Mandatory columns:
Column name | R-type | Explanation |
variable | character vector | Variable names |
distribution | character vector | Marginal distribution types |
lower | numeric vector | Marginal 5%-quantiles |
upper | numeric vector | Marginal 95%-quantiles |
Frequent optional columns are:
Column name | R-type | Explanation |
description | character | Short description of the variable. |
median | cf. estimate | Marginal 50%-quantiles |
method | character vector | Methods for calculation of marginal distribution parameters |
Columns without names are ignored. Rows where the variable
field is empty are also dropped.
File name structure: <marginal-filename>_cor.csv
Columns and rows are named by the corresponding variables. Only those variables need to be present which are correlated with others.
The element ["rowname","columnname"]
contains the correlation between the variables
rowname
and columnname
. Uncorrelated elements have to be set to 0
. The
diagonal element ["name","name"]
has to be set to 1
.
The matrix must be given in symmetric form.
estimate_read_csv_old
)File name structure of the correlation file: <marginal-filename>.csv_correlations.csv
An object of type estimate
which element $marginal
is read from
file fileName
and which element $correlation_matrix
is read from file
gsub(".csv","_cor.csv",fileName)
.
estimate_write_csv
, read.table
, estimate
estimate_read_csv
, read.table
, estimate
# Read the joint estimate information for the variables "sales", "productprice" and
# "costprice" from file:
## Get the path to the file with the marginal information:
marginalFilePath=system.file("extdata","profit-4.csv",package="decisionSupport")
## Read the marginal information from file "profit-4.csv" and print it to the screen as
## illustration:
read.csv(marginalFilePath, strip.white=TRUE)
## Read the correlation information from file "profit-4_cor.csv" and print it to the screen as
## illustration:
read.csv(gsub(".csv","_cor.csv",marginalFilePath), row.names=1)
## Now read marginal and correlation file straight into an estimate:
parameterEstimate<-estimate_read_csv(fileName=marginalFilePath)
print(parameterEstimate)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.