# NOT RUN {
## Example 1. Using profit data from ceRtainty package
data(profitSWG)
# Storing CE values using Power utility function
c1 <- certainty(data = profitSWG,
ival = .5,
fval = 4,
utility = "Power")
c1$CE_values # Table with CE values
c1$RAC # RAC vector used in CE computation
c1$CE_plot() # Invoking the CE plot
# To use the ExpNeg function, it is required the RRAC (ARAC/wealth)
# so we can compute the mean value among all profit in the dataset.
# Mean value among all profit value
mean(sapply(profitSWG,mean)) # 5081.844
# Storing CE values using Power utility function
c1 <- certainty(data = profitSWG,
ival = .5/5082,
fval = 4/5082,
utility = "ExpNeg")
c1$CE_values # Table with CE values
c1$RAC # RAC vector used in CE computation
c1$CE_plot() # Invoking the CE plot
## Example 2. Using the example values of Hardaker et al. (2004)
dt <- data.frame(treatment=c(100,125,135,142,147,150,153,158,163,175,195))
# Storing CE values using Power utility function. Hardaker use an
# unique RAC value (0.005)
c2 <- certainty(data = dt,
ival = .005,
fval = .005,
utility = "Power")
# or
c2 <- certainty(data = dt,
ival = .005,
fval = .005,
utility = "ExpNeg")
c2$CE_values
c2$RAC
c2$CE_plot()
# }
Run the code above in your browser using DataLab