Displaying 20 results from an estimated 7000 matches similar to: "linear model with coefficient constraints"
2010 Mar 11
1
how does R compute Std. Error's?
i am trying to duplicate R's computation of standard errors but having some
trouble. i loaded some data into R and ran summary(lm(y~x1+x2+x3+0,
data=data)), but i am not sure how the "Std. Error" values are computed.
let y be the nx1 vector of dependent variables and X be the nx3 matrix of
independent variables. let T(.) denote the transpose of a matrix/vector,
and let I(.) denote
2009 Oct 03
3
getting variables based on name
I have a file like this:
a1,a2,a3,b1,b2,b3
1,2,3,4,5,6
0,1,2,3,4,5
...
In interactive command-line R, I type
data<-read.table('file.txt', sep=',', header=TRUE)
I then want to get all the columns which start with the letter a. For this
particular file, I can the type:
data[1:3]
What if i don't know that the columns that start with 'a' are columns 1-3?
Is there
2009 Oct 28
5
re gression with multiple dependent variables?
i have a series of regressions i need to run where everything is the same
except for the dependent variable, e.g.:
lm(y1 ~ x1+x2+x3+x4+x5, data=data)
lm(y2 ~ x1+x2+x3+x4+x5, data=data)
lm(y3 ~ x1+x2+x3+x4+x5, data=data)
is it possible to run all these regs with a single command? given that the
bulk of the work for linear regressions is inverting a matrix that depends
only on the independent
2011 Jun 01
0
Simulating SVAR Data
Hello,
I'd like to simulate data according to an SVAR model in order to
demonstrate how other techniques (such as arima) yield biased estimates. I
am interested in a 2 variable SVAR with 2 lags (in the notation of the vars
vignette, K = 2, P = 2, where B = I_K). I'm using the {vars} package
outlined here:
http://cran.r-project.org/web/packages/vars/vignettes/vars.pdf
I thought that the
2010 Jul 19
1
nls with some coefficients fixed
I'm using nls to fit a variety of different models. Here I use SSgompertz as
an example.
I want the ability to fix one (or more) of the coefficients that would
normally be optimised (e.g. fix b3=0.8).
Examples; based on and using data from example(SSgompertz)
#---------------------
# vanilla call to nls, no coefficients fixed, works fine
nls(density ~ SSgompertz(log(conc), Asym, b2, b3),
2008 Jun 13
0
restricted coefficient and factor for linear regression.
Hi,
my data set is data.frame(id, yr, y, l, e, k).
I would like to estimate Lee and Schmidts (1993, OUP) model in R.
My colleague wrote SAS code as follows:
** procedures for creating dummy variables are omitted **
** di# and dt# are dummy variables for industry and time **
data a2; merge a1 a2 a; by id yr;
proc sysnlin maxit=100 outest=beta2;
endogenous y;
exogenous l e k
2008 Jun 14
1
restricted coefficient and factor in linear regression.
Hi,
my data set is data.frame(id, yr, y, l, e, k).
I would like to estimate Lee and Schmidts (1993, OUP) model in R.
My colleague wrote SAS code as follows:
** procedures for creating dummy variables are omitted **
** di# and dt# are dummy variables for industry and time **
data a2; merge a1 a2 a; by id yr;
proc sysnlin maxit=100 outest=beta2;
endogenous y;
exogenous l e k
2009 Nov 30
1
updating subset of data.frame
i have a data frame and a numeric vector indexed as a subset of the rows in
the data.frame. what command can i use to assign the values in the vector
to the appropriate rows of the data.frame? here's my failed attempt. what
i would want is data[1,'z'] == 2, data[5,'z'] == -4, data[8,'z'] == -5,
data[9,'z'] == 5, and for the other values of 'z' to
2016 Apr 28
0
Linear Regressions with constraint coefficients
The nls2 package can be used to get starting values.
On Thu, Apr 28, 2016 at 8:42 AM, Aleksandrovic, Aljosa (Pfaeffikon)
<Aljosa.Aleksandrovic at man.com> wrote:
> Hi Gabor,
>
> Thanks a lot for your help!
>
> I tried to implement your nonlinear least squares solver on my data set. I was just wondering about the argument start. If I would like to force all my coefficients to
2016 Apr 26
0
Linear Regressions with constraint coefficients
This is a quadratic programming problem that you can solve using
either a quadratic programming solver with constraints or a general
nonlinear solver with constraints. See
https://cran.r-project.org/web/views/Optimization.html
for more info on what is available.
Here is an example using a nonlinear least squares solver and
non-negative bound constraints. The constraint that the coefficients
sum
2016 Apr 28
2
Linear Regressions with constraint coefficients
Hi Gabor,
Thanks a lot for your help!
I tried to implement your nonlinear least squares solver on my data set. I was just wondering about the argument start. If I would like to force all my coefficients to be inside an interval, let?s say, between 0 and 1, what kind of starting values are normally recommended for the start argument (e.g. Using a 4 factor model with b1, b2, b3 and b4, I tried
2006 Dec 08
1
MAXIMIZATION WITH CONSTRAINTS
Dear R users,
I?m a graduate students and in my master thesis I must
obtain the values of the parameters x_i which maximize this
Multinomial log?likelihood function
log(n!)-sum_{i=1]^4 log(n_i!)+sum_
{i=1}^4 n_i log(x_i)
under the following constraints:
a) sum_i x_i=1,
x_i>=0,
b) x_1<=x_2+x_3+x_4
c)x_2<=x_3+x_4
I have been using the
?ConstrOptim? R-function with the instructions
2010 Jun 11
3
Calculation of r squared from a linear regression
Hi,
I'm trying to verify the calculation of coefficient of determination (r squared) for linear regression. I've done the calculation manually with a simple test case and using the definition of r squared outlined in summary(lm) help. There seems to be a discrepancy between the what R produced and the manual calculation. Does anyone know why this is so? What does the multiple r squared
2010 Sep 29
1
Understanding linear contrasts in Anova using R
#I am trying to understand how R fits models for contrasts in a
#simple one-way anova. This is an example, I am not stupid enough to want
#to simultaneously apply all of these contrasts to real data. With a few
#exceptions, the tests that I would compute by hand (or by other software)
#will give the same t or F statistics. It is the contrast estimates that
R produces
#that I can't seem to
2014 Jul 28
1
Duplicate QLP coefficient restricting code
Hi all,
I was investigating the behaviour of the -p switch of flac. This
switch should enable exhaustive search for the optimal qlp
coefficient precision, but the resulting files are usually 0.5%
larger then when not using the switch. I stumbled upon this code
in stream_encoder
> if(encoder->protected_->do_qlp_coeff_prec_search) {
> min_qlp_coeff_precision =
2012 Nov 16
0
rq summary plot: specify ylim for each coefficient
Hi all,
I am running 4 series of quantile regressions with tau=10:90/100, each
series corresponding to a different year.
I would like to restrict ylim for each coefficient to be the same across
years in order to help comparing coeff across years. Therefore, I need to
specify ylim for each coef.
I have tried:
2010 Apr 29
1
lm() with non-linear coefficients constraints? --- nls?
dear R experts---quick question. I need to estimate a model that looks like
y = (b*T+d*T^3) + (1-b-3*d*T^2)*x + (3*d*T)*x^2 + (-d)*x^3
I only have three parameters. Is nls() the right tool for the job, or is
there something faster/better?
/iaw
----
Ivo Welch (ivo.welch@brown.edu, ivo.welch@gmail.com)
[[alternative HTML version deleted]]
2010 Nov 09
0
convergence message & SE calculation when using optim( )
Hi R-users,
I am trying to estimate function parameters using optim(). My count
observations follows a Poisson like distribution. The problem is that I
wanna express the lambda coefficient, in the passion likelihood
function, as a linear function of other covariates (and thus of other
coefficients). The codes that I am using (except data frame) are the
following (FYI the parameters need to be
2006 Apr 19
1
comparing execition time: R vs matlab linear algebra...
Greetings:
We are evaluating the performance of R matrix algebra es as we port a
MATLAB R14 script into R.
The MATLAB code basically evaluates the AX=B system on sparse matrices
that result in output matrices of 100 to 1,000,000 rows/columns.
Our R prototype script uses spase base matrices and the methods qr() and
qr.coeff().
The following statements are called inside a doubly-nested loop:
G
2005 Nov 29
1
Constraints in Quadprog
I'm having difficulty figuring out how to implement the
following set of constraints in Quadprog:
1). x1+x2+x3+x4=a1
2). x1+x2+x5+x6=a2
3). x1+x3+x5+x7=a3
4). x1+x2=b1
5). x1+x3=b2
6). x1+x5=b3
for the problem: MIN (x1-c1)2+(x2-c2)2+...+(x8-c8)2.
As far a I understand, "solve.QP(Dmat, dvec, Amat, bvec, meq=0,
factorized=FALSE)" reads contraints using an element-by-element