Page 1 of 1

An efficient loop for storing sensitivity/specificity

Posted: Sat Jun 30, 2018 1:48 am
by AbnormalDistribution
I want to create a matrix that stores the sensitivity and specificity of my probit model at all thresholds from .01 to 1.00. So I create a 100x3 matrix and wrote this loop:

Code: Select all

%dep = "my_binary_var"
%eq = "my_equation"

matrix(100,3) my_matrix

for !i = 1 to 100
   !threshold = !i/100
   freeze(iteration_tab) my_equation.predict(!threshold)
   my_matrix(!i,1) = @val(iteration_tab(13,2))
   my_matrix(!i,2) = @val(iteration_tab(13,3))
   my_matrix(!i,3) = !threshold
   d iteration_tab
next


The thing is it seems a little clunky and unsophisticated because I have to freeze and delete the prediction table each time. Is there a better way I can approach this task?