Hello, I am trying to solve an equation that looks like this: 0.5 = average value of f(alpha, beta, N(0,1)), here f is the cdf of beta distribution. Say I generate 10000 number x_i from N(0,1), for each x_i, I calculate the corresponding cdf value, f_i (alpha, beta,x_i), then I average all these 20000 f_i. Given that beta=1 in my beta distribution, I would like to find alpha in my beta distribution. I tried writing a code like this: %let beta = 1; %let ans = 0.5; %let mean = 0; %let std = 1; %let num_normal=10000; proc iml; start Func(alpha); sumfp = 0; call streaminit(0); do normal_i = 1 to &num_normal; x = rand('normal',mean,std); fp = CDF('BETA',x,alpha,&beta); sumfp = sumfp + fp; end; return ( sumfp/&num_normal - &ans ); finish; intervals = {0, 100}; soln = froot('Func',intervals); It clearly did not work, and I have no idea how to proceed from here. Please advise! Thanks!
... View more