[R] how to fit model to split data and get residual plots

Eduardo S. G. Mizubuti mizubuti at ufv.br
Tue Jan 15 20:25:15 CET 2008


I have a data set with the following structure (with many more obs.):

var1 	expt 	day 	diameter
1	1	2	0.5
1	1	3	0.9
1	1	4	1.3
1	1	5	1.7
1	2	2	0.3
1	2	3	0.5
1	2	4	0.9
1	2	5	1.6
2	1	2	0.7
2	1	3	1.2
2	1	4	1.6
2	1	5	2.3
2	2	2	0.4
2	2	3	0.8
2	2	4	1.6
2	2	5	3.2

I can get separate regression analysis for each level of var1 and expt
with the command:

by(data3, data3$var1:data3$expt, function(x) lm(diameter ~ day, data =
x))

How can I get residual plots for each combination var1*expt generated
above?

Thanks!
Eduardo





-- 
Eduardo S. G. Mizubuti
Departamento de Fitopatologia
Universidade Federal de Viçosa
36570-000 Viçosa, MG Brasil
tel.: +55 31 3899 1090
fax: +55 31 3899 2240
e-mail: mizubuti at ufv.br




More information about the R-help mailing list