My data is structured like so:
'data.frame': 50 obs. of 3 variables:
- Project : Factor w/ 2 levels "A","B": 1 1 1 1 1
- x: int 2 2 2 2 6 4 4 4 6 4 ...
- y: num 0.622 0.425 0.363 0.344 0.346 ...
I have 'attached' the data and plotted both levels in my scatter plot using:
plot(x,y,pch=as.numeric(Project))
TSF<-x[order(x)]
SD<-y[order(x)]
And fitted a non-linear regression to the data
nls_fit <- nls(SD ~ a - (b*TSF)+ ((c*TSF)^(2)), start = list(a = 0.34, b = 0.017,
+ c = 0.0003))
lines(TSF, predict(nls_fit), col = "red")
This works well...
But how can I fit this equation to only the factor "A" of the data? I'm very new at this so if you have the time an inclination it would be great if you could describe what any code you write does.
Thanks Kris