Error In Bread. * Meat. Non-conformable Arguments
Patuelli-2 Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ waldtest and nested models - poolability (parameter stability) Dear All, I'm trying to use waldtest to test poolability (parameter stability) between two logistic regressions. Because I need to use robust standard errors (using sandwich), I cannot use anova. anova has no problems running the test, but waldtest does, indipendently of specifying vcov or not. waldtest does not appear to see that my models are nested. H0 in my case is the the vector of regression parameters beta1 is the same as the vector of parameters beta2, where beta1 and beta2 are computed for the two subgroups (divided according to a factor). I was wondering if anyone can help me making waldtest recognize the nesting. Here's the lines I run: (BTW, I try to use robust standard errors because what I normally use (glm.binomial.disp) to correct for overdispersion does not converge for the unpooled model. But this is another story....) # poolability for leva.fin03.d # pooled model inv.log.leva.base = glm(mix.au.bin ~ cat.gap.tot + leva.fin03.d + ... + sud0nord1, data = inv.sub.au, family = binomial, maxit = 1000) # I deleted almost all variables to make the line more readable # overdispersed pooled model - NOT THE PROBLEM NOW inv.log.leva.base.disp = glm.binomial.disp(inv.log.leva.base) # unpooled model inv.log.leva = glm(mix.au.bin ~ leva.fin03.d/(cat.gap.tot + ... + sud0nord1 - 1), data = inv.sub.au, family = binomial, maxit = 1000) # again I deleted most variables for readability # overdispersed unpooled model - NOT CONVERGING :( inv.log.leva.disp = glm.binomial.disp(inv.log.leva, maxit = 10000) # inv.log.leva.disp not converging, so I resort to using waldtest with sandwich, BUT IT DOES NOT SEE THE NESTING! waldtest(inv.log.leva.base, inv.log.leva, test = "Chisq", vcov = sandwich) # anova would work but its results are not reliable because of the overdispersion - basically without correcting for overdispersion almost every variable is highly significant anova(inv.log.leva.base, inv.log.leva, test = "Chisq") Thanks everyone! Best regards, Roberto Patuelli ******************** Roberto Patuelli, Ph.D. Istituto Ricerche Economiche (IRE) (Institute for Economic Research) Università della Svizzera Italiana (University of Lugano) ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code. Achim Zeileis-4 Threaded O
Create new account Request new password Recent News Version 2.6.7 of OpenMx now available Version 2.5.2 of OpenMx now available Version 2.3.1 of OpenMx now available Advanced Genetic Epidemiology Statistical Workshop: October 26-30 2015, in Richmond, VA New features in OpenMx v2.2 Concerning the Currently Available Versions of OpenMx Version 2.0.1 now available OpenMx version 2.0 is officially released! Third OpenMx 2.0 beta is released Second OpenMx 2.0 beta is released more Navigation Feed aggregator Home › Forums › OpenMx Help › OpenMx Error Messages Error: "non-conformable http://r.789695.n4.nabble.com/waldtest-and-nested-models-poolability-parameter-stability-td3075237.html arguments" Login or register to post comments 1 reply [Last post] Thu, 05/12/2011 - 03:58 a.ortega Offline Joined: 02/05/2011 Hello everyone! I am trying to fit a latent (linear) growth model (with genetic and environmental influences, ACE) using ordinal twin data (MZ and same-sex + opposite-sex DZ; 6 groups), which includes 3 variables, 7 categories in each of them. The http://openmx.psyc.virginia.edu/thread/911 definition of the thresholds (invariant thresholds) seems to be difficult and the execution of the script returns: "Error: The algebra 'ACE.ThInc' in model 'lgcOrdACE' generated the error message: non-conformable arguments" Any help to interpret this error message would be very much appreciated. Is there any possibility to solve it? I have attached the script with the model to help with the issue, in case somebody want to have a look. Thanks a lot beforehand! Regards, Alfredo AttachmentSize Script.R7.38 KB ‹ Error in readRDS () Error: NPSOL returned a non-zero status code 3 › Top Login or register to post comments Printer-friendly version Send to friend Thu, 05/12/2011 - 06:59 #1 tbates Offline Joined: 07/31/2009 cols of m1 must = rows of m2 You are trying to multiply a 3*3 matrix "Inc" by a 6*3 matrix "Th" Top Login or register to post comments Copyright © 2007-2016 The OpenMx Project Search this site Recent Threads A function to return fit indices Error in runHelper NLOPT unrecognized error -1 The minimum number of studies to examine the mediator using metaSEM ACE estimate
Newey-West standard errors Newsgroups: gmane.comp.lang.r.r-metrics Date: Tuesday 9th June 2009 16:35:32 UTC (over 7 years ago) Dear all, I'm currently fitting vector autoregression using VAR() from package `vars'. It http://permalink.gmane.org/gmane.comp.lang.r.r-metrics/4148 estimates VAR by using OLS, and by default it provides "naive" standard errors (not HC and not HAC). > require(vars) > data(Canada) > Canada head(Canada) e prod rw U http://qubanshi.cc/questions/435274/r-calculate-robust-standard-errors-vcovhc-for-lm-model-with-singularities 1 929.6 405.4 386.1 7.53 2 929.8 404.6 388.1 7.70 3 930.3 403.8 390.5 7.47 4 931.4 404.2 394.0 7.27 5 932.7 405.0 396.8 7.37 6 933.6 404.4 400.0 error in 7.13 > temp coef(temp) $e Estimate Std. Error t value Pr(>|t|) e.l1 0.923983 0.023492 39.3313 1.202e-53 prod.l1 0.155238 0.028725 5.4043 6.697e-07 rw.l1 0.008184 0.006824 1.1992 2.340e-01 const 5.255418 13.451377 0.3907 6.971e-01 $prod Estimate Std. Error t value Pr(>|t|) e.l1 -0.06662 0.032275 -2.064 4.229e-02 prod.l1 1.02613 0.039463 26.002 1.777e-40 rw.l1 0.02744 0.009376 2.926 4.478e-03 const 40.29543 18.480012 2.180 3.220e-02 $rw error in bread. Estimate Std. Error t value Pr(>|t|) e.l1 0.1568 0.03650 4.296 4.907e-05 prod.l1 -0.1394 0.04463 -3.124 2.496e-03 rw.l1 0.9362 0.01060 88.303 1.012e-80 const -62.0937 20.89779 -2.971 3.928e-03 However, I would like to obtain Heteroskedasticity-Autocorrelation Consistent standard errors using NeweyWest() from package `sandwich', which handles principally `lm' and `glm' objects. I noticed that the VAR() returns an object of class `varest', which contains a list of fitted `lm' objects. So I tried to apply NeweyWest() to individual `lm' components of `varest', unsuccessfully. > class(temp) [1] "varest" > class(temp$varresult$e) [1] "lm" > temp.lm class(temp.lm) [1] "lm" > require(sandwich) > NeweyWest(temp.lm) Error in AA %*% t(X) : requires numeric matrix/vector arguments In addition: Warning message: In ar.ols(x, aic = aic, order.max = order.max, na.action = na.action, : model order: 1singularities in the computation of the projection matrixresults are only valid up to model order0 > vcovHAC(temp.lm) Error in bread. %*% meat. : non-conformable arguments I would have expected the above to have worked. For "standard" `lm' objects, I never had any such issues: > temp.std.lm class(temp.std.lm) [1] "lm" >
to do fine calculating normal standard errors for all coefficients that are actually estimated, but vcovHC() throws an error: "Error in bread. %*% meat. : non-conformable arguments". (The actual data I'm using is a bit more complicated. In fact, it is a model using two different fixed effects and I run into local singularities which I cannot simply get rid of. At least I would not know how. For the two fixed effects I'm using the first factor has 150 levels, the second has 142 levels and there are in total 9 singularities which result from the fact that the data was collected in ten blocks.) Here is my output: Call: lm(formula = one ~ two + three + Jan + Feb + Mar + Apr + May + Jun + Jul + Aug + Sep + Oct + Nov + Dec, data = dat) Residuals: Min 1Q Median 3Q Max -130.12 -60.95 0.08 61.05 137.35 Coefficients: (1 not defined because of singularities) Estimate Std. Error t value Pr(>|t|) (Intercept) 1169.74313 57.36807 20.390 <2e-16 *** two -0.07963 0.06720 -1.185 0.237 three -0.04053 0.06686 -0.606 0.545 Jan 8.10336 22.05552 0.367 0.714 Feb 0.44025 22.11275 0.020 0.984 Mar 19.65066 22.02454 0.892 0.373 Apr -13.19779 22.02886 -0.599 0.550 May 15.39534 22.10445 0.696 0.487 Jun -12.50227 22.07013 -0.566 0.572 Jul -20.58648 22.06772 -0.933 0.352 Aug -0.72223 22.36923 -0.032 0.974 Sep 12.42204 22.09296 0.562 0.574 Oct 25.14836 22.04324 1.141 0.255 Nov 18.13337 22.08717 0.821 0.413 Dec NA NA NA NA --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 69.63 on 226 degrees of freedom Multiple R-squared: 0.04878, Adjusted R-squared: -0.005939 F-statistic: 0.8914 on 13 and 226 DF, p-value: 0.5629 > model$se <- vcovHC(model) Error in bread. %*% meat. : non-conformable arguments Here is a minimal code snipped to reproduce the error. library(sandwich) set.seed(101) dat<-data.frame(one=c(sample(1000:1239)), two=c(sample(200:439)), three=c(sample(600:839)), Jan=c(rep(1,20),rep(0,220)), Feb=c(rep(0,20),rep(1,20),rep(0,200)), Mar=c(rep(0,40),rep(1,20),rep(0,180)), Apr=c(rep(0,60),rep(1,20),rep(0,160)), May=c(rep(0,80),rep(1,20),rep(0,14