Displaying 14 results from an estimated 14 matches for "dynformula".
Did you mean:
df2formula
2009 Nov 27
1
problem with "dynformula" from "plm" package [RE-POST]
Hello list,
I'm following the paper (http://www.jstatsoft.org/v27/i02/paper) on
how to use "plm" to run panel regressions, and am having trouble with
what I believe should be something very basic.
When I run the command (p.9 in the paper):
R>
dynformula(emp~wage+capital,log=list(capital=FALSE,TRUE),lag=list(emp=2,c(2,3)),diff=list(FALSE,capital=TRUE))
I see:
emp ~ wage + capital
rather than the complete model that is given in the paper:
log(emp) ~ lag(log(emp), 1) + lag(log(emp), 2) + lag(log(wage), 2) +
lag(log(wage), 3) + diff(capital, 2) +...
2009 Nov 27
3
problem with "dynformula" from "plm" package
Hello list,
I'm following the paper (http://www.jstatsoft.org/v27/i02/paper) on how to
use "plm" to run panel regressions, and am having trouble with what I
believe should be something very basic.
When I run the command (p.9 in the paper):
R>
dynformula(emp~wage+capital,log=list(capital=FALSE,TRUE),lag=list(emp=2,c(2,3)),diff=list(FALSE,capital=TRUE))
I see:
emp ~ wage + capital
rather than the complete model that is given in the paper:
log(emp) ~ lag(log(emp), 1) + lag(log(emp), 2) + lag(log(wage), 2) +
lag(log(wage), 3) + diff(capital, 2) +...
2009 Mar 26
1
pgmm (Blundell-Bond) sample needed
...and delta y's.
I believe that pgmm operates by demanding that "firm" (i) and "year" (t) be
the first two columns in the data set.
library(plm)
NF=20; NT=10
d= data.frame( firm= rep(1:NF, each=NT), year= rep( 1:NT, NF),
x=rnorm(NF*NT) );
# the following fails, because dynformula magic is required; learned this
the hard way
# v=pgmm( x ~ lag(x), data=d, gmm.inst=~x, lag.gmm=c(2,99),
transformation="ld" )
formula= dynformula( x ~ 1, list(1)); # this creates x ~ lag(x)
v=pgmm( formula, data=d, gmm.inst=~x, lag.gmm=c(2,99), transformation="ld" )
Error...
2009 Jan 21
0
trouble switching to 'plm' from 'xtabond' and Stata
...use Stata to
analyze the UK Employment Data. I am trying to replicate Roodman's
results for the UK Employment data using R instead of Stata but I am
having limited success.
Using:
>library('plm')
>data("EmplUK", package = "plm")
>emp.plm <- plm(dynformula(emp ~ wage + capital + output, lag =
list(2, 1, 2, 2), log = TRUE), EmplUK, effect = "time")
>summary(emp.plm)
I am able to perfectly replicate Roodman's "naive model" (on page 17)
regressing Log(Employment) on its own first and second lags as well as
current and...
2009 Mar 30
0
pgmm (Blundell-Bond) sample needed)
...and (ugh!). I'm also adding the
'nomata' option to avoid complications, but this will be unnecessary on most
systems (not on mine...).
The system-GMM estimator (with robust SEs) in Stata is 'xtabond2 n
nL1, gmm(L.(n)) nomata robust' whose R equivalent is:
> sysmod<-pgmm( dynformula( log(emp) ~ 1, list(1)), data=EmplUK, gmm.inst=~log(emp), lag.gmm=c(2,99),
+ effect="individual", model="onestep", transformation="ld" )
> summary(sysmod, robust=TRUE)
(note that although 'summary(sysmod)' does not report a constant, it's
actually th...
2010 Mar 13
0
PGMM help - Strange Errors when Fitting Models
...periods, but this should
leave me with the first time period to use as an instrument.
Below is my full code, along with 4 different pgmm attempts, with 4
different errors. My data is available here if anyone wants to try it:
http://dl.dropbox.com/u/3053463/did_dpd.dta
Also, likely unrelated, but dynformula has some strange behaviour
dynformula(value~value, lag.form=list(value = 1),diff.form=list(TRUE))
Gives: diff(value) ~ diff(diff(value), 1) + diff(value, 1)
Where I would have thought it would give this: diff(value) ~ diff(value, 1)
Thanks for your time.
library(foreign)
library(plm)
#Loading th...
2009 Mar 08
1
singular matrices in plm::pgmm()
...in the vignette?
Whatever I try, I eventually get a runtime error because of a singular
matrix at various points in pgmm.diff() (which gets called by pgmm()).
For example, when estimating a "dynamic" version of the Grunfeld data:
data(Grunfeld, package="Ecdat")
grun <- pgmm(dynformula(inv ~ value + capital, lag=list(1,1,1),
log=T), data=Grunfeld, gmm.inst=~log(inv), lag.gmm=list(c(2,5)),
model="twosteps")
Error in solve.default(suml(A2)) :
system is computationally singular: reciprocal condition number = 8.83721e-21
I read all the documentation available and tried...
2009 Mar 27
0
R: plm and pgmm
...aring statements, because stata seemed able of running this
and producing output.
On the other hand, the exact NF number at which pgmm() dies does suggest
that you are right.
function( NF=7, NT=4 ) {
d= data.frame( firm= rep(1:NF, each=NT), year= rep( 1:NT, NF),
x=rnorm(NF*NT) )
lagformula= dynformula( x ~ 1, list(1) )
v=pgmm( lagformula, data=d, gmm.inst=~x, model="onestep", effect=NULL,
lag.gmm=c(1,99), transformation="ld" )
}
with NF=8, it works; and with NF=7, it dies. With NF=7, I have 28 data
points in levels and 21 data points in differences, which are used to
e...
2012 Apr 12
1
Could dynlm function work for xts objects?
It seems to only works for zoo or ts objects?
I tried to run it for xts objects, and error message occurs. Once I
coerce it to be an zoo object (by as.zoo), it works.
Error message:
Error in model.frame.default(formula = dynformula(PIh - PI ~ L(X, 0:i) + :
variable lengths differ (found for 'L(X, 0:i)')
In addition: Warning messages:
1: In zoo(coredata(x), order.by = index(x), ...) :
some methods for ?zoo? objects do not work if the index entries in
?order.by? are not unique
2: In zoo(coredata(x), order.by = inde...
2013 Jan 13
1
R error: system is computationally singular when building GMM model
Dear,
I built the generalized method of moments model to estimate the sales rank
in the bookstore using plm package in R.
The equation is:
data1.gmm <- pgmm(dynformula(lnsales_rank ~ ln_price + avg_ham_rate +
avg_spam_rate + num_of_ham+ num_of_spam + ship_code2 +ship_code3
+ship_code4+ ship_code5+ ship_code6 + ship_ code7, lag = list(0, 0, 0,
0,0,0,0,0,0,0,0,0), log =FALSE), data=data, effect = "individual", model =
"twosteps", transformation...
2010 May 17
0
(no subject)
...to regress a dynamic panel model with pgmm function in the plm
package, but it doesn't work. The error report is "Error in
names(coefficients) <- c(namesX, namest) :
'names' attribute [13] must be the same length as the vector [5]".
My command is:
reg.gmm<-pgmm(dynformula(ln_per_co2ec~ln_per_realgdp+ln_per_realgdp2,lag
.form=list(1,0,0),
log.form=FALSE),data=co2new,effect="individual",model="twosteps",
gmm.inst=~ln_per_co2ec,lag.gmm=list(c(99,2)),transformation="d")
Could you guys give me some hints on this problem? Thank you in
adv...
2010 Jun 26
0
dynamic panelmodel pgmm
Hi,
I want to estimate a dynamic paneldata model with the following code, but unfortenately I received the error message below.
form<-PB~Activity+Solvency+Cap_Int
dynpanel<-pgmm(dynformula(form,list(1,1,1,1)),data=panel[1:2185,1:37],effect="twoways",model="onestep",index=c("Aktie","Datum"),gmm.inst=~PB,lag.gmm=list(c(2,12)),transformation="ld")
Fehler in FUN(X[[1L]], ...) : Indizierung au?erhalb der Grenzen
dim(panel)
[1] 34086 3...
2011 Oct 06
1
Coefficients for lagged plm model variables not calculated
...I need to convert all my data into <ts> data and then
compile it with ts.union to create a time series data frame in case there
was a problem with using the <lag> operator on my data frame, but my panel
entities are not time series data so this approach seemed flawed.
I have also used dynformula but this also seemed to lead to the same
outcome.
If on the other hand I used a simple linear model, there was no problem.
Example:
> b.fetw<-lm(B~lag(B,k=1)+Ma+lag(Ma,k=1)+Pa+lag(Pa,k=1)+Ya+lag(Ya,k=1)+F+lag(F,k=1)+CS+R+lag(R,k=1)+G+I,data=b)
> summary(b.fetw)
Call:
lm(formula = B ~ la...
2009 Apr 01
0
回复: R-help Digest, Vol 73, Issue 32
...and (ugh!). I'm also adding the
'nomata' option to avoid complications, but this will be unnecessary on most
systems (not on mine...).
The system-GMM estimator (with robust SEs) in Stata is 'xtabond2 n
nL1, gmm(L.(n)) nomata robust' whose R equivalent is:
> sysmod<-pgmm( dynformula( log(emp) ~ 1, list(1)), data=EmplUK, gmm.inst=~log(emp), lag.gmm=c(2,99),
+ effect="individual", model="onestep", transformation="ld" )
> summary(sysmod, robust=TRUE)
(note that although 'summary(sysmod)' does not report a constant, it's
actually th...