Displaying 4 results from an estimated 4 matches for "objdta".
2017 Jun 18
3
R_using non linear regression with constraints
...or
numerically estimated slopes.
##----------begin
library(minpack.lm)
library(ggplot2)
mydata <- data.frame( x = c( 0, 5, 9, 13, 17, 20 )
, y = c( 0, 11, 20, 29, 38, 45 )
)
myfun <- function( a, b, r, t ) {
a * b * ( 1 - exp( -b * r * t ) )
}
objdta <- expand.grid( a = seq( 1000, 3000, by=20 )
, b = seq( -0.01, 1, 0.01 )
, rowidx = seq.int( nrow( mydata ) )
)
objdta[ , c( "y", "t" ) ] <- mydata[ objdta$rowidx
, c( &qu...
2017 Jun 18
0
R_using non linear regression with constraints
...brary(minpack.lm)
> library(ggplot2)
>
> mydata <- data.frame( x = c( 0, 5, 9, 13, 17, 20 )
> , y = c( 0, 11, 20, 29, 38, 45 )
> )
>
> myfun <- function( a, b, r, t ) {
> a * b * ( 1 - exp( -b * r * t ) )
> }
>
> objdta <- expand.grid( a = seq( 1000, 3000, by=20 )
> , b = seq( -0.01, 1, 0.01 )
> , rowidx = seq.int( nrow( mydata ) )
> )
> objdta[ , c( "y", "t" ) ] <- mydata[ objdta$rowidx
>...
2017 Jun 18
0
R_using non linear regression with constraints
I ran the following script. I satisfied the constraint by
making a*b a single parameter, which isn't always possible.
I also ran nlxb() from nlsr package, and this gives singular
values of the Jacobian. In the unconstrained case, the svs are
pretty awful, and I wouldn't trust the results as a model, though
the minimum is probably OK. The constrained result has a much
larger sum of squares.
2017 Jun 18
3
R_using non linear regression with constraints
https://cran.r-project.org/web/views/Optimization.html
(Cran's optimization task view -- as always, you should search before posting)
In general, nonlinear optimization with nonlinear constraints is hard,
and the strategy used here (multiplying by a*b < 1000) may not work --
it introduces a discontinuity into the objective function, so
gradient based methods may in particular be