Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • error: 3900 unable to allocate real <tmp>

    Hello,

    I am using Stata/MP 15 on Windows 10.
    I have a question about my code.
    I had the following error while running my code:

    *: 3900 unable to allocate real <tmp>[536819,536819]
    <istmt>: - function returned error


    Perhaps I think it is due to 'matsize'.
    Please let me know if you know how to solve this problem.


    Code:
    use "c:\temp\bmi.dta", clear
    
    keep person_id last_date endpoint_hcc first_date bmi ///
             sex  age_cat  smk2 alccat_miss  ht_code hc_code dm_code cirrhosis
    //==============================================================================
    // #1: Set survival data for disease free survival analysis
    
    stset last_date , failure(endpoint_hcc ==1) id(person_id) origin(first_date) scale(365.25)
    
    //==============================================================================
    // #2: Cox models participants and generate a graph (albumin)
    
    *create spline variables for depression score
    mkspline spline = bmi, nknots(4) displayknots cubic 
    
    * select 10th percentile as the reference 
    sum bmi, d
    gen temp_p1      = r(p1)
    gen temp_p10  = r(p10)
    gen temp_p99  = r(p99)
    
    sort bmi
    gen bmi_ref50 = round(_N*0.5,0)
    local ref50 bmi_ref50
    gen temp_ref50 = bmi[`ref50']
    
    foreach var of varlist spline* {
            gen temp_`var'_ref50 = `var' - `var'[`ref50']
            }
    
    stcox spline* ib2.sex  i.age_cat  ib1.smk2 i.alccat_miss  ht_code hc_code dm_code cirrhosis
    
    matrix temp_beta=e(b)
    matrix beta=temp_beta[1,1..3]
    matrix list beta
    svmat beta, names(temp_beta)
    
    matrix temp_var=e(V)
    matrix var=temp_var[1..3,1..3]
    matrix list var
    svmat var, names(temp_var)
    
    mata: xt_mat = st_data(., "temp_spline1_ref50 temp_spline2_ref50 temp_spline3_ref50")
    mata: beta_mat = st_data(1, "temp_beta1 temp_beta2 temp_beta3")
    mata: var_mat = st_data(1::3, "temp_var1 temp_var2 temp_var3")
    
    mata: y   = xt_mat * beta_mat'
    mata: se  = sqrt(diagonal(xt_mat * var_mat * xt_mat'))
        
    mata: st_addvar("double", ("y","se"))
    mata: st_store(., "y", y)
    mata: st_store(., "se", se)
        
    gen low = y - 1.96 * se
    gen high  = y + 1.96 * se    
    
    keep bmi y low high temp_ref50
    saveold "spline.dta", version(12) replace
    https://s3.ap-northeast-2.amazonaws....180510/bmi.dta
Working...
X