[Gmm-commits] r186 - in pkg: causalGel/R momentfit momentfit/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Aug 30 22:11:45 CEST 2021
Author: chaussep
Date: 2021-08-30 22:11:45 +0200 (Mon, 30 Aug 2021)
New Revision: 186
Modified:
pkg/causalGel/R/causalMethods.R
pkg/momentfit/DESCRIPTION
pkg/momentfit/R/momentModel-methods.R
Log:
fixed a bug with smooth models: wrong sample size computed by modelDims
Modified: pkg/causalGel/R/causalMethods.R
===================================================================
--- pkg/causalGel/R/causalMethods.R 2021-05-03 20:38:54 UTC (rev 185)
+++ pkg/causalGel/R/causalMethods.R 2021-08-30 20:11:45 UTC (rev 186)
@@ -12,7 +12,8 @@
e <- Y-c(Z%*%theta[1:k])
m1 <- e*Z
e <- t(t(Z[,-1,drop=FALSE])-theta[-(1:k)])
- m2 <- sapply(1:ncol(X), function(i) e*X[,i])
+ m2 <- lapply(1:ncol(X), function(i) e*X[,i])
+ m2 <- do.call('cbind', m2)
if (object at momType == "uncondBal")
return(cbind(m1,m2))
m3 <- sweep(X[,-1,drop=FALSE], 2, object at balMom, "-")
Modified: pkg/momentfit/DESCRIPTION
===================================================================
--- pkg/momentfit/DESCRIPTION 2021-05-03 20:38:54 UTC (rev 185)
+++ pkg/momentfit/DESCRIPTION 2021-08-30 20:11:45 UTC (rev 186)
@@ -1,6 +1,6 @@
Package: momentfit
Version: 0.3
-Date: 2021-05-03
+Date: 2021-08-29
Title: Methods of Moments
Author: Pierre Chausse <pchausse at uwaterloo.ca>
Maintainer: Pierre Chausse <pchausse at uwaterloo.ca>
Modified: pkg/momentfit/R/momentModel-methods.R
===================================================================
--- pkg/momentfit/R/momentModel-methods.R 2021-05-03 20:38:54 UTC (rev 185)
+++ pkg/momentfit/R/momentModel-methods.R 2021-08-30 20:11:45 UTC (rev 186)
@@ -272,7 +272,7 @@
setMethod("modelDims", "linearModel",
function(object) {
n <- if (object at smooth)
- object at n-object@sSpec at w$m
+ object at n-2*object at sSpec@w$m
else
object at n
list(k=object at k, q=object at q, n=n, parNames=object at parNames,
@@ -282,7 +282,7 @@
setMethod("modelDims", "nonlinearModel",
function(object) {
n <- if (object at smooth)
- object at n-object@sSpec at w$m
+ object at n-2*object at sSpec@w$m
else
object at n
list(k=object at k, q=object at q, n=n, parNames=object at parNames,
@@ -293,7 +293,7 @@
setMethod("modelDims", "functionModel",
function(object) {
n <- if (object at smooth)
- object at n-object@sSpec at w$m
+ object at n-2*object at sSpec@w$m
else
object at n
list(k=object at k, q=object at q, n=n, parNames=object at parNames,
@@ -304,7 +304,7 @@
setMethod("modelDims", "formulaModel",
function(object) {
n <- if (object at smooth)
- object at n-object@sSpec at w$m
+ object at n-2*object at sSpec@w$m
else
object at n
list(k=object at k, q=object at q, n=n, parNames=object at parNames,
More information about the Gmm-commits
mailing list