It’s like I have Lego pieces or better yet, I know what Lego pieces I need but I don’t know where to find them. I cannot find any examples to follow.
Please help me put the pieces together, or please give me an example structure that I could follow.
I need a matrix that calculates the result of
Lij = (mi/mj*Ropt * e^(1-mi/mj*Ropt))^gamma
Ropt = 100
gamma = 2
where mi and mj correspond to body masses that are of random uniform distribution, with values between 10^2 and 10^12. These are sorted from smallest to largest. Lets say for 50 species.
BM= rand(50,10^2,10^12)
BM = sort(BM)
If L[i,j] <=0.01, then L[i,j] = 0
Then, taking the results of matrix L and comparing them to a Food web matrix of random uniform distributed values between 0 and 1.
if L[i,j] >p, then Food Web matrix = 1
Then I need to know how to create a parameter matrix, and a parameter vector, as I will need to input the results into a formula.
I assume it should look something like:
parameter.matrix = function(food.web, m, I, b, c, E)
k = 8.6173324e-5
T0 = 273.15
Temp = 293.15
exp(I)*m[i]^b*m[j]^c*exp((E*(T0 - Temp))/(k*T0*Temp)) * food.web.matrix[i,j]
where the number of rows and columns corresponds to the number of species (in this case 50)
And the vector
param.vector = function(food.web, m, I, b, E){
param.vector = exp(I)*m^b*exp((E*(T0 - Temp))/(k*T0*Temp))
Then using the matrix would something look like:
matrix.a = param.matrix(food.web.matrix, BM, -13.1, 0.25, -0.8, -0.38)
and vector
vector.K = param.vector(food.web.matrix, BM, 10, 0.28, 0.71)
Any help is greatly appreciated