[R] Random effect model

2005-09-14 Thread Hathaikan Chootrakool
Dear R-help group, I would like to model directly following random effect model: Y_ik = M_ik + E_ik where M_ik ~ N(Mew_k,tau_k^2) E_ik ~ N(0,s_ik^2) i = number of study k = number of treatment -

[R] loop

2005-08-31 Thread Hathaikan Chootrakool
I was wondering why this loop doesn't work! for (i in 1:k) fnTr[i] <- function (p) 0.5* sum ( n*log(2*pi) - log(sd(i)^2) +(logitp(i)-p)^2/sd(i)^2 ) outTr[i]<- nlm (fnTr[i],p=c(10),hessian=TRUE) minimumTr[i] <- outTr[i]$minimum valueTr[i] <- outTr[i]$estimate list (minimum

[R] Loop problem

2005-08-02 Thread Hathaikan Chootrakool
Dear everyone I am a new user,would like to combine these code together by using a loop,each function has three value as Tr = 1 - 3,how can i combine together? logitTr1 <-logit[logit[,"Study"]&logit[,"Tr"]==1,] (number of row in each group (1-3) is difference but equal in colume) fnTr1 <-

[R] matrix form

2005-07-28 Thread Hathaikan Chootrakool
I am a new user, i was wondering how to define a collection of data in matrix form, this is a part of my data,there are 26 studies, 3 Treatments Arm No Study no. Treatment Num(r) Total(n) 111 1 243 221 2 942 331