search for: ybar3

Displaying 2 results from an estimated 2 matches for "ybar3".

Did you mean: bar3
2010 Nov 18
0
On efficiency, Vectorize and loops
...rt(2)+sin(pi*outer(1:10,u))) } })) ###################### # remove later Ybar<-function(u){ Ybar<-0 for (t in 1:n){ Ybar<-Ybar+Y[[t]](u) } Ybar<-1/n*Ybar } Ybar2<-function(u){ Ybar2<-0 for (t in 1:n){ Ybar2<-Ybar2+Y2[[t]](u) } Ybar2<-1/n*Ybar2 } Ybar3<-function(u){ Ybar3<-0 for (t in 1:n){ Ybar3<-Ybar3+Y3[[t]](u) } Ybar3<-1/n*Ybar3 } Ybar4<-function(u){ Ybar4<-0 for (t in 1:n){ Ybar4<-Ybar4+Y4[[t]](u) } Ybar4<-1/n*Ybar4 } # Defining the inner product on L^2([a,b]) inner.product<-function(f,g){...
2010 Jul 18
2
loop troubles
...ments from the previous posterior to be the new prior and now I cant figure out how to do the code below in a loop. The data below is dummy data, I used a starting mu of 1, and starting precision of 0. bayes.analysis.treat<-function(mu0,p0){ n1 = 5 n2 = 10 n3 = 15 ybar1 = 12 ybar2 = 13 ybar3 = 14 sd1 = 2 sd2 = 3 sd3 = 4 #posterior 1 var1 = sd1^2 #sample variance p1 = n1/var1 #sample precision p1n = p0+p1 mu1 = ((p0)/(p1n)*mu0)+((p1)/(p1n))*ybar1 sigma1 = 1/sqrt(p1n) #posterior 2 var2 = sd2^2 #sample variance p2 = n2/var2 #sample precision p2n = p1n+p2 mu2 = ((p1n)/(p2n)*m...