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 on April 23, and its replacement, 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 <>
To   "" <>
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 

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! 


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' 

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 

*   For searches and help try:

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