[R] suprising mm %*% coef(object) : non-conformable arguments with predict

Floriane Kg bountym|nd@ @end|ng |rom gm@||@com
Tue Feb 19 07:54:52 CET 2019


Hi,
A possible bug here?
My code worked yesterday, but today I have an error, and still don't know
why.
I joined a reproducible code and data files.

Error in mm %*% coef(object) : non-conformable arguments
Even if the data used to predict are the same as the one used to fit the
regression(has the same levels and number of covariates)

```r
## load package
library("prediction")
library(survey)

options(survey.lonely.psu = "adjust")
  my.svydesign <- survey::svydesign(ids = ~clust+idh, strata = ~reg+ur,
nest = T, weights = ~wt,
                                    data = ladies )

  DAT<-subset(ladies,region=="Sahel")

  tmp<-subset(my.svydesign,(region=="Sahel"))

X<-c((-1), names(COVARIATES)) #COVARIATES HAVE BEEN EXTRACTED FROM data DAT
  formula <- as.formula(paste("MCuser ~", paste(X, collapse= "+")))
  glm.ob5<-svyglm(formula,design=tmp,family=quasibinomial, maxit = 50)
  summary(glm.ob5)
  pred5<-predict(glm.ob5,DAT,type="response", se.fit=TRUE)#*100)

Error in mm %*% coef(object) : non-conformable arguments

#Even using the dataframe COVARIATES it does not work anymore
  pred5<-predict(glm.ob5,COVARIATES,type="response", se.fit=TRUE)#*100)


Error in mm %*% coef(object) : non-conformable arguments

Thank you
COVARIATES.RData
<http://r.789695.n4.nabble.com/file/t387811/COVARIATES.RData>
DAT.RData <http://r.789695.n4.nabble.com/file/t387811/DAT.RData>
ladies.RData <http://r.789695.n4.nabble.com/file/t387811/ladies.RData>

	[[alternative HTML version deleted]]



More information about the R-help mailing list