I am trying to use uniRoot to solve the below equation in R
Equation to solve - Assume Theta-F = 4 and Theta-L = 2
I know my code is wrong [shown below] but cant figure out why...
># Choose Theta-F and Theta-L, e = 0.01
>Theta_L <- 4
>e <- 0.01
>Theta_F <- 2
># Solve for (v)
>v <- log(Theta_L)/(log(1/e-1))
>print(v)
>print(1-v)
># Solve (3) for b
>sigma <- function(b, v){
> q <- ((b+v-1)/(2*b+v-2))
> retu(q)
>}
>print(sigma)
>equation <- function(sigma, w){
> e = 0.01
> Theta_F <- 2
> Theta_L <- 4
> v <- log(Theta_L)/(log(1/e-1))
> sigma <- function(b, v){
> q <- ((b+v-1)/(2*b+v-2))
> }
> function(e, sigma, v){
> w <- ((e/sigma)^(b+v-1) * ((1-e)/(1-sigma))^b-1)
> }
>}
># install.packages("rootSolve", dependencies = TRUE)
># library(rootSolve)
>solution <- uniroot.all(equation, c(0, 1-v))
The error i am getting is..
"Error in mod == 0 : comparison (1) is possible only for atomic and list types"
