Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: error when attempting to calculate scores


From   Laura Yu <Laura.Yu@fcc.gov>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: error when attempting to calculate scores
Date   Fri, 19 Apr 2013 15:53:18 +0000

Dear Statalisters, 

I need to calculate the scores for two of the three equations of my model (the parameter of the third equation is constrained). I've tried both "ml score scores_*, missing" and "predict double score1 score2 score3, scores". For both I get the same error message: 

Mopt_score(): 3200 conformability error 
       <istmt>:   -function returned error 
r(3200); 

This might be caused by missing values in the predicted index (--predict indexx, xb - works) but the missing option might take care of that. Does anyone know how to find the scores? 

Thanks in advance for all your help! 

-Laura

The program is below:

program orbitdo
       version 11.2 
       syntax varlist [if] [in] [, cluster] 
       gettoken y xb: varlist 
       args lnf beta lnsigma lambda 
       local y "$ML_y1" 
       tempvar sigma lnfi bos lmbos diffnorm 
       scalar `sigma' = exp(`lnsigma') 
       qui gen double `bos' = -`beta'/`sigma' 
       qui gen double `lmbos' = (`lambda' -`beta')/`sigma' 
       qui gen double `diffnorm' = normal(`lmbos') - normal(`bos') 
       qui replace `diffnorm' = ln(1e-19) if `diffnorm' < 1e-19
       qui gen double `lnfi' = 0 
       quietly replace `lnfi'= lnnormal(`bos') if `y'== 0 
       quietly replace `lnfi'= ln(`diffnorm') if `y'> 0 & `y' <= t
       quietly replace `lnfi' = lnnormal(-`lmbos') if `y' > t 
       quietly replace `lnf' = `lnfi' 
end 

program orbit 
       syntax varlist [if] [in] [, cluster]
       gettoken y xb: varlist 
       scalar sval = 41 
       scalar t = 40
       constraint 1 [lam]_cons = sval 
       ml model lf orbitdo (pay: `y' = `xb') (lnsig: ) (lam:) , constraint(1)
       ml maximize 
       ml score scores_*, missing                      //this is the culprit 
       predict xbest, xb 
       constraint 2 [pay]xbest = 1 
       constraint 3 [pay]_cons = 0 
       ml model lf orbitdo (pay: WTP = xbest) (lnsig: ) (lam:), constraint(2-3) 
       ml init /lam:_cons = 30 
end

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index