[R] plot.mob() fails with cut() error "'breaks' are not unique"

Achim Zeileis Achim.Zeileis at uibk.ac.at
Wed Jan 23 09:06:18 CET 2013


On Tue, 22 Jan 2013, Jason Musil wrote:

> DeaR all,
>
> I am using mob() for model based partitioning, with a dichotomous 
> variable (participant's correct/incorrect response to a test item) 
> regressed onto a continuous predictor related to a given property of the 
> test item. Although this variable is continuous, the value of this 
> variable for many items in this particular analysis is 0. The 
> partitioning criterion is self-reported ability in a related area.
>
>> mob1 <- mob(
>    correct ~ circular.mean | srp.dimension,
>    control=mob_control(alpha=.001),
>    model=glinearModel,
>    family=binomial()
>  )
>
>> plot(mob1)
>
> Error in cut.default(x, breaks = breaks, include.lowest = TRUE) :
>  'breaks' are not unique
>
> The same persists if I specify either a desired number of breaks, or 
> explicit breakpoints (e.g. breaks=3 or breaks=c(-0.1,0.1,0.5)). I guess 
> this is to do with the funny distribution of the predictor variable, but 
> I'm not sure what to do about it.

Jason, you can't pass the "breaks" argument to the plot method directly 
but need to pass it on to the panel function drawing the terminal panels. 
As an example consider

example("mob")
plot(fmPID)
plot(fmPID, tp_args = list(breaks = c(0, 100, 120, 200)))

Hope that fixes your problem.

Best,
Z

> Many thanks and apologies if this doesn't fit the mailing list---it is my first posting!
> Jason Musil
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list