I would like to make to plot this following function:
where
Let r in (0,1) and \mu in (0,1) but in my case \mu=0.5. My code is following and I have the problem to make a plot of this function.
n <- 10
r <- seq(from=0.0, to=1, by = 0.0001)
h.star <- r*log(r/0.5)+(1-r)*log((1-r)/(1-0.5))
F.mu <- function(r) {
if (r > 0 & r < 0.5)
F.mu <- exp(-n*h.star)
else (r > 0.5 & r < 1)
F.mu <- 1
}
plot(r, F.mu)
Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ
F.muis a function, so test it withstr(F.mu)just beforeplot(...)- jogoplot(x.bar, F.mu(r)), assumingx.baris a vector of the same length ofF.mu(r). - LAPifelse()- jogo