Displaying 20 results from an estimated 700 matches similar to: "definition of meq at spg"
2018 May 05
1
adding overall constraint in optim()
Hi,
You can use the projectLinear argument in BB::spg to optimize with linear equality/inequality constraints.
Here is how you implement the constraint that all parameters sum to 1.
require(BB)
spg(par=p0, fn=myFn, project="projectLinear", projectArgs=list(A=matrix(1, 1, length(p0)), b=1, meq=1))
Hope this is helpful,
Ravi
[[alternative HTML version deleted]]
2012 Oct 11
2
model selection with spg and AIC (or, convert list to fitted model object)
Dear R Help,
I have two nested negative log-likelihood functions that I am optimizing
with the spg function [BB package]. I would like to perform model
selection on these two objective functions using AIC (and possibly
anova() too). However, the spg() function returns a list and I need a
fitted model object for AIC(), ICtab() [bbmle package], or anova().
How can I perform AIC-based model
2009 Apr 22
3
Help using spg optimization in BB package
i'm trying to use the BB package to minimize the sum of the squared
deviations for 2 vectors. The only thing am having trouble with is defining
the project constraint. I got the upper and lower bounds to work but i am
not sure how to create a constraint that the sum of x must be 1. Any help
would be greatly appreciated.
--
View this message in context:
2010 Feb 04
1
Bug in as.character? (PR#14206)
A long formula which is converted using as.character, looses its last
part: ``diagonal = 1e-12)''
Shorter formula is ok though.
Best,
H??vard
************
Browse[2]> formula.str
y ~ -1 + b1 + b2 + b3 + b4 + b5 + b6 + b7 + b8 + b9 + b10 + b11 +
b12 + b13 + b14 + b15 + b16 + b17 + b18 + b19 + b20 + b21 +
b22 + b23 + b24 + b25 + b26 + b27 + b28 + b29 + b30 + b31 +
b32 +
2015 Nov 10
2
problema as.numeric
Estimados
Hay un problema, miren lo que sale en b$Edad, esos valores son correctos, pero luego realizo str$Edad, aparecen 24, 24, 24, 5 ?. , convierto a números con b$Edad <- as.numeric(b$Edad) y los valores son 24, 24, 25 ? (valores que no son reales).
Es fácil, lo realice muchas veces pero ahora estoy confundido. ¿Alguna ayuda? Gracias
> b$Edad
[1] 5 5 5 0,5 0,5 5 5 2 9
2010 Jan 07
1
faster GLS code
Dear helpers,
I wrote a code which estimates a multi-equation model with generalized
least squares (GLS). I can use GLS because I know the covariance matrix of
the residuals a priori. However, it is a bit slow and I wonder if anybody
would be able to point out a way to make it faster (it is part of a bigger
code and needs to run several times).
Any suggestion would be greatly appreciated.
Carlo
2007 Sep 21
1
Is it solve.QP or is it me?
Hi.
Here are three successive examples of simple quadratic programming problems
with the same structure. Each problem has 2*N variables, and should have a
solution of the form (1/N,0,1/N,0,...,1/N,0). In these cases, N=4,5,6. As
you will see, the N=4 and 6 cases give the expected solution, but the N=5
case breaks down.
>cm8
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] 1 0
2012 Mar 16
1
quadprog error?
I forgot to attach the problem data, 'quadprog.Rdata' file, in my prior
email.
I want to report a following error with quadprog. The solve.QP function
finds a solution to the problem below that violates the last equality
constraint. I tried to solve the same problem using ipop from kernlab
package and get the solution in which all equality constraints are
enforced. I also tried an old
2011 Sep 07
1
Imposing Feller condition using project constraint in spg
Dear R-users,
I'm running a maximization problem in which I want to impose a condition on
the relationship between 2 parameters.
The condition is that w[4] = (1+eps)/(2*w[1]), or equivalently w[4]*w[1] =
(1+eps)/2 , where eps is some small positive constant.
I've been trying to formulate a function that takes care of this, but I
can't really make it work so any suggestions would be
2002 Jan 30
1
Patch: update zlib/* to 1.1.3
This patch (apologies for the size) updates zlib/* to the files that ship with
zlib 1.1.3.
Index: zlib/ChangeLog
===================================================================
RCS file: /cvsroot/rsync/zlib/ChangeLog,v
retrieving revision 1.1
diff -u -r1.1 ChangeLog
--- zlib/ChangeLog 7 May 1998 06:19:41 -0000 1.1
+++ zlib/ChangeLog 30 Jan 2002 01:12:41 -0000
@@ -1,6 +1,54 @@
ChangeLog
2013 Mar 15
1
quadprog issues---how to define the constriants
Hi list:
This is my first time to post my question on the list. Thanks for your
help.
I am solving a quadratic programming using R. Here is my question:
w = arg min 0.5*w'Mw - w'N
s. t. sum(w) = 1;
w>0
note: w is weight vector, each w_i must >=0, and the sum of w =1.
Here is my R code:
A <-matrix(c(2.26,1.26,1.12,1.12,2.27,1.13,1.12,1.13,2.2),3,3);
B <-
2011 Nov 10
2
library(qpcR) cbind.na
I want to use function cbind.na at library(qpcR)
I install package qpcR and I can use functions such
m1 <- pcrfit(reps, 1, 2, l5)
> AICc(m1)
[1] -102.5843
but when i try cbind.na(1, 1:7) i take message
Error: could not find function "cbind.na"
Thanks
--
View this message in context: http://r.789695.n4.nabble.com/library-qpcR-cbind-na-tp4023339p4023339.html
Sent from the
2005 Nov 09
8
Element-by-element multiplication operator?
Is there an element-by-element multiplication in R, like the .* operator in Matlab?
eg: A (2x3)
B (2x3)
C=A.*B
C (2x3)
C = [[a11*b11 a12*b12 a13*b13]; [a21*b21 a22*b22 a23*b23]]
I can't find one...
Thanks
-Mike Gates
2019 Feb 14
0
Proposed speedup of spec.pgram from spectrum.R
Hello,
I propose two small changes to spec.pgram to get modest speedup when
dealing with input (x) having multiple columns. With plot = FALSE, I
commonly see ~10-20% speedup, for a two column input matrix and the speedup
increases for more columns with a maximum close to 45%. In the function as
it currently exists, only the upper right triangle of pgram is necessary
and pgram is not returned by
2003 Aug 24
1
regression constraints (again)
Im trying to do regressions with constraints that the weights
are all >=0 and sum(weights) = 1. I've read the archive and have
set the problem up with solve.QP and just the non-negativity constraints
along the lines of:
y as the data vector
X as the design matrix
D <- t(X) %*% X
d <- t(t(y) %*% X)
A <- diag(ncol(X))
b <- rep(0,ncol(X))
fit <-
2008 Nov 29
2
Reading mixed tables
Dear R buddies,
This weekend I became interested in solving Google Code Jam problems
using R. I guess R may work very well in this kind of contests but the
input of file has been a problem for me. Take this case for example
(http://code.google.com/codejam/contest/dashboard?c=agdjb2RlamFtchALEghjb250ZXN0cxjRzBQM),
the files are usually of the form:
A(number of lines for group 1)
a11 a12 a13
a21
2011 Sep 02
1
Using capture.output within a function
Dear R-users
I'm running a maximum likelihood procedure using the spg package. I'd like
to save some output produced in each iteration to a file, but if I put the
capture.output() within the function I get the following message; Error in
spg(par = startval, fn = loglik, gr = NULL, method = 3, lower = lo, :
Failure in initial function evaluation!Error in -fn(par, ...) : invalid
argument
2006 Dec 31
0
(no subject)
> > If one compares the random effect estimates, in fact, one sees that
> > they are in the correct proportion, with the expected signs. They are
> > just approximately eight orders of magnitude too small. Is this a bug?
>
> BLUPs are essentially shrinkage estimates, where shrinkage is
> determined with magnitude of variance. Lower variance more
> shrinkage towards
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
2006 Dec 31
2
zero random effect sizes with binomial lmer [sorry, ignore previous]
I am fitting models to the responses to a questionnaire that has
seven yes/no questions (Item). For each combination of Subject and
Item, the variable Response is coded as 0 or 1.
I want to include random effects for both Subject and Item. While I
understand that the datasets are fairly small, and there are a lot of
invariant subjects, I do not understand something that is happening
here, and in