r - Splitting lme residual plot into separate boxplots -


using basic plot function (plot.intervals.lmlist) lme model (called meef1), produced massive graph of boxplots. vector v2andv3commoditycombined has 98 levels.

plot(meef1, v2andv3commoditycombined~resid(.))

i separate grouping values of variable v2andv3commoditycombined either graph them separately, order them, or exclude some. i'm not sure if there code or if have extract information lme output. if case, i'm not sure extract create boxplots extracting residuals returns 1 value each level. if impossible, advice on how space out commodity names equally helpful.

thank you.

for each level of v2andv3commoditycombined, y axis , x axis be? since you're splitting plots v2andv3commoditycombined, can't use 1 of axes.

let's pretend want traditional residuals on y axis , fitted values on x axis, in separate plot each of 98 levels. can change code plot whatever want plot.

as per ?plot.lme, this:

plot(meef1,resid(.,type='pearson',level=1)~fitted(.,level=1)|v2andv3commoditycombined); 

make sure stretch out plot window beforehand it's nice , big, otherwise might error saying margins. following might produce better-looking plot:

plot(meef1,resid(.,type='pearson',level=1)~fitted(.,level=1)|v2andv3commoditycombined,pch='.',cex=1.5,abline=0); 

since wasn't clear question went ahead , assumed you're interested in individual level residuals (i.e. how each datapoint differs predicted value given random variables), , have 1 level of nesting in random formula. if want population residuals (i.e. how each datapoint differs average predicted value), change both instances of level level=0. if have k levels of nesting, change them level=k , luck.

i assumed wanted standardized residuals (because can use convenient rule of thumb absolute values greater 3 possible outliers, regardless of scale original data on). if not, see ?residuals.lme other valid options type argument.


oh, , name of variables suggests you're looking @ sort of financial time series. if so, have @ acf(meef1) see if there lot of autocorrelation. if there is, remedy instead fitting model response (y) variable diff(...) original variable. if you're seeing skewed residuals, might consider log-transforming response variable before taking diff.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -