Diferenças

Aqui você vê as diferenças entre duas revisões dessa página.

Link para esta página de comparações

Próxima revisão
Revisão anterior
pessoais:walmes:cursoragrarias2012 [2012/08/07 19:54] – criada walmespessoais:walmes:cursoragrarias2012 [2012/10/28 20:28] (atual) walmes
Linha 3: Linha 3:
 === Descrição === === Descrição ===
  
-Disciplina: Tópicos Especiais - Modelagem e análise de dados experimentais com o programa computacional R \\+Disciplina: Tópicos Especiais (AF 722) - Modelagem e análise de dados experimentais com o programa computacional R \\ 
 +Professor Coordenador: PhD. Louise Larissa May De Mio \\
 Professor Coordenador: PhD. [[http://www.leg.ufpr.br/~paulojus|Paulo Justiniano Ribeiro Júnior, LEG/UFPR]] \\ Professor Coordenador: PhD. [[http://www.leg.ufpr.br/~paulojus|Paulo Justiniano Ribeiro Júnior, LEG/UFPR]] \\
 Professor Colaborador: MSc. [[http://www.leg.ufpr.br/~walmes|Walmes Marques Zeviani, LEG/UFPR]] \\ Professor Colaborador: MSc. [[http://www.leg.ufpr.br/~walmes|Walmes Marques Zeviani, LEG/UFPR]] \\
-Nº de Créditos: \\ +Nº de Créditos: \\ 
-Carga horária: 30h \\ +Carga horária: 60h \\ 
-Período Letivo: 7 à 11 de Fevereiro de 2011 \\+Período Letivo: 2º semestre de 2012 \\
  
 +=== Referências bibliográficas ===
 +<bibtex>
 +
 +@TechReport{ribeiro_jr-leg,
 + url = {http://www.leg.ufpr.br/~paulojus/embrapa/Rembrapa/Rembrapa.pdf},
 + year = {2009},
 + author = {Paulo Justiniano {Ribeiro Júnior}},
 + title = {Introdução ao Ambiente Estatístico R}
 +}
 +
 +@TechReport{faraway-cran,
 + url = {http://cran.r-project.org/doc/contrib/Faraway-PRA.pdf},
 + year = {2002},
 + author = {Julian J. Faraway},
 + title = {Practical Regression and Anova using {R}}
 +}
 +
 +@book{faraway_linear_2005,
 +        title = {Linear models with R},
 +        url = {http://www.leg.ufpr.br/~walmes/docs/Linear%20Models%20with%20R.pdf},
 + isbn = {9781584884255},
 + publisher = {Chapman \& Hall/{CRC}},
 + author = {Julian James Faraway},
 + year = {2005},
 + pages = {244}
 +}
 +
 +@book{venables_modern_2002,
 + title = {Modern applied statistics with S},
 +        url = {http://www.leg.ufpr.br/~walmes/docs/Modern%20Applied%20Statistical%20Methods%20with%20S%20plus.pdf},
 + isbn = {9780387954578},
 + publisher = {Birkhäuser},
 + author = {William N. Venables and Brian D. Ripley},
 + year = {2002},
 + pages = {518}
 +}
 +
 +
 +@book{everitt_handbook_2009,
 + edition = {2},
 + title = {A Handbook of Statistical Analyses Using R, Second Edition},
 +        %url = {http://www.maths.bath.ac.uk/~jjf23/ELM/},
 +        url = {http://www.leg.ufpr.br/~walmes/docs/A%20handbook%20of%20statistical%20analyses%20using%20R.pdf},
 + isbn = {1420079336},
 + publisher = {Chapman \& Hall},
 + author = {Brian S. Everitt and Torsten Hothorn},
 + month = jul,
 + year = {2009}
 +}
 +
 +@book{dalgaard_introductory_2008,
 + edition = {2nd},
 + title = {Introductory Statistics with R},
 +        url = {http://www.leg.ufpr.br/~walmes/docs/Introductory%20Statistics%20with%20R.pdf},
 + isbn = {0387790535},
 + publisher = {Springer},
 + author = {Peter Dalgaard},
 + month = aug,
 + year = {2008}
 +}
 +
 +@book{dobson_introduction_2008,
 + edition = {3},
 + title = {An Introduction to Generalized Linear Models, Third Edition},
 +        url = {http://www.leg.ufpr.br/~walmes/docs/An%20introduction%20to%20generalized%20linear%20models.pdf},
 + isbn = {1584889500},
 + publisher = {Chapman and {Hall/CRC}},
 + author = {Annette J. Dobson and Adrian Barnett},
 + month = may,
 + year = {2008}
 +}
 +
 +@book{ritz_nonlinear_2008,
 + edition = {1},
 + title = {Nonlinear Regression with R},
 +        url = {http://www.leg.ufpr.br/~walmes/docs/Nonlinear%20Regression%20with%20R.pdf},
 + isbn = {0387096159},
 + publisher = {Springer},
 + author = {Christian Ritz and Jens Carl Streibig},
 + month = nov,
 + year = {2008}
 +}
 +
 +@book{sarkar_lattice:_2008,
 + edition = {1},
 + title = {Lattice: Multivariate Data Visualization with R},
 +        url = {http://www.leg.ufpr.br/~walmes/docs/Lattice%20Multivariate%20Data%20Visualization%20with%20R.pdf},
 + isbn = {0387759689},
 + shorttitle = {Lattice},
 + publisher = {Springer},
 + author = {Deepayan Sarkar},
 + month = mar,
 + year = {2008}
 +}
 +
 +@book{murrell_r_2005,
 + edition = {1},
 + title = {R Graphics},
 +        url = {http://www.leg.ufpr.br/~walmes/docs/R%20Graphics.pdf},
 + isbn = {{158488486X}},
 + publisher = {Chapman and {Hall/CRC}},
 + author = {Paul Murrell},
 + month = jul,
 + year = {2005}
 +}
 +
 +</bibtex>
 +
 +=== Material usado no curso ===
 +
 +Diretório com arquivos de dados e scripts do curso: {{http://www.leg.ufpr.br/~walmes/cursoR/af722_2012/}}
 +
 +=== Cronograma de atividades do Curso ===
 +
 +  * Manhã (M): 09:00-10:30, 10:50-12:00;
 +  * Tarde (T): 13:30-15:00, 15:20-14:30;
 +
 +^  Data  ^  Atividade  ^  Script  ^
 +| aula 01, 10/08 (M) sex | Informações gerais sobre à disciplina. Introdução ao R, download, instação, primeiros passos. | [[http://www.leg.ufpr.br/~walmes/cursoR/af722_2012/aula1.R]] |
 +| aula 02, 10/09 (M) seg | Importação de dados no formato texto. | [[http://www.leg.ufpr.br/~walmes/cursoR/af722_2012/aula2.R]] | 
 +| aula 03, 13/09 (M) qui | Importação e visualização de dados. | [[http://www.leg.ufpr.br/~walmes/cursoR/af722_2012/aula3.R]] |
 +| aula 04, 14/09 (M) sex | Aplicando filtros, selecionando subconjuntos e gráficos da lattice. | [[http://www.leg.ufpr.br/~walmes/cursoR/af722_2012/aula4.R]] |
 +| aula 05, 22/10 (M) seg | Simulando dados, regressão polinomial e não linear. | [[http://www.leg.ufpr.br/~walmes/cursoR/af722_2012/aula5.R]] |
 +| aula 06, 25/10 (M) qui | Análise de experimento com alternativas para satisfazer os pressupostos. | [[http://www.leg.ufpr.br/~walmes/cursoR/af722_2012/aula6.R]] |
 +| aula 07, 26/10 (M) sex | Análise de experimento, ajuste de polinômio e modelos segmentados. | [[http://www.leg.ufpr.br/~walmes/cursoR/af722_2012/aula7.R]] |
 +| aula 08, 01/11 (M) qui | Programado: aula teórica análise contagem e proporção. | |
 +| aula 09, 01/11 (T) qui | Programado: exposição dos casos experimentais. | |
 +| aula 10, 28/11 (M) qua | Programado: (08:00-12:00) exposição das análises dos dados. | |
 +
 +=== Vídeos ===
 +
 +  * {{http://www.youtube.com/watch?v=ExVhaN36jBs|Least Squares Regression Line Notes}};
 +  * {{http://www.youtube.com/watch?v=0cUFTQs-PUo&feature=related|Least Squares Regression}};
 +  * {{http://www.youtube.com/watch?v=MIqyiGvrUXE&feature=related|Introductory Statistics - Chapter 10: Regression}};
 +  * {{http://www.r-tutor.com/elementary-statistics/hypothesis-testing|Hypotesis test with R}};
 +
 +=== Código ===
 +
 +<code>
 +#------------------------------------------------------------------------------------------
 +
 +vol <- read.table("http://www.leg.ufpr.br/~walmes/data/volume.txt",
 +                  header=TRUE, sep="\t")
 +str(vol)
 +vol$dos <- factor(vol$dose)
 +
 +xyplot(volu~dose|gen, data=vol)
 +
 +m0 <- aov(volu~gen+dos+gen:dos, data=vol)
 +anova(m0)
 +
 +par(mfrow=c(2,2)); plot(m0); layout(1)
 +
 +boxcox(m0)
 +
 +m1 <- aov((volu^(1/3))~gen+dos+gen:dos, data=vol)
 +par(mfrow=c(2,2)); plot(m1); layout(1)
 +anova(m1)
 +
 +with(vol, fat2.crd(gen, dos, volu^(1/3), mcomp=c("sk","tukey")))
 +
 +#------------------------------------------------------------------------------------------
 +
 +plot(residuals(m0)~vol$dos)
 +plot(residuals(m0)~vol$dose)
 +
 +qqmath(~residuals(m0)|vol$dose)
 +
 +pesos <- tapply(residuals(m0), vol$dose, var)
 +vol$pesos <- rep(pesos, each=27)
 +
 +m2 <- aov(volu~gen+dos+gen:dos, data=vol, weights=1/vol$pesos)
 +par(mfrow=c(2,2)); plot(m2); layout(1)
 +anova(m2)
 +
 +require(doBy)
 +
 +popMeans(m2, effect="gen")
 +popMeans(m2, effect="dos")
 +popMeans(m2, effect=c("gen", "dos"))
 +
 +require(agricolae)
 +glr <- df.residual(m2)
 +s2 <- deviance(m2)/df.residual(m2)
 +
 +with(subset(vol, dose=="0"),
 +     HSD.test(volu, gen, DFerror=glr, MSerror=pesos[1]*s2))
 +
 +with(subset(vol, dose=="5"),
 +     HSD.test(volu, gen, DFerror=glr, MSerror=pesos[2]*s2))
 +
 +with(subset(vol, dose=="25"),
 +     HSD.test(volu, gen, DFerror=glr, MSerror=pesos[3]*s2))
 +
 +#------------------------------------------------------------------------------------------
 +# dose em cada genótipo
 +
 +X <- popMatrix(m2, effect=c("gen", "dos"))
 +contr <- expand.grid(gen=levels(vol$gen), dos=levels(vol$dos))
 +which(contr$gen=="ATF06B")
 +
 +contr.x <- rbind("0vs5"=X[1,]-X[10,],
 +                 "0vs25"=X[1,]-X[19,],
 +                 "5vs25"=X[10,]-X[19,])
 +contr.x%*%coef(m2) # estimativas dos contrastes
 +contr.x%*%vcov(m2)%*%t(contr.x)
 +
 +summary(glht(m2, linfct=contr.x))
 +
 +#------------------------------------------------------------------------------------------
 +# fizemos isso para um único nível de gen, o código abaixo faz para todos
 +
 +lM <- lapply(levels(vol$gen),
 +             function(g){
 +               X[contr$gen==g,]
 +             })
 +lM
 +
 +com <- combn(3, 2)
 +
 +compr <- lapply(lM,
 +                function(i){
 +                  m <- t(apply(com, 2, function(j) i[j[1],]-i[j[2],]))
 +                })
 +names(compr) <- levels(vol$gen)
 +compr
 +
 +lapply(compr, function(g) summary(glht(m2, linfct=g)))
 +
 +#------------------------------------------------------------------------------------------
 +# colocando os resultados em um gráfico com IC
 +
 +IC <- lapply(compr, function(g) confint(glht(m2, linfct=g)))
 +IC <- lapply(IC, "[[", "confint") #IC[[1]]$confint
 +IC <- do.call(rbind, IC)
 +nm <- apply(com, 2, function(i) paste(levels(vol$dos)[i[1]], levels(vol$dos)[i[2]], sep="vs"))
 +
 +IC <- cbind(expand.grid(compr=nm, gen=levels(vol$gen)), IC)
 +str(IC)
 +
 +require(latticeExtra)
 +
 +segplot(compr~lwr+upr|gen, data=IC)
 +
 +segplot(compr~lwr+upr|gen, data=IC, layout=c(1,9),
 +        strip.left=TRUE, strip=FALSE,
 +        draw.bands=FALSE, centers=Estimate,
 +        segments.fun=panel.arrows, ends="both",
 +        angle=90, length=1, unit="mm")
 +
 +segplot(compr~lwr+upr|gen, data=IC, layout=c(1,9),
 +        strip.left=TRUE, strip=FALSE,
 +        draw.bands=FALSE, centers=Estimate,
 +        segments.fun=panel.arrows, ends="both",
 +        angle=90, length=1, unit="mm",
 +        panel=function(...){
 +          panel.segplot(...)
 +          panel.abline(v=0, col=2)
 +        })
 +
 +#------------------------------------------------------------------------------------------
 +
 +</code>

QR Code
QR Code pessoais:walmes:cursoragrarias2012 (generated for current page)