Displaying 20 results from an estimated 200 matches similar to: "Loops, Paste, Apply? What is the best way to set up a list of many equations?"
2011 Jun 21
1
Setting up list of many equations for systemfit
Dear List Members,I am trying to set up a large system of equations and I am trying to find a simple way to set up the list command under the package system fit. Here is the example from system fit and what I am trying to do:
EQ1 <- Y1 ~ X1 + X2 + X4EQ2 <- Y2 ~ X2 + X3EQ3 <- Y3 ~ X2 + X3 + X4EQ4 <- Y4 ~ X1 + X3 + X4eqSystem <-list(form1 = EQ1, form2 = EQ2, form3 = EQ3, form4 = EQ4)
2011 Jun 28
2
How do I output all the R-squares of an SUR? summary(fitSUR$eq[[1:4]])$r.squared does not work
Greetings R Users,
I have a system of equations for which I would like to output all the
R-squares. Assume there are four equations in my system, the only way I
found to output all the R-squares is by calling them out one by one as this:
summary(fitSUR$eq[[1]])$r.squared
summary(fitSUR$eq[[2]])$r.squared
summary(fitSUR$eq[[3]])$r.squared
summary(fitSUR$eq[[4]])$r.squared
But isn't there a
2012 Apr 01
1
indexing in a function doesn't work?
Hello,
I've written a small function that's supposed to save me some time, and
it's ending up killing it- the intention is to iteratively subset a dataset
fram on framevec, fit a model (either lm or nls depending on type) and
return the r2 or AIC from the model, respectively. Although as far as I can
tell in my code the plots are dependent on the fit of the model to the data
and the
2007 Mar 19
1
Forms lost focus in KDE
Hello,
I'm testing a simple delphi application that have 3 forms.
>From FORM1 (the main form) I press a button to show FORM2, then from
FORM2 I press a button to show FORM3, when I close FORM3, FORM1 becomes
focused instead of FORM2.
Every time you close a form or a dialog the application main form
becomes the active one.
This only happend in KDE, allowing windows manager to control the
2008 Apr 23
1
pdf() and histogram() in function call
Here is a function I wrote. It runs no problem, but generate empty pdf
files.
I can't find what is the problem.
create.pdf<- function(x, dir)
{
dir.create(dir, showWarnings = FALSE)
plist<- c("a", "b" , "c", "d")
for(j in plist)
{
filedir<- paste(dir, "/", j, ".pdf",
2004 Nov 29
3
systemfit - SUR
Hello to everyone,
I have 2 problems and would be very pleased if anyone can help me:
1) When I use the package "systemfit" for SUR regressions, I get two
different variance-covariance matrices when I firstly do the SUR
regression ("The covariance matrix of the residuals used for
estimation") and secondly do the OLS regressions. In the manual for
"systemfit" on page
2007 Mar 28
0
nlsystemfit: Errors with reproducing the manual example
Hi everybody, I'm a newbye with lots of problems :). I'm trying to use
nlsystemfit, but I recieve two error messages whose origin that I don't
understand.
1) When I try to reproduce the example reported in the systemfit package
manual, that is
library( systemfit )
data( ppine )
hg.formula <- hg ~ exp( h0 + h1*log(tht) + h2*tht^2 + h3*elev + h4*cr)
dg.formula <- dg ~ exp( d0
2012 Oct 17
1
extracting and restricting coefficients
HiĀ
I want to fit two equations simultaneously
EQ1<-Y1~X1+X2
EQ2<-Y2~X1+X2
eqsystem<-list(Y1HAT=EQ1,Y2HAT=EQ2)
fitols<-systemfit(eqsystem,
method="OLS", data=BB)
How do I get coefficients for the first equation? R code
How do I restrict coefficient of X2 in the first equation (say , restrict it to less thanĀ zero). R code
Your help is
appreciated.
Dereje
[[alternative
2009 Apr 13
2
joint estimation of two poisson equations
Dear list members,
Is there a package somewhere for jointly estimating two poisson processes?
I think the closest I've come is using the "SUR" option in the Zelig
package (see below), but when I try the "poisson" option instead of
the "SUR" optioin I get an error (error given below, and indeed,
reading the documentation of the Zelig package, I get the impression
2017 Jun 11
1
Memory leak in nleqslv()
Hello all,
I am relatively new to R, but enjoying it very much. I am hoping that
someone on this list can help me with an issue I am having.
I am having issues with iterations over nleqslv, in that the solver
does not appear to clean up memory used in previous iterations. I
believe I've isolated the/my issue in a small sample of code:
library(nleqslv)
cons_ext_test <- function(x){
2008 Oct 06
0
Computationally singular [provides coefficients but not covariance matrix]
Hi,
I am estimating a regression but the summary command is unable to provide me
results, while the coefficients are available from the coefficients value. I
suppose that it cannot estimate the covariance matrix. Is there any command
that I can relax the tolerance so it can estimate the covariance matrix.
The code and the error of R is:
eq1<-rq(y~factor(year)+factor(state)+x1+x2+x3,
2011 Oct 02
0
deSolve - Function daspk on DAE system - Error
I'm getting this error on the attached code and breaking my head but can't
figure it out. Any help is much appreciated. Thanks, Vince
CODE:
library(deSolve)
Res_DAE=function(t, y, dy, pars) {
with(as.list(c(y, dy, pars)), {
res1 = -dS -dES-k2*ES
res2 = -dP + k2*ES
eq1 = Eo-E -ES
eq2 = So-S -ES -P
return(list(c(res1, res2, eq1, eq2)))
})
}
pars <- c(Eo=0.02,
2011 Oct 03
0
deSolve - Function daspk on DAE system - Error (Vince)
Vince,
When that happens, one possible reason is that your DAE is of index > 1,
which cannot be solved by daspk.
The solver radau, also from deSolve can handle DAEs up to index 3, but
you need to rewrite the problem in the form M*y' = f(x,y), where M is a
mass matrix.
If you do that for your problem, and solve it with radau, then radau
complains that the "matrix is repeatedly
2017 Jun 08
5
Matrix multiplication
I need to have all elements of a matrix multiplied by a weight before
being post-multiplied by itself, as shown in the forst block of codes
below. I can also multiply the matrix by the square root of the weight
and then take the outer product.
Actually, what I need is this. Denote each row of the matrix by a row
vector as xi and each element of the weighting vector as wi. Then, I
need the
2017 Jun 08
0
Matrix multiplication
Is this a question? You seem to have three possible calculations, have already implemented two of them (?) and it is unclear (to me) what you think the right answer for any of them is supposed to be.
--
Sent from my phone. Please excuse my brevity.
On June 7, 2017 8:50:55 PM PDT, Steven Yen <syen04 at gmail.com> wrote:
>I need to have all elements of a matrix multiplied by a weight
2006 Jan 12
1
Problem with NLSYSTEMFIT()
Hello,
I want to solve a nonlinear 3SLS problem with "nlsystemfit()". The
equations
are of the form
y_it = f_i(x,t,theta)
The functions f_i(.) have to be formulated as R-functions. When invoking
"nlsystemfit()" I get the error
Error in deriv.formula(eqns[[i]], names(parmnames)) :
Function 'f1' is not in the derivatives table
2002 Jul 31
0
Nonlinear Seemingly Unrelated Regression
Hello to everyone,
I found some problems using R in the estimation of systems of nonlinear
equations
like SURE (Seemingly Unrelated Regression Equations) with mutual
parameters as the following system example:
EQ1 PQ1=P1*G1+B1*(Y-P1*G1-P2*G2-P3*G3)
EQ2 PQ2=P2*G2+B2*(Y-P1*G1-P2*G2-P3*G3)
where G1,G2,G3,B1,B2 are the coefficients to estimate.
command "nls" accept only single
2002 Aug 13
0
Non linear SUR estimation
TO: r-help at lists.R-project.org
r-help at stat.math.ethz.ch
Hello to everyone,
I found some problems using R in the estimation of systems of nonlinear
equations
like SURE (Seemingly Unrelated Regression Equations) with mutual
parameters as the following system example:
EQ1 PQ1=P1*G1+B1*(Y-P1*G1-P2*G2-P3*G3)
EQ2 PQ2=P2*G2+B2*(Y-P1*G1-P2*G2-P3*G3)
where G1,G2,G3,B1,B2 are the
2009 Dec 13
0
How to control the skewness of a heteroscedastic variable?
Dear listusers,
I don't know whether my problem is statistical or computational, but
I hope I could recieve some help in either case.
I'm currently working on a MC-simulation in which I would like to
control the skewness of a heteroscedastic dependent variable defined
as:
y=d*z+sqrt(.5+.5*x^2)*e (eq.1)
where d is a parameter and, z, x, and e are gamma r.vs. The variables
x
2010 Aug 25
1
SEM : Warning : Could not compute QR decomposition of Hessian
Hi useRs,
I'm trying for the first time to use a sem. The model finally runs,
but gives a warning saying :
"In sem.default(ram = ram, S = S, N = N, param.names = pars, var.names
= vars, : Could not compute QR decomposition of Hessian.
Optimization probably did not converge. "
I found in R-help some posts on this warning, but my attemps to modify
the code didn't change