[R] Need Help To Solve An Equation In R

2017-05-28 Thread Kenneth Knoblauch
This looks an awful lot like you are trying to solve for d' in an m-alternative forced choice experiment for an unbiased observer. Try the function dprime.mAFC from the psyphy package. For comparison with your example, it's code is: psyphy:::dprime.mAFC function (Pc, m) { m <- as.intege

Re: [R] Need Help To Solve An Equation In R

2017-05-27 Thread Bert Gunter
Then: 1. Always cc the list; 2. Read and follow the posting guide: no HTML, plain text only. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sat, May 27, 201

Re: [R] Need Help To Solve An Equation In R

2017-05-27 Thread Bert Gunter
Homework? We generally don't do homework here. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sat, May 27, 2017 at 9:16 AM, Neetu Shah wrote: > D

Re: [R] Need Help To Solve An Equation In R

2017-05-27 Thread David Winsemius
> On May 27, 2017, at 9:16 AM, Neetu Shah wrote: > > Dear Sir/Ma'am, > > I am trying to make a function to solve an equation that is given below: > findH <- function(p_star, k){ > fun <- function(y){ > (pnorm(y+h))^(k-1)*dnorm(y) > } > lhs <- integrate(fun, -Inf, Inf)$value > return(uniroot(lhs

[R] Need Help To Solve An Equation In R

2017-05-27 Thread Neetu Shah
Dear Sir/Ma'am, I am trying to make a function to solve an equation that is given below: findH <- function(p_star, k){ fun <- function(y){ (pnorm(y+h))^(k-1)*dnorm(y) } lhs <- integrate(fun, -Inf, Inf)$value return(uniroot(lhs, lower = -10, upper = 10, tol = p_star)$root) } In lhs, I integrated a