5
I need to calculate this simple integral below:
It is the quantile function of the standard normal, where before hand we know that, q_0.5(z) = 0
, for example.
That is, for each theta (percentile) it gives me a number in the standard normal density. The theta goes from 0 to 1.
I managed this function in R and organized in a matrix:
thau=1:99/100
qnorm(thau,0,1)
matrix=matrix(0,99,2)
matrix[,1]=thau
matrix[,2]=qnorm(thau,0,1)
colnames(mattrix)=c("theta","q(z)")
How do I calculate this interaction in R, since I already have the function q??
I thought of calculating the two integrals using the basic integral rules. Can I do this for this function? I think I can
Would that be correct? To me it did -1.170456
.
I’d love your help.
Thank you.
Thanks, @Marcusnunes. I edited the equation, I made a mistake. I think it’s a little confusing my question, I’ll get better. But basically the function q_theta(z), the numerator, is this function: Plot(qnorm(Thau,0,1)) . I want to compute the integral of the numerator from 0 to 0.5. The integral of the denominator is that I cannot calculate.
– Laorie
Right. You can’t calculate the integral of the denominator. Run the command
x <- seq(0, 0.5, 0.0001); plot(x, qnorm(x)/(qnorm(x)^2), type="l")
and see how the value of this function diverges. Howqnorm(0.5)=0
,(qnorm(0.5))^2=0
. Therefore, the denominator is0
in0.5
. Therefore, the functionqnorm(x)/(qnorm(x)^2)
is not set at 0.5, preventing its integral from being calculated.– Marcus Nunes
I have a question. I will take advantage of the topic. What function can I use to calculate the integral of this function that I plotted Plot(qnorm(Thau,0,1)), or any other, without creating a Function? I found the AUC function: auc(Thau[1:50],Matrix[,2][1:50]). It is the most indicated?
– Laorie
I don’t know this auc function, so I can’t say exactly what it’s for. If I had to solve your problem, I would create a trivial function in R and calculate the integral from it, like this:
funcao <- function(x) return(qnorm(x)); integrate(funcao, lower=0, upper=0.5)
(if any of my answers help you, don’t forget to vote and accept as final)– Marcus Nunes