Displaying 3 results from an estimated 3 matches for "nlstest".
Did you mean:
nfstest
2012 May 17
3
nls and if statements
...ly
given the error message I get that indicates I can't do this using an 'if'
statement.
Essentially, I have data where I think a relationship enters when a variable
(here Pwd) is below some value (z). I don't know that value, so I want to
fit it. The data is Pw, Tsoil, and Cfl.
nlstest=nls(if(Pw>z){Cfl~K*exp(-b*Pw)+c
}else{
Cfl~K*(exp(-a*Tsoil))*exp(-b*Pw)+c
},start=c(K=5.5, a=0.1, b=0.1, c=2, z=5))
Which returns the error:
Error in inherits(object, "formula") : object 'z' not found
Is there a better way to try and allow a conditional variable to, well,...
2003 Sep 30
1
can't get names from vector in nlm calls
...{
lhs[[i]] <- eval( formula( eqns[[i]] )[2] )
rhs[[i]] <- eval( formula( eqns[[i]] )[3] )
residi[[i]] <- lhs[[i]] - rhs[[i]]
r <- rbind( r, as.matrix( residi[[i]] ) )
}
## blah, blah, blah....
knls <- obj
}
print( "calling nlstest" )
demand2 <- q ~ d0 + d1 * p + d2 * d
supply2 <- q ~ s0 + s1 * p + s2 * f + s3 * a
system2 <- list( demand2, supply2 )
sv2 <- c(d0=3,d2=4,d1=4.234,s0=-2.123,s2=2.123,s3=4.234,s1=0.234)
### call the nlm function to get the estimates...
estnew <- nlm( knls, sv2, hessian=TRUE, pr...
2003 Oct 06
1
getting names of p vector in nlm function...
...{
lhs[[i]] <- eval( formula( eqns[[i]] )[2] )
rhs[[i]] <- eval( formula( eqns[[i]] )[3] )
residi[[i]] <- lhs[[i]] - rhs[[i]]
r <- rbind( r, as.matrix( residi[[i]] ) )
}
## blah, blah, blah....
knls <- obj
}
print( "calling nlstest" )
demand2 <- q ~ d0 + d1 * p + d2 * d
supply2 <- q ~ s0 + s1 * p + s2 * f + s3 * a
system2 <- list( demand2, supply2 )
sv2 <- c(d0=3,d2=4,d1=4.234,s0=-2.123,s2=2.123,s3=4.234,s1=0.234)
### call the nlm function to get the estimates...
estnew <- nlm( knls, sv2, hessian=TRUE, pr...