macro =; 
report- ; 
lm f = 1 ;

hold 1000 / 1000 ;  
keep 0 ; 
tv -;

var:
   leminlm
   lemaxlm
   CIlm 
   RIlm 
   RClm 
   pas_land
   which
   poids [ (lmnpoints[0] + 1) ]
   ;
   

lmark cel 5 nes 1;
mult 2 = hold 2;
tv > . ; 
keep 0;
lm wts=1 0/.;
loop 0 lmnpoints[0]
 set poids [#1]  1 ; 
stop 

/*0 = CI , 1 = RI, 2 = RC;*/
set which 0 ; 


loop=iter 0 10
	progress #iter 10 Running iteration;
	tv < . ; 
	loop=cara 0 lmnpoints[0]
        set pas_land lmscore[0 0 #cara] ;
        set leminlm minsteps[0 #cara] ;
		set lemaxlm maxsteps[0 #cara] ;
		  set pas_land 'pas_land'/'poids[#cara]';
		  set lemaxlm 'lemaxlm'/'poids[#cara]';
		    
		  if ('pas_land' == 0)
            set CIlm 1 ;
          else   
            set CIlm 'leminlm'/'pas_land' ;
          end ;
	
		  if ('lemaxlm'-'leminlm' == 0)
			set RIlm 1 ;
		  else   
			set RIlm ('lemaxlm'-'pas_land')/('lemaxlm'-'leminlm') ;
		  end ;  
		  
		  if ('which' == 0)
			lm wts = 'CIlm' 0/#cara;	
		    set poids [#cara] 'CIlm';
		  end

		  if ('which' == 1)
		    lm wts = 'RClm' 0/#cara;
		    set poids [#cara] 'RIlm';
		  end
			
		  if ('which' == 2)
		    set RClm 'CIlm'*'RIlm' ;
		    lm wts = 'RClm' 0/#cara;	
		    set poids [#cara] 'RClm';
		  end	
			
	stop
	lm wts;
	mult 2 = hold 2;

	
	tv < . ;
	if ( eqtrees [ 0 1 ] ) 
		  bb ;
		  nelsen*;
		  tc /;
		  tsave * arbre_consensus_land; save; tsave/;
		  resample boot;
		  resample poisson;
		  quote les arbres sont egaux  ;
		  endloop ;      
	else
		  quote les arbres ne sont pas egaux ; 
		  tv -;
		  tv > 0;
	end
stop


progress/;
proc/; 