Error In G * That Non-conformable Arrays
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Non-conformable arrays error in code up vote 6 down vote favorite 1 I'm stuck at the following code: y = c(2.5, 6.0, 6.0, 7.5, 8.0, 8.0, 16.0, 6.0, 5.0, 6.0, 28.0, 5.0, 9.5, 6.0, 4.5, 10.0, 14.0, 3.0, 4.5, 5.5, 3.0, 3.5, 6.0, 2.0, 3.0, 4.0, 6.0, 5.0, 6.5, 5.0, 10.0, 6.0, 18.0, 4.5, 20.0) x2 = c(650, 2500, 900, 800, 3070, 2866, 7500, 800, 800, 650, 2100, 2000, 2200, 500, 1500, 3000, 2200, 350, 1000, 600, 300, 1500, 2200, 900, 600, 2000, 800, 950, 1750, 500, 4400, 600, 5200, 850, 5000) x1 = c(16.083, 48.350, 33.650, 45.600, 62.267, 73.2170, 204.617, 36.367, 29.750, 39.7500, 192.667, 43.050, 65.000, 44.133, 26.933, 72.250, 98.417, 78.650, 17.417, 32.567, 15.950, 27.900, 47.633, 17.933, 18.683, 26.217, 34.433, 28.567, 50.500, 20.950, 85.583, 32.3830, 170.250, 28.1000, 159.8330) library(MASS) n = length(y) X = matrix(nrow = n, ncol = 2) for (i in 1:n) { X[i,1] = x1[i] } for (i in 1:n) { X[i,2] = x2[i] } gibbs = function(data, m01 = 0, m02 = 0, k01 = 0.1, k02 = 0.1, a0 = 0.1, L0 = 0.1, nburn = 0, ndraw = 5000) { m0 = c(m01,m02) C0 = matrix(nrow=2,ncol=2) C0[1,1] = 1/k01 C0[1,2] = 0 C0[2,1] = 0 C0[2,2] = 1/k02 beta = mvrnorm(1,m0,C0) omega = rgamma(1,a0,1)/L0 draws = matrix(ncol=3,nrow=ndraw) it = -nburn while (it < ndraw) { it = it + 1 C1 = solve(solve(C
post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ relative compositional dissimilarity among sites against a continuous variable Thanks Andy, that's a simple enough calculation. So the larger the average dissimilarity, the more the site is dissimilar in its composition to other sites. I could then do a regression between the average dissimilarity of sites and other site factors and say something like 'compositional dissimilarity increases as factor X increases'. Is there a method that regresses the relative compositional dissimilarity among sites against a continuous variable? -Burak From: Andy Rominger [mailto:[hidden email]] Sent: Tuesday, November 23, 2010 4:11 PM To: [hidden email] Cc: Pekin, Burak K; [hidden email]; [hidden email] Subject: Re: [R-sig-eco] Dissimilarity ranking or perhaps could you use something as simple as the mean dissimilarity? http://stackoverflow.com/questions/14791399/non-conformable-arrays-error-in-code i'm thinking something like this: library(vegan) ## some data to play with, 20 sites by 30 spp data(dune) ## calculate distance, making it a matrix dune.dist <- as.matrix(vegdist(dune,method= "bray")) ## take average distance dune.avg <- apply(dune.dist,1,mean) dune.avg not sure what the gurus of dissimilarity analysis might think of this. good luck, andy On Tue, Nov 23, 2010 at 5:43 PM, <[hidden email]
von GoogleAnmeldenAusgeblendete FelderNach Gruppen oder Nachrichten suchen