gmm


Solving for 2 variables under GMM


I tried to solve for a 2*1 matrix of GMM estimators with the following code:
x<-rnorm(50, mean = 3, sd = 2)
y<-rnorm(50, mean = 4, sd = 1)
z_1<-as.matrix(x)
z_2<-as.matrix(y)
e<-function(RGAAA,x,y)
{m1<-exp(-x/RGAAA[1])-1
m2<-exp(-y/RGAAA[2])-1
f<-cbind(m1,m2)
return(f)}
summary(gmm(e,cbind(z_1,z_2),c(1,1),method="BFGS",control=1e-12))
However, they yield the error message:
Error in P$g(P$t0, x) : argument "y" is missing, with no default
Could anyone help me find out what went wrong?
Thanks a lot!
The Gmm function can have only one matrix for the variables and one vector for the parameters. There you go:
set.seed(123)#to replicate the results
x<-rnorm(50, mean = 3, sd = 2)
y<-rnorm(50, mean = 4, sd = 1)
z_1<-as.matrix(x)
z_2<-as.matrix(y)
z <- cbind(z_1,z_2) #make one matrix from both vectors
e<-function(RGAAA,x) #one input for the parameters and one input for the variables
{m1<-exp(-x[,1]/RGAAA[1])-1
m2<-exp(-x[,2]/RGAAA[2])-1
f<-cbind(m1,m2)
return(f)}
summary(gmm(e,z,c(1,1),method="BFGS",control=1e-12))
And with my seed for pseudo-random numbers you get the following output:
Call:
gmm(g = e, x = z, t0 = c(1, 1), method = "BFGS", control = 1e-12)
Method: twoStep
Kernel: Quadratic Spectral
Coefficients:
Estimate Std. Error t value Pr(>|t|)
Theta[1] 4.5256e+02 3.8809e+01 1.1661e+01 2.0121e-31
Theta[2] 4.9367e+02 1.5265e+01 3.2341e+01 1.8683e-229
J-Test: degrees of freedom is 0
J-test P-value
Test E(g)=0: 0.00577448313404338 *******
#############
Information related to the numerical optimization
Convergence code = 0
Function eval. = 25
Gradian eval. = 24

Related Links

Can we use a mixing proportions probeties of in matlab as the weight matrix of the Gaussian component
Solving for 2 variables under GMM

Categories

HOME
asp.net-web-api
search
android-studio-2.2
jax-rs
pda
toolbox
obfuscation
sh
rds
onclick
little-proxy
vimdiff
fhir
enthought
github-enterprise
windows-ce
php-5.6
radgridview
gkturnbasedmatch
event-sourcing
symfony-2.8
feathersjs
xmonad
digital-signature
swagger-2.0
named-entity-recognition
postscript
exit
event-store
aggregation
custom-post-type
syntax-highlighting
pylons
android-maps
ms-access-2003
realm-mobile-platform
twiml
testcomplete
nsurl
zend-debugger
clickjacking
classcastexception
flatmap
chef-solo
apriori
flask-login
jide
openal
opennms
facebook-pixel
modelsim
bbpress
css-transforms
objectscript
polyline
smartfoxserver
simplepie
stax
nss
tracker-enabled-dbcontext
findfirst
nio2
np-spring
cycle2
jnlua
xvim
zen-cart
doctype
zscript
sha512
xmltype
beatsmusic
contrast
create.js
codeplex
tinyxml
gnumeric
dot42
extjs2
gae-quotas
gtm-oauth2
mysql-error-1044
inappsettingskit
beaker-testing
cffile
observium
scmmanager
dolby-audio-api
insert-id
asplinkbutton
pstack
iboutlet
fitbounds
google-maps-mobile
landscape-portrait
presentation-layer
easyb
pos-for-.net
nstokenfield
request-headers
build-environment
fail-fast-fail-early
perl5.12
dsoframer

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App