[R] Error in dimnames(x) for Poisson EWMA model

Ashley E. Jochim aew9 at u.washington.edu
Wed Apr 20 21:05:46 CEST 2011


I am attempting to run a Poisson EWMA model using Patrick Brandt's source code.  I get the following error when I run the code:

Error in dimnames(x) <- dn : 
  length of 'dimnames' [1] not equal to array extent

Dimnames(x) looks like this:

[[1]]
NULL

[[2]]
[1] "mip"       "div"       "nom"       "unity"     "mood"      "times"    
[7] "hmajparty" "smajparty" "pres"  

It seems to me that the NULL value here is causing the problem but I can't figure out (1) why the null value is showing up and (2) how to get rid of it.  Background code is as follows:

cr.pois<- glm(countlaw ~ mip + div + nom + unity + mood + times + hmajparty + smajparty + pres, family = poisson)
summary(cr.pois)

init <- coef(cr.pois)

x<- cbind(mip,div,nom,unity,mood,times,hmajparty,smajparty,pres)

cr.PEWMA<- Pewma(y=countlaw,x=as.matrix(x),init.param=c(0.8,init[2:length(init)]))

Which results in this output:

N = 10, M = 5 machine precision = 2.22045e-16

iterations 34
function evaluations 45
segments explored during Cauchy searches 35
BFGS updates skipped 0
active bounds at final generalized Cauchy point 1
norm of the final projected gradient 0.00806577
final function value 1.78439

final  value 1.784390 
converged
Error in dimnames(x) <- dn : 
  length of 'dimnames' [1] not equal to array extent

Any thoughts on what's going on here and how to fix it?

Many thanks in advance.

Ashley
--
Ashley E. Jochim
Graduate Fellow
Center for American Politics & Public Policy
Department of Political Science
University of Washington
aew9 at u.washington.edu
http://students.washington.edu/aew9



More information about the R-help mailing list