[R] plot command error message

Benjamin Gföhler beni.gfoehler at hispeed.ch
Sun Jun 4 23:20:40 CEST 2017


 
I tried to plot a clustered linear regression model with the cplot command in R (code below). Leaflet is a binary variable (I know logit would be better), partisan is nummeric variable (0-4) and partisan_mis a dummy (0,1). As you can see it is clustered around two variables: around individuals and around the specific survey. When I try to run the cplot command I always get this error message:

error in plot.window(...) : need finite 'ylim' values 

Zusätzlich: Warnmeldungen:	 1: In min(x) : no non-missing arguments to min; returning Inf 

						2: In max(x) : no non-missing arguments to max; returning -Inf

Does anyone know how to solve this problem?

As I suppose that the problem has something to do with the way I coded the variables, here is how i did it:


voxit$leaflet[voxit$a65== "Ja"] <- 1
voxit$leaflet[voxit$a65== "Nein"] <- 0
voxitf <- subset(voxit, leaflet >= 0 ) 

voxitf$partisan[voxitf$a87x== "1 Tag oder weniger vorher"] <- 0
voxitf$partisan[voxitf$a87x== "Einige Tage vorher"] <- 1
voxitf$partisan[voxitf$a87x== "1-2 Woche(n) vorher"] <- 2
voxitf$partisan[voxitf$a87x== "Mehrere Wochen vorher"] <- 3
voxitf$partisan[voxitf$a87x== "Schon immer klar"] <- 4
mean(voxitf$partisan, na.rm = TRUE)

voxitf$partisan[is.na(voxitf$a87x)]<- 2.73493
table(voxitf$partisan)

voxitf$partisan_mis[is.na(voxitf$a87x)]<- 1
voxitf$partisan_mis[!is.na(voxitf$a87x)]<- 0


model1.1 <- lm(leaflet ~ partisan + partisan_mis , data = voxitf)

vcov_clust1.1 <- cluster.vcov(model1.1, cbind(voxitf$id,voxitf$projetx))

(marginal_effects1.1 <- margins(model1.1)) 

summary(marginal_effects1.1)

cplot(model1.1, x = "partisan", dx = "leaflet", what = "effect", se.type = "shade")
	[[alternative HTML version deleted]]



More information about the R-help mailing list