[R-br] Bandas de confiança em plot de dispersão

Paulo Justiniano paulojus em leg.ufpr.br
Quarta Maio 9 14:50:26 BRT 2012


Para isto voce precisa definir um modelo

seus comandos e gráficos são medidas descritivas
bandas de confinaça vao depender do modelo que voce deseja
especificar (lm, glm, nls, gam, splines etc etc etc etc)

On Wed, 9 May 2012, Marcelo Cardoso mello wrote:

> Pessoal, gostaria de adicionar bandas de confiança na CMR que segue. Agradeço qualquer dica.
> 
> x<-structure(list(week = c(9L, 10L, 11L, 12L, 9L, 10L, 11L, 12L,
> 9L, 10L, 11L, 12L, 9L, 10L, 11L, 12L, 9L, 10L, 11L, 12L, 9L,
> 10L, 11L, 12L, 9L, 10L, 11L, 12L, 9L, 10L, 11L, 12L, 9L, 10L,
> 11L, 12L, 9L, 10L, 11L, 12L, 9L, 10L, 11L, 12L, 9L, 10L, 11L,
> 12L, 9L, 10L, 11L, 12L, 9L, 10L, 11L, 12L, 9L, 10L, 11L, 12L,
> 9L, 10L, 11L, 12L, 9L, 10L, 11L, 12L), kid = c(1L, 1L, 1L, 1L,
> 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L,
> 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L,
> 10L, 10L, 10L, 10L, 11L, 11L, 11L, 11L, 12L, 12L, 12L, 12L, 13L,
> 13L, 13L, 13L, 14L, 14L, 14L, 14L, 15L, 15L, 15L, 15L, 16L, 16L,
> 16L, 16L, 17L, 17L, 17L, 17L), treatment = c(1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L
> ), gain = c(1.2, 1, 1.1, 1.3, 1.2, 1.1, 1.4, 1.5, 1.3, 1.4, 1.4,
> 1.6, 1.1, 1.1, 1.2, 1.3, 1.2, 1.3, 1.2, 1.3, 1.1, 1.1, 1.1, 1.2,
> 1.1, 1.2, 1.3, 1.5, 1.3, 1.3, 1.3, 1.4, 1.2, 1.5, 1.9, 2.1, 1.3,
> 1.2, 1.4, 1.7, 1.5, 1.7, 1.6, 1.7, 1.4, 1.5, 1.7, 1.8, 1.2, 1.2,
> 1.4, 1.6, 1, 1.1, 1.4, 1.5, 1.4, 1.8, 2.1, 2.1, 1.1, 1.3, 1.4,
> 1.8, 1.2, 1.5, 1.7, 1.9)), .Names = c("week", "kid", "treatment",
> "gain"), class = "data.frame", row.names = c(NA, -68L)) 
> y<-aggregate(.~week+treatment, x, FUN=mean)
> s1<-subset(y, treatment==1)
> s2<-subset(y, treatment==2)
>  
> plot(gain~week, data=s1, col=1, type="o", ylim=c(1,2), lty=1)
> points(gain~week, data=s2, col=2, type="o", lty=2)
> legend(9.5,1.7, c("t1","t2"), col=c(1,2), lty=c(1,2))
> 
>


Mais detalhes sobre a lista de discussão R-br