Displaying 20 results from an estimated 5000 matches similar to: "Nonlinear Optimization"
2004 Mar 31
2
functions & paths
Hi,
I have a couple of quick questions regarding R.
1) I have a ".First" function that automatically loads the quadprog package into the workspace. The .First function resides in R and is only saved if I save the workspace. The exact function is as follows:
.First<-function()
{
library(quadprog)
}
Is there any way that this function can be saved outside of R? That is, is there
2004 Mar 19
3
Reading Data
Hi,
Quick question on reading data.
I am running simulations but want to allow the user the option to define the number of simulations. How can I have R read-in user data entered from the keyboard? Is there a difference for reading in numeric and character data?
For example, I am trying to write the following in R:
Enter Number of Iterations?
<<<the user then enters a number say Y
2004 Mar 04
4
Command Line Programs
Hi,
I have recently started using R again (switched from MatLab) and have a question regarding programming. How can I set up a file that will run several lines of R code? For example, in Fortran and DOS this used to be done via a batch file, and in MatLab I would write the code and save it in a script file, e.g., Test.m.
An example of what I am trying to do is the following:
2010 Dec 04
1
Quadratic programming with semi-definite matrix
Hello.
I'm trying to solve a quadratic programming problem of the form min
||Hx - y||^2 s.t. x >= 0 and x <= t using solve.QP in the quadprog
package but I'm having problems with Dmat not being positive definite,
which is kinda okay since I expect it to be numerically semi-definite
in most cases. As far as I'm aware the problem arises because the
Goldfarb and Idnani method first
2009 Nov 04
3
Constrained Optimization
Hi All,
I'm trying to do the following constrained optimization example.
Maximize x1*(1-x1) + x2*(1-x2) + x3*(1-x3)
s.t. x1 + x2 + x3 = 1
x1 >= 0 and x1 <= 1
x2 >= 0 and x2 <= 1
x3 >= 0 and x3 <= 1
which are the constraints.
I'm expecting the answer x1=x2=x3 = 1/3.
I tried the "constrOptim" function in R and I'm running into some issues.
I first start off
2008 Mar 03
2
Constrained regression
Dear list members,
I am trying to get information on how to fit a linear regression with
constrained parameters. Specifically, I have 8 predictors , their
coeffiecients should all be non-negative and add up to 1. I understand it is
a quadratic programming problem but I have no experience in the subject. I
searched the archives but the results were inconclusive.
Could someone provide suggestions
2007 May 10
2
Nonlinear constrains with optim
Dear All
I am dealing at the moment with optimization problems with nonlinear
constraints. Regenoud is quite apt to solve that kind of problems, but
the precision of the optimal values for the parameters is sometimes
far from what I need. Optim seems to be more precise, but it can only
accept box-constrained optimization problems. I read in the list
archives that optim can also be used with
2009 Jul 12
2
Nonlinear Least Squares nls() programming help
Hi, I am trying to use the nls() function to closely approximate a vector of
values, colC and I'm running into trouble. I am not sure how if I am asking
the program to do what I think its doing, because the same minimization in
Excel's Solver does not run into problems. If anyone can tell me what is
going wrong, and why I'm getting a singular convergence(7) error, please
tell me. I
2004 Sep 17
2
help with numerical solution for two simultaneous nonlinear equations in 2 variables
Hi,
I am relatively new to R and am trying to solve two simultaneous
nonlinear equations in two variables numerically, and was wondering if
anyone knew if any of the packages could do that. An alternative is
writing my own code using Newton-Raphson; I did that but was not able to
get good convergence. Any ideas please?
Thanks
Yogesh
[[alternative HTML version deleted]]
2005 Jan 13
1
how to use solve.QP
At the risk of ridicule for my deficient linear algebra skills, I ask
for help using the solve.QP function to do portfolio optimization. I
am trying to following a textbook example and need help converting the
problem into the format required by solve.QP. Below is my sample code
if anyone is willing to go through it. This problem will not solve
because it is not set up properly. I hope I
2007 Sep 03
2
The quadprog package
Hi everybody,
I'm using Windows XP Prof, R 2.5.1 and a Pentium 4 Processor.
Now, I want to solve a quadratic optimization program (Portfolio Selection) with the quadprog package
I want to minimize (\omega'%*%\Sigma%*%\omega)
Subject to
(1) \iota' %*% \omega = 1 (full investment)
(2) R'%*%\omega = \mu (predefined expectation value)
(3) \omega \ge 0 (no short sales).
Where
2003 Oct 31
1
constrained nonlinear optimisation in R?
Hello. I have searched the archives but have not found anything. I
need to solve a constrained optimisation problem for a nonlinear
function (“maximum entropy formalism”). Specifically,
Optimise: -1*SUM(p_ilog(p_i)) for a vector p_i of probabilities,
conditional on a series of constraints of the form:
SUM(T_i*p_i)=k_i for given values of T_i and k_i (these are
constraints on
2003 Jun 26
0
nonlinear constraint optimization function in R?
Dear all,
I am looking for a R-function that performs nonlinear constraint
optimization (where the objective function and the
constraints are allowed to be nonlinear).
More specifically, I am trying to figure out whether there
is an equivalent function of NAG fortran library' "E04UCF" or matlab's
"fmincon" in R.
Any help is greatly appreciated.
Thank you,
Sunduz
2009 Feb 16
2
solve.QP with box and equality constraints
Dear list,
I am trying to follow an example that estimates a 2x2 markov transition
matrix across several periods from aggregate data using restricted least
squares.
I seem to be making headway using solve.QP(quadprog) as the unrestricted
solution matches the example I am following, and I can specify simple
equality and inequality constraints. However, I cannot correctly specify a
constraint
2008 May 15
5
Inconsistent linear model calculations
Readers,
Using version 251 I tried the following command:
lm(y~a+b,data=datafile)
Resulting in, inter alia:
...
coefficients
(intercept) a
1.2 3.4
Packages installed:
acepack ace() and avas() for selecting regression
transformations
adlift An adaptive lifting scheme algorithm
akima Interpolation of irregularly spaced
2010 Jan 09
2
Functions for QUAIDS and nonlinear SUR?
Hi,
I would like to estimate a quadratic almost ideal demand system in R which is estimated usually by nonlinear seemingly unrelated regression. But there is no such function in R yet but it is readily available in STATA (nlsur), see B. Poi (2008): Demand-system estimation: Update, Stata Journal 8(4).
Now I am thinking, what is quicker learning to "program" STATA which seems not really
2005 Oct 13
3
Optim with two constraints
Hi R-list,
I am new to optimization in R and would appreciate help on the following
question. I would like to minimize the following function using two
constraints:
######
fn <- function(par,H,F){
fval <- 0.5 * t(par) %*% H %*% par + F%*% par
fval
}
# matrix H is (n by k)
# matrix F is (n by 1)
# par is a (n by 1) set of weights
# I need two constraints:
# 1.
2008 Feb 15
2
Quadratic Programming
Hi,
I am using solve.QP (from quadprog) to solve a standard quadratic
programming problem: min_w -0.5*w'Qw st ... I would like solve.QP to do two
things: 1) to start the optimization from a user-supplied initial
condition; i.e., from a vector w_0 that satisfies the constraints, and 2) to
return the values of the lagrange multiplieres associated with the
constraints. I did not find an obvious
2008 Apr 10
2
QP.solve, QPmat, constraint matrix, and positive definite
hello all,
i'm trying to use QPmat, from the popbio package. it appears to be based
on solve.QP and is intended for making a population projection matrix.
QPmat asks for: nout, A time series of population vectors and C, C
constraint matrix, (with two more vectors, b and nonzero). i believe the
relevant code from QPmat is:
function (nout, C, b, nonzero)
{
if (!"quadprog" %in%
2006 Nov 26
2
Quadratic Optimization
Hi,
I need to solve an optimization problem in R having linear objective function and quadratic constraints(number of variables is around 80). What are the possible choices to do this in R.
optim() function only allows box constrained problems. Is it possible in nlm()? Or please tell me if there is any other routine.
Thanks
Amit