r - lsmeans::lsmip: how to plot continuous values correctly? -


the lsmip() command in lsmeans package seems treat continuous predictors on x-axis categorical predictors.

if have observations continuous predictors @ discrete uneven intervals, (such when remove 0.2 level of nitro oats data), lsmip plots them @ intervals anyway.

data("oats", package = "nlme") oats.lmer2sub <- lmer(log(yield) ~ variety + poly(nitro,2)                + (1|block/variety),  data = subset(oats, nitro!=0.2)) lsmip(oats.lmer2sub, variety ~ nitro, ylab = "predicted log(yield)", cov.reduce=false) 

enter image description here

this seems important me if want show model predictions @ levels of nitro observed data. theoretically, should able show predicted values @ level of nitro.

lsmip(oats.lmer2sub, variety ~ nitro, ylab = "predicted log(yield)", at=list(nitro=c(0, 0.2, 0.4, 0.45, 0.46,  0.6))) 

enter image description here

is there way set x-axis space values of nitro scale appropriate continuous variable? meaning skip space 0.2 in first graph, or cluster points 0.45, 0.46 in second graph?

you can save plotted data in data frame, plot results want. in example:

plotdf <- lsmip(oats.lmer2sub, variety ~ nitro,            at=list(nitro=c(0, 0.2, 0.4, 0.45, 0.46,  0.6)),            plotit = false)  library(lattice) xyplot(lsmean ~ nitro, groups = ~variety,         type = "o", ylab = "predicted log(yield)", data = plotdf) 

resulting plot


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -