<font face="trebuchet ms,sans-serif">Alexandre,<br><br>Melhor forma de entender a saída e conhecer a partida. Assim, simule de um experimento onde você conhece o valor dos contrastes e veja o que a função retorna. Fiz isso com um exemplo normal, coloquei variância pequena só para não ter muita diferença entre parâmetros (theta) e estimativas. Veja se fica claro.<br>
<br><span style="font-family: courier new,monospace;">da <- expand.grid(A=gl(2,1), B=gl(3,1), rept=1:4)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">X <- model.matrix(~A*B, da)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">colnames(X)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">theta <- c(10,1,0,-1,0,0)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">da$y <- X%*%theta+rnorm(nrow(X),0,0.001)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">m0 <- lm(y~A*B, da)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">require(contrast)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">c1 <- contrast(m0,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> list(A=levels(da$A), B="1"),</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> list(A=levels(da$A), B="2"))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">c1</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"># fez B1 vs B2 dentro de A1 e dentro de A2</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">cbind(t(c1$X), theta)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">c1$X%*%theta</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">c2 <- contrast(m0,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> list(A=levels(da$A), B="1"),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> list(A=levels(da$A), B="3"))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"># fez B1 vs B2 dentro de A1 e dentro de A2</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">c2</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">cbind(t(c2$X), theta)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">c2$X%*%theta</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">c3 <- contrast(m0,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> list(A="1", B=levels(da$B)),</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> list(A="2", B=levels(da$B)))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"># fez A1 vs A2 dentro de B1, B2 e B3</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">c3</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">cbind(t(c3$X), theta)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">c3$X%*%theta</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">c4 <- contrast(m0, type="average",</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> list(A="1", B=levels(da$B)),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> list(A="2", B=levels(da$B)))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"># fez A1 vs A2 na média dos níveis de B (efeito principal)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">c4</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">cbind(t(c4$X), theta)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">c4$X%*%theta</span><br style="font-family: courier new,monospace;"><br>À disposição.<br>Walmes.<br><br clear="all"></font><span style="font-family: trebuchet ms,sans-serif;">==========================================================================</span><br style="font-family: trebuchet ms,sans-serif;">
<span style="font-family: trebuchet ms,sans-serif;">Walmes Marques Zeviani</span><br style="font-family: trebuchet ms,sans-serif;"><span style="font-family: trebuchet ms,sans-serif;">LEG (Laboratório de Estatística e Geoinformação, 25.450418 S, 49.231759 W)</span><br style="font-family: trebuchet ms,sans-serif;">
<span style="font-family: trebuchet ms,sans-serif;">Departamento de Estatística - Universidade Federal do Paraná</span><br style="font-family: trebuchet ms,sans-serif;"><span style="font-family: trebuchet ms,sans-serif;">fone: (+55) 41 3361 3573</span><br style="font-family: trebuchet ms,sans-serif;">
<span style="font-family: trebuchet ms,sans-serif;">VoIP: (3361 3600) 1053 1173</span><br style="font-family: trebuchet ms,sans-serif;"><span style="font-family: trebuchet ms,sans-serif;">e-mail: <a href="mailto:walmes@ufpr.br" target="_blank">walmes@ufpr.br</a></span><br style="font-family: trebuchet ms,sans-serif;">
<span style="font-family: trebuchet ms,sans-serif;">twitter: @walmeszeviani</span><br style="font-family: trebuchet ms,sans-serif;"><span style="font-family: trebuchet ms,sans-serif;">homepage: <a href="http://www.leg.ufpr.br/%7Ewalmes" target="_blank">http://www.leg.ufpr.br/~walmes</a></span><br style="font-family: trebuchet ms,sans-serif;">
<span style="font-family: trebuchet ms,sans-serif;">linux user number: 531218</span><br style="font-family: trebuchet ms,sans-serif;"><span style="font-family: trebuchet ms,sans-serif;">==========================================================================</span><br>