#### Wooferd

##### New Member
Hello!

I have a quenstion about comparing models. Not models fitted by R itself, but user defined models. Ill explain through this example:

Dataset:
Tree Diameter Biomass Model1biomass Model2biomass
1 10 50 45 60
2 7 35 52 48

The 'Biomass' column was received by actually cutting the trees and weighing them. The two other colums 'Model1biomass' and 'Model2biomass' were obtained using the following formulas:

Model1biomass = 34.4703-8.0671*Diameter+0.6589*Diameter*Diameter
Model2biomass = 38.49089-11.7883*Diameter+1.1926*Diameter*Diameter

So these equations use the column 'Diameter' to determine the total biomass.
My problem is comparing these results/models with the correct biomass (the values in column 'Biomass') in terms of RSE, AIC...

How can i do that scince these are not fitted models, and or not linear?

Thank you
Wooferd

#### hlsmith

##### Not a robit
I hope I am following your question. If you have a whole bunch of data you could just run ttests and correct your alpha (level of significance to address you are conducting two comparisons). So you could see which technique is closes to the true biomass. You may also play around with plotting all these data to make sure your formulae do not deviate more at different levels. For example, the formulae could be very close at average biomass values but not function as well when in comes to extreme values.

Let me know if I misinterpreted your goals.

This could be done with t.test() and plot()

#### Wooferd

##### New Member

I misunderstood the task that I was given.
I can't use the models with the parameter values already filled in. The parameters need to be determined using the biomassdata that is available, I can't just use the formula.

So I have to use:

Model1biomass = a*Diameter+b*Diameter*Diameter

and determine the the values of a and b through the actually weighed biomass. When I have done this for al the models I think I can than compare them.

Sorry for the misunderstanding, this is a new experience for me Greetings

#### hlsmith

##### Not a robit
Good luck, and let us know if you have questions. A side note, I was not clear before - these values would be dependent. So, you would subtract them and test that their differences are not zero. Given data distribution, you would use either one-sample ttest or Wilcoxon signed rank test (nonparametric equivalent).

R code at following: http://ww2.coastal.edu/kingw/statistics/R-tutorials/singlesample.html

#### Wooferd

##### New Member
Hey

I have another problem, but first a quick recap of what I am doing.

So I read an excelfile in R which contains different colums, example:
Diameter TotalBiomass
10 40
13 50
17 55
7 25

The biomass values are is the actually weighed biomass on site.
Now i have a model of the type: Diameter + Diameter^2 = biomass. This is than compared with the real biomass, to look if the model can estimate this accuratly.

I have already implemented it as a linear model:
model1 <- lm(TotalBiomass ~ I(Diameter + Diameter^2), data=Biomass)
(with data=Biomass => Biomass is the excelfile with the data)
This works perfectly, but it is a linear modelling technique. Now I want to use non linear modelling, so 'nls' (nonlinear least squares) is guess?

When I type the following:
model1 <- nls(TotalBiomass ~ I(Diameter + Diameter^2), data=Biomass)
this error is given: Error: unexpected numeric constant in "model 1" -> So I guess the column 'Diameter' can't be read with nls or am I seeing this wrong?
How can I fix this with using a non linear regression technique?

Greetings
Wooferd