Displaying 8 results from an estimated 8 matches for "agstechnet".
2009 Jun 16
2
Trouble with optim on a specific problem
Hello!
I am getting the following errors when running optim() [I tried optim() with
3 different methods as you can see]:
Error in optim(c(0.66, 0.999, 0.064), pe, NULL, method = "L-BFGS-B") :
objective function in optim evaluates to length 6 not 1
> out <- optim( c(0.66, 0.999, 0.064), pe, NULL, method = "Nelder-Mead")
Error in optim(c(0.66, 0.999, 0.064),
2009 Jun 16
1
Constrained Optimization, a full example
After a few days of work, I think I nearly have it.
Unfortunately, theta is unchanged after I run this (as a script from a
file). I thought that theta would contain the fitted parameters.
The goal here is to find the least squares fit according to the function
defined as "rss" subject to the constraints defined as ui and ci.
I defined ui and ci to (hopefully) force par2 and par3
2009 Jun 16
3
The most straightfoward way to write a function that sums over the rows of a matrix
Hello!
I am trying to write a function with vector and data.frame parameters that
uses the sum() function and values from the rows of the data.frame.
I need to pass this function as a parameter to optim().
My starting point is:
observs <- data.frame(y, x1, x2, x3)
Fn <- function(par, observs) {
sum( (y - (par[1] * (x1 + 1) * x2^(-par[2]) * x3^par[3])^2 )
}
2009 Jun 01
1
installing sn package
...cients), optim does the job.
> # constrOptim does the job for any polyhedral domain, but uses a more
> # intricate form of bounds expression (hyperplanes in p dimensions).
> # compare ?optim and ?constrOptim...
>
> # Pseudodata for the question asked by "Stu @ AGS"
<stu@agstechnet.com>
> # in r-help (Linear Regression with Constraints)
> # Begin quote
> # y = c1 + x1 + (c2 * x2) - (c3 * x3)
> #
> # Where c1, c2, and c3 are the desired regression coefficients that
are
> # subject to the following constraints:
> #
> # 0.0 < c2 < 1.0, and
>...
2009 Jun 16
0
ui and ci explanatory documentation
Hi Livia and everyone,
Did you ever get a response on this question from last year (Jan 2008)?
I am also looking for more explanatory documentation on the
ui and ci parameters for the function constrOptim().
The examples provided in the R help and the full reference
manual are not working for me. Goodle and Nabble searches have not resulted
in any explanation
2009 Jun 17
1
Specifying ui and ci such that ui %*% theta - ci >= 0
Hi,
I am a bit stuck on specifying ui and ci.
I have read Lange's book ((1999) Numerical Analysis for Statisticians) to
his approach and unfortunately his descriptions were not helpful for me.
Here is what I have:
ui <- rbind(c(0, -1, 0), c(0, 0, -1))
ci <- c(0, -1, -1))
theta <- c(0.5, 0.5, 0.1)
My goal is to feed these into constrOptim
2009 Jun 17
0
Curve fit a nonlinear equation with box constraints: success, many thanks!
Dear R Helper Community!
Thank you for all your help and suggestions.
For your reference and any future person searching the archives, here is the
solution that did what I wanted it to do.
As background, my goal was to find the coefficients for the following
equation form:
y ~ c1 * x1 * x2 ^ -c2 *x3 ^ c3
where y, x1, x2, and x3 are observed data, and
c1, c2 and c3 are regression
2009 May 26
2
Linear Regression with Constraints
Hi!
I am a bit new to R.
I am looking for the right function to use for a multiple regression problem
of the form:
y = c1 + x1 + (c2 * x2) - (c3 * x3)
Where c1, c2, and c3 are the desired regression coefficients that are
subject to the following constraints:
0.0 < c2 < 1.0, and
0.0 < c3 < 1.0
y, x1, x2, and x3 are observed data.
I have a total of 6 rows of data in a data set.
Is