I have two variables about growth in insects: y- measurements of head width(0.5,0.8,0.10.0.12,0.16) x- age at which they were measured (1,2,3,4,5)
I need to see if this growth fits with exponential growth. I need the values of the generated equation, p and r^2, in addition to F (although F don't think that's possible, eh?).
I didn't find how to do this in R.
Your question lacks some explanations, but in a basic way you can do this in R:
x<- c(1,2,3,4,5) y<- c(0.5,0.8,0.10,0.12,0.16) cbind(x,y) n<-length(x) cbind(x,log(y),x*log(y),x^2) cbind(sum(x),sum(log(y)),sum(x*log(y)),sum(x^2)) num = sum(x*log(y)) - sum(x)*sum(log(y))/n denom = sum(x^2) - sum(x)^2/n a=num/denom b=sum(log(y))/n - a*sum(x)/n A = exp(a) B = exp(b) plot(x,y,col="blue",pch=19) curvaexp<-curve(B*exp(a*x), NULL,NULL, 5, add=T, col=2) curvaexp r2.lm = lm(y ~ curvaexp$y) r2<- summary(r2.lm)$r.squared #<--- Coeficiente de Determinaçao var.test(y, curvaexp$y)# variancia F