search for: inprod

Displaying 7 results from an estimated 7 matches for "inprod".

Did you mean: in_prod
2010 Oct 15
1
Problem using BRugs
...rho_w=rho_w_0)} parameters<-c("beta", "rho_o", "rho_d", "rho_w") probit.sim<-BRugsFit(data,inits,parameters,modelFile="spatial.openbugs.txt",numChains=1,nIter=2000) # my model model { for (i in 1:676) { y[i] ~ dbern(p[i]) wwy[i]<- inprod(ww[i, 1:676] , y[]) woy[i]<- inprod(wo[i, 1:676] , y[]) wdy[i]<- inprod(wd[i, 1:676] , y[]) probit(p[i])<- rho_o * woy[i] + rho_d * wdy[i] + rho_w * wwy[i] + beta[1] + beta[2] * cap2[i] + beta[3] * pol2[i] + beta[4] * cap1[i] + beta[5] * pol1[i] + beta[6] * g[i]+ e[i]...
2008 Dec 15
3
R2winbugs : vectorization
...*x[i,3]+a4*x[i,4] } a1~dunif(0,100) a2~dunif(0,100) a3~dunif(0,100) a4~dunif(0,100) tau.y<-pow(sigma.y,-2) sigma.y~dunif(0,100) } ============== model 2 : vector of a's model{ for (i in 1:n){ z.lo[i]<- C * equals(y[i],C) z[i]~dnorm(z.hat[i],tau.y)I(z.lo[i],) z.hat[i]<-inprod(a[],x[i,]) } for (j in 1:k){ a[j]~dunif(0,100) } tau.y<-pow(sigma.y,-2) sigma.y~dunif(0,100) } and here, for reference, is the R calling code: x<-as.matrix(iv) y<-dv C<-cens z<-ifelse(y==C,NA,y) n<-length(z) data1<-list(x=x,y=y,z=z,n=n,C=C) inits1<-function(){...
2008 Sep 16
1
Car.proper C[] matrix
...area i=1 has 3 neighbours, area i=2 has 2 # neighbours, area i=3 has 1 neighbour and area i=4 has 2 neighbours. The the matrix pick[,] is: # pick # 1, 0, 0, 0, # 1, 0, 0, 0, # 1, 0, 0, 0, # 0, 1, 0, 0, # 0, 1, 0, 0, # 0, 0, 1, 0, # 0, 0, 0, 1, # 0, 0, 0, 1, # # We can then use the inner product (inprod(,)) function in WinBUGS and the kth row of pick to # select which area corresponds to the kth element in the vector C[]; likewise, we can use inprod(,) # and the ith column of pick to select the elements of C[] which correspond to area i. Basically I want to do this in R to speed things up a li...
2009 Jul 20
2
HELP: BRUGS/WinBUGS/RBUGS Response is a combination of random variables
...> modelCompile(numChains=1) multiple definitions of node bm[1] =================================== model { for(iter in 1:numSubj){ bmd[iter] ~ dnorm(u[trt[iter]+1],sdbmd.precision); ############### bm[iter] <- inprod(biomarker[iter,1:4], bta[1:4]) bm[iter] ~ dnorm(bmu[iter], sdbm.precision); ############### bmu[iter] <- (1-delta[trt[iter]+1])*u[trt[iter]+1]+ delta[trt[iter]+1]*(u[1]+u[2])/2; } for(iter in 1:4){...
2006 Oct 09
1
winbugs - R question
...iter = 1000, bugs.directory = "c:/Program Files/WinBUGS14/", working.directory = "c:/try", clearWD = FALSE,codaPkg = FALSE,debug=T) model { for (i in 1:n) { Y[i,1:2] ~ dmnorm(mu[i,],P[1:2,1:2]) # means in separate time series mu[i,1] <- inprod(X1[i,],b[,1]) mu[i,2] <- inprod(X2[i,],b[,2]) P[1:2,1:2]<-tau*I[1:2,1:2] } # priors on regression coefficients for (i in 1:2) { for (j in 1:2) { b[i,j]<-dnorm(0,0.001) } } tau~dgamma(0.001,0.001) }...
2012 Dec 04
1
Winbugs from R
...[i] + beta2 * distance[i]}# prior distributionstau ~ dgamma( 0.01, 0.01 )beta0 ~ dnorm( 0.0, 1.0E-4)beta1 ~ dnorm( 0.0, 1.0E-4)beta2 ~ dnorm( 0.0, 1.0E-4)# definition of sigmas2<-1/taus <-sqrt(s2)# calculation of the sample variancefor (i in 1:n){ c.time[i]<-time[i]-mean(time[]) }sy2 <- inprod( c.time[], c.time[] )/(n-1)# calculation of Bayesian version R squaredR2B <- 1 - s2/sy2# Expected y for a typical delivery timetypical.y <- beta0 + beta1 * mean(cases[]) + beta2 * mean(distance[])}INITSlist( tau=1, beta0=1, beta1=0, beta2=0 )DATA (LIST)list( n=25,time = c(16.68, 11.5, 12.03,...
2013 Jan 18
0
problem that arises after using the new version of "BRugs"
.../AppData/Local/Temp/RtmpwzJ97S/trash" "file7f819516f3f.bug" "C:/Users/MOU/AppData/Local/Temp/RtmpwzJ97S/cmds.txt" "2"' had status 255 -------------- next part -------------- model { for(i in 1:n) { log(mu[i]) <- beta0 + beta1*x[i] + inprod(u[],Z[i,]) + offs[i] delta[i] ~ dpois(mu[i]) } for (k in 1:numKnots) { u[k] ~ dnorm(0,tauU) } beta0 ~ dnorm(0,1.0E-8) beta1 ~ dnorm(0,1.0E-8) tauU ~ dgamma(0.01,0.01) sigU <- 1/sqrt(tauU) }