lattice 多维数据控制变量分组分析
xyplot(y~x|f*g,data) ##散点图 f g 都需为因子变量as.factor
xyplot(,data,layout=c(2,2))
data
xlab/ylab/mian
strip ##是否标记每个panel(默认是)
bwplot() ##箱型图
stripplot() ##以点画图
histigram() ##直方图
dotplot() ##线上画点
splom() ##散点图矩阵pairs()
levelplot() ##图形数据
contourplot() ##图形视图
xyplot(y~x|f,panel=function(x,y,...){
panel.xyplot(x,y,...)
panel.abline(h,lty) ##添加基准线
panel.lmline(,y,col=2) ##添加回归线
})
在用lattice建立分组分析时,建议用table观察数据的分布。明确分组维度。