Displaying 20 results from an estimated 10000 matches similar to: "Linear Regression with Constraints"
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),
2012 Oct 19
2
Which package/function for solving weighted linear least squares with inequality and equality constraints?
Dear All,
Which package/function could i use to solve following linear least square
problem?
A over determined system of linear equations is given. The nnls-function may
would be a possibility BUT:
The solving is constrained with
a inequality that all unknowns are >= 0
and a equality that the sum of all unknowns is 1
The influence of the equations according to the solving process is
2009 Dec 04
2
Solve linear program without objective function
Dear R-users,
i try to solve to following linear programm in R
0 * x_1 + 2/3 * x_2 + 1/3 * x_3 + 1/3 * x_4 = 0.3
x_1 + x_2 + x_3 + x_4 = 1
x_1, x_2, x_3, x_4 > 0,
x_1, x_2, x_3, x_4 < 1
as you can see i have no objective function here besides that i use the
following code.
library(lpSolve)
f.obj<-c(1,1,1,1)
f.con<-matrix(c(0,2/3,1/3,1/3,
1,1,1,1,
2006 Jan 18
3
linear contrasts with anova
I have some doubts about the validity of my procedure to estimeate linear contrasts ina a factorial design.
For sake of semplicity, let's imagine a one way ANOVA with three levels. I am interested to test the significance of the difference between the first and third level (called here contrast C1) and between the first and the seconda level (called here contrast C2). I used the following
2009 Oct 06
1
linear model with coefficient constraints
I would like to perform a regression like the one below:
lm(x ~ 0 + a1 + a2 + a3 + b1 + b2 + b3 + c1 + c2 + c3, data=data)
However, the data has the property that a1+a2+a3 = A, b1+b2+b3 = B, and
c1+c2+c3 = C, where A, B, and C are positive constants. So there are two
extra degrees of freedom, and R handles this by producing NA for two of the
coefficients. Instead, I would prefer to remove the
2012 Mar 20
2
Constraint Linear regression
Hi there,
I am trying to use linear regression to solve the following equation -
y <- c(0.2525, 0.3448, 0.2358, 0.3696, 0.2708, 0.1667, 0.2941, 0.2333,
0.1500, 0.3077, 0.3462, 0.1667, 0.2500, 0.3214, 0.1364)
x2 <- c(0.368, 0.537, 0.379, 0.472, 0.401, 0.361, 0.644, 0.444, 0.440,
0.676, 0.679, 0.622, 0.450, 0.379, 0.620)
x1 <- 1-x2
# equation
lmFit <- lm(y ~ x1 + x2)
lmFit
Call:
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 )
}
2004 Nov 01
2
non-linear solve?
hi: could someone please point me to a function that allows me to
solve general non-linear functions?
> irr.in <- function(r, c1, c2, c3 ) { return(c1+c2/(1+r) +
c3/(1+r)^2); }
> solve.nonlinear( irr.in, -100, 60, 70 );
0.189
If someone has written an irr function, this would be helpful,
too---though not difficult to write, either. thanks for any pointers.
Regards,
/iaw
2012 Oct 24
1
equation solver
Hi,
I'm Pina and I'm a student in geology. I'm working with spectral profile of
sand and I have to find the similarity between one spectral profile selected
by hyperspectral image anche one that I created to mix different percentage
of 4 mineral component. I have to find the best mix of percentage of this 4
mineral in order to have the best likeness with the spectral profile chose
by
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
2011 Dec 19
2
Constrained Optimisation
Dear All
I have a constrained optimisation problem, I want to maximise the following
function
t(weights) %*% CovarianceMatrix %*% weights
for the weights,
subject to constraints on each element within the weights & the weights
vector summing to 1.
i.e.
weights = (x1, x2, x3), where x1 is within some given range (a +b, a - b).
I have tried to do this using the optim function in R,
2015 Dec 19
2
[PATCH] nvc0: add hardware ETC2 and ASTC support where possible
These are supported on GK20A and GM107.
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
Was a bit torn on where to place the enums... we're about to gut all
the xml definitions so this seemed appropriate for now.
Tested on GK20A only.
src/gallium/drivers/nouveau/nv50/nv50_formats.c | 64 +++++++++++++++++++++++++
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 10 ++++
2010 Jan 08
3
Print data frame as list including row/column name
Hi all,
I have the following problem:
I have a data frame (actually it is a prop.table) which I want to print as a
list, e.g.:
C1 C2 C3
R1 0.0 0.0 1.0
R2 1.0 0.0 0.0
R3 0.0 0.0 0.0
R4 0.0 1.0 0.0
should be printed like
C1;R1;0.0
C2;R1;0.0
C3;R1;1.0
C1;R2;1.0
C2;R2;0.0
.....
Is there any existing solution out there or could somebody please give me a
hint on how to
2016 Feb 15
1
[PATCH 09/23] nv50-: separate vertex formats from surface format descriptions
Why not fix the new names instead to be like the old names? Seems like that
would be way simpler...
On Feb 15, 2016 12:38 AM, "Ben Skeggs" <skeggsb at gmail.com> wrote:
> From: Ben Skeggs <bskeggs at redhat.com>
>
> We've previously had identical naming between vertex and texture
> formats, so it mostly made sense to define these together.
>
> However,
2016 Feb 15
24
[PATCH 01/23] nv50: import updated g80_defs.xml.h from rnndb
From: Ben Skeggs <bskeggs at redhat.com>
Signed-off-by: Ben Skeggs <bskeggs at redhat.com>
---
src/gallium/drivers/nouveau/nv50/g80_defs.xml.h | 279 ++++++++++++++++++++++++
1 file changed, 279 insertions(+)
create mode 100644 src/gallium/drivers/nouveau/nv50/g80_defs.xml.h
diff --git a/src/gallium/drivers/nouveau/nv50/g80_defs.xml.h
2010 Feb 09
2
How can I rearange my dataframe
An embedded and charset-unspecified text was scrubbed...
Name: ???????????
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100209/db12d14b/attachment.pl>
2005 Jan 07
6
coercing columns
Dear all,
I have a data frame that looks like this:
c1 c2 c3
A B C
B C A
A A B
and so on;
I?d like to produce one single vector consisting of the columns c1,c2,
c3, such that
vector=("A","B","A","B","C","A","C","A","B")
I guess it?s easy to do but I don?t know how...Can anyone
2009 Mar 04
3
Table Transformation
Dear R-experts,
recently, I started to discover the world of R. I came across a problem,
that I was unable to solve by myself (including searches in R-help, etc.)
I have a flat table similar to
key1 key2 value1
abcd_1 BP 10
abcd_1 BSMP 1A
abcd_1 PD 25
abcd_2 BP 20
abcd_3 BP 80
abcd_4 IA 30
abcd_4 PD 70
abcd_4 PS N
I wish to transform this table to obtain the following result:
key2
key1 BP
2012 Apr 19
3
How to "flatten" a multidimensional array into a dataframe?
Hi,
I have a three dimensional array, e.g.,
my.array = array(0, dim=c(2,3,4), dimnames=list( d1=c("A1","A2"),
d2=c("B1","B2","B3"), d3=c("C1","C2","C3","C4")) )
what I would like to get is then a dataframe:
d1 d2 d3 value
A1 B1 C1 0
A2 B1 C1 0
.
.
.
A2 B3 C4 0
I'm sure there is one function to do
2010 Dec 01
3
RFC: sapply() limitation from vector to matrix, but not further
sapply() stems from S / S+ times and hence has a long tradition.
In spite of that I think that it should be enhanced...
As the subject mentions, sapply() produces a matrix in cases
where the list components of the lapply(.) results are of the
same length (and ...).
However, it unfortunately "stops there".
E.g., if you *nest* two sapply() calls where the inner one
produces a matrix, very