plotRP: Plot the risk premium.

Description Usage Arguments Examples

Description

Plot the risk premium.

Usage

1
2
3
plotRP(my_title, my_title_colour, my_title_font_size, my_x_label, xmin, xmax,
  my_y_label, my_color, fun, par, ev, eu, ce, my_labels, my_label_colors,
  my_label_positions, font_scaling)

Arguments

my_title

text, the title

my_title_colour

text, the title colour

my_title_font_size

numeric, the title font size

my_x_label

text, my_x_label

xmin

numeric, the xmin

xmax

numeric, the xmax

my_y_label

text, the my_y_label

my_color

text, the line color

fun

function, the utility function

par

vector, the uf_parameters

ev

numeric, the expected value

eu

numeric, the expected utility

ce

numeric, the certainty equivalent

my_labels

vector, text labels

my_label_colors

vector, colors of the text labels

my_label_positions

vector, positions of the text labels

font_scaling

numeric, the scaling of the text labels

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
choice_ids <- c(1, 1, 1, 2, 2, 2, 2)

gamble_ids <- c(1, 1, 2, 1, 1, 2, 2)

outcome_ids <- c(1, 1, 2, 1, 2, 1, 2)

objective_consequences <- c(4000, 0, 3000,
4000, 0, 3000, 0)

probability_strings <- c("0.8", "0.2", "1.0",
"0.2", "0.8", "0.25", "0.75")

my_choices <- Choices(choice_ids=choice_ids,
	gamble_ids=gamble_ids,
	outcome_ids=outcome_ids,
	objective_consequences=objective_consequences,
	probability_strings=probability_strings)

my_choices

my_utility <- Utility(fun="power",
par=c(alpha=0.88, beta=0.88, lambda=1))
eu_df <- compareEU(my_choices, utility=my_utility, digits=4)
eu_df

ev <- as.numeric(eu_df$ev[1])
eu <- as.numeric(eu_df$eu[1])
ce <- as.numeric(eu_df$ce[1])

plotRP(my_title = "risk premium",
	my_title_colour="black",
	my_title_font_size=4,
	my_x_label = "objective consequence",
	my_y_label = "subjective value",
	xmin = 2500, xmax = 3500,
	my_color="violet",
	fun=power_uf,
	par=c(alpha=0.88, beta=0.88, lambda=1),
	ev=ev, eu=eu, ce=ce,
	my_labels=c(expression(paste(U(x)==x^alpha, ",
	", x>=0)),
	expression(paste(plain()==-lambda * (-x)^beta, ", ", x<0)),
	"ev","eu","ce","rp"),
	my_label_colors=c("violet","violet","black","red","orange","blue"),
	my_label_positions=list(c(2700,1275),c(2740,1250),c(3250,1075),
	c(2800,1170),c(3050,1075),c(3150,1170)),
	font_scaling=1)

gary-au/pt documentation built on May 16, 2019, 5:41 p.m.