How to use a mathematical model for data analysis in R I am looking to use a mathematical model developed by Firbank & Watkinson (1985) J. App. Ecol. 22:503-517 for the analysis of competition between plants grown in mixture.
The model is as follows:
$$W_{A}=W_{mA}\left(1 + a_{A}\left(N_{A}+\alpha N_{B}\right)\right)^{-b_{A}}$$
where $W_{A}$ is the mean yield per plant of species $A$ grown in the experiment, $W_{mA}$ is the mean yield of isolated plants of species $A$, $a_{A}$ is the surface area required to reach size $W_{mA}$, $N_{A}$ is the planting density of species $A$, $\alpha$ is the competition coefficient, and $-b_{A}$ is the 'resource use efficiency' parameter. 
The model is a regression model as I understand it. I have data for density of species $A$ and $B$ and ($N_{A}$ and $N_{B}$) as well as the response variable $W_{A}$. I am unsure how I can use R to estimate the remaining values, most important of which is the competition coefficient, $\alpha$. If there is any more information that I need to provide please let me know.
 A: You can fit this equation to your data using non-linear regression.
I'd give it a try with nls. The crucial aspect of using nls is to provide sensible starting values. An example code could look something like 
nls.mod <- nls(Wa~Wma*(1+a*(Na + alpha*N))^(-b), data = dataset, start = list(a = 1, b = 1, alpha = 1)). – COOLSerdash 
Nonlinear regression would be my first thought too - but beware, nonlinear least squares by default assumes constant variance; it may be that a modified version of the equation (perhaps a log scale for example) might be a better description of the relationship once you take proper account of the error term. If you don't have theory as a way of choosing an error term you might look at the relationship between the spread of the data (perhaps via the residuals) and the mean (perhaps via an initial model that fits reasonably well) to assess the reasonableness of assuming constant variance considering the response is mean yield per plant, it seems highly plausible that the variation about the mean could be larger when the mean is larger.  – Glen_b
A: The mean-yield per plant is strictly positive, which means we can deal with its logarithm (as a real number).  The deterministic version of the model can be usefully rewritten as:
$$\ln W_{A} = \ln W_{mA} - b_A \ln (1 + a_{A} (N_{A}+\alpha N_{B})).$$
The obvious stochastic analogy would be the non-linear regression: 
$$\ln W_{A,i} = \ln W_{mA} - b_A \ln (1 + a_{A} (N_{A,i}+\alpha N_{B,i})) + \varepsilon_i \quad \quad\ \quad \varepsilon_i \sim \text{IID N}(0, \sigma^2).$$
This is a non-linear regression with unknown coefficient parameters $a_A$, $b_A$ and $\alpha$, and unknown error variance $\sigma^2$.  It can be programmed in R using the following syntax:
#Define the formula for the non-linear regression
FUNC    <- function(Wma, Na, Nb, a, b, alpha) { 
                    log(Wma) - b*log(1 + a*(Na + alpha*Nb)) }    
FORMULA <- as.formula(log(Wa) ~ FUNC(Wma, Na, Nb, a, b, alpha));

#Set parameters
a     <- 1.2;
b     <- 0.2;
alpha <- 0.4;
sigma <- 0.1;

#Create mock data for analysis
set.seed(10000);
N   <- 1000;
Wma <- rgamma(N, 20, 4);
Na  <- rgamma(N, 4, 2);
Nb  <- rgamma(N, 6, 1);
Wa  <- rep(0, N);
for (i in 1:N) { Wa[i] <- exp(FUNC(Wma[i], Na[i], Nb[i], a, b, alpha) 
                          + rnorm(1, 0, sigma)) }

DATA <- as.data.frame(cbind(Wa, Wma, Na, Nb));

#Fit the data to the non-linear regression model
MODEL   <- nls(FORMULA, data = DATA, start = list(a = 1, b = 1, alpha = 1));

With this particular mock data the model returns estimates that are reasonably close to the coefficient values that were used to generate the mock data:
summary(MODEL)
Formula: log(Wa) ~ FUNC(Wma, Na, Nb, a, b, alpha)

Parameters:
      Estimate Std. Error t value Pr(>|t|)    
a      1.30205    0.31614   4.119 4.13e-05 ***
b      0.17763    0.01706  10.410  < 2e-16 ***
alpha  0.53021    0.08063   6.576 7.81e-11 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.1028 on 997 degrees of freedom

Number of iterations to convergence: 5 
Achieved convergence tolerance: 2.445e-06

