Hi, 

 

I want to run through a formula several times with several different
variables (which are defined by independent vectors of equal length 10
elements). It looks like this: 

 

 

function (m,s,y) 

{

for (j in m){

for (k in s){

for (i in y){

 

DIC.hat<-sum(-2*((log(1/sqrt(2*pi*s^2))*exp((((y-m[j])/s)^2)/-2))))

}

}

}

DIC.hat

}

 

 

My problem is that R runs the three variables at the same time providing
me with 10 new elements for DIC.hat, when I would like to have 20 times
more. 

 

Can you help? 

 

 

----------------------------------------------------

Cedric Ginestet

Department of Epidemiology and Public Health

Faculty of Medicine

Imperial College

Norfolk Place 

London 

W2 1PG 

UK

Tel:  +44 (0)77 8688 4313

Fax: +44 (0)20 7402 2150

 


	[[alternative HTML version deleted]]


