Displaying 2 results from an estimated 2 matches for "tempslop".
Did you mean:
tempscop
2012 May 31
1
fitting allometric equation using a for a power model
...ooks worse. Data
and code below:
temppow<-lm(log(y)~log(x))
plot(log(y)~log(x))
plot(residuals(temppow), main="pow")
abline(temppow)
plot(y~x, main="pow")
tempsum<-summary(temppow)$adj.r.squared
tempint<-summary(temppow)$coefficients[1,1] #intercept of power function
tempslope<-summary(temppow)$coefficients[2,1] #slope of power function
tempmin<-min(x)
tempmax<-max(x)
lngth<-c(tempmin:tempmax) # vector from the minimum to the maximum values
of independent variable
prediction<-exp(tempint)*((lngth)^tempslope)*exp((summary(temppow)$sigma^2)/2)
# exp((summa...
2012 Jun 01
1
trouble with append() in a for loop
...y
cross.val.error.temp<-numeric(0)
b<-c(1:length(x))
for(i in b){
frame.val.temp<-data.frame(x,y)
frame.val<-frame.val.temp[-i,]
yt<-frame.val$y
xt<-frame.val$x
temppow.val<-lm(log(yt)~log(xt))
tempint.val<-summary(temppow.val)$coefficients[1,1] #intercept of power
function
tempslope.val<-summary(temppow.val)$coefficients[2,1]
nls.model.val<-nls(yt~exp(intercept)*((xt)^slope),
start=list(intercept=tempint.val, slope=tempslope.val))
prediction.cross.val<-((exp(intercept.nls))*((x[i])^slope.nls))
value.temp<-(prediction.cross.val-y[i])/y[i]
cross.val.error<-append...