Statistics
| Revision:

root / branches / big-buffers-test_smartlist / test / test_smartlist-biggerbuffer / binomial.tpl @ 617

History | View | Annotate | Download (786 Bytes)

1
DATA_SECTION
2
 init_int n					
3
 init_vector y(1,n)		
4

    
5
PARAMETER_SECTION
6
  init_bounded_number mu(-5.0,5.0)     	
7
  init_bounded_number sigma(.001,5,2)	
8
  random_effects_vector u(1,n,2)
9
  objective_function_value g    
10

    
11
PROCEDURE_SECTION
12
  for (int i=1;i<=n;i++)
13
    f1(i,mu, sigma,u(i));
14

    
15
SEPARABLE_FUNCTION void f1(const int& i, const prevariable & mu, const prevariable & sigma, const prevariable& ui)
16
  g -= -0.5*log(2.0*3.14) - 0.5*square(ui);
17

    
18
  dvariable  eta = mu + sigma*ui;
19
  dvariable  p = mfexp(eta)/(1.0 + mfexp(eta));
20

    
21
  g -= y(i)*eta + 2.0*log(1.0 - p + .0000001); 
22

    
23
TOP_OF_MAIN_SECTION
24
  arrmblsize = 4000000L;
25
  gradient_structure::set_GRADSTACK_BUFFER_SIZE(300000);
26
  gradient_structure::set_CMPDIF_BUFFER_SIZE(20000);
27
  gradient_structure::set_MAX_NVAR_OFFSET(100000);