<div dir="ltr"><div>Segue o CMR que estou utilizando<br></div><div><br><br><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;background-color:rgb(225,226,229);font-weight:normal;line-height:15px;border-collapse:separate;text-transform:none;font-size:13px;white-space:pre-wrap;font-family:DotumChe;word-spacing:0px"><pre style="font-family:DotumChe;font-size:10pt!important;outline-style:none;outline-width:initial;outline-color:initial;border-style:none;border-width:initial;border-color:initial;white-space:pre-wrap!important;margin:0px;line-height:1.2">
GM<-structure(list(Animal = c(1L, 60L, 62L, 68L, 72L, 7L, 73L, 98L,
99L, 100L, 91L, 92L, 93L, 51L, 83L, 89L, 86L, 87L, 94L, 95L,
17L, 82L, 84L, 97L, 3L, 76L, 78L, 48L, 52L, 55L, 69L, 13L, 22L,
33L, 63L, 12L, 67L, 77L, 80L, 41L, 42L, 46L, 50L, 25L, 53L, 57L,
64L, 28L, 35L, 58L, 61L, 21L, 24L, 54L, 59L, 20L, 30L, 38L, 45L,
10L, 11L, 19L, 9L, 14L, 18L, 32L, 56L, 2L, 4L, 5L, 23L, 27L,
29L, 40L, 47L, 6L, 8L, 31L, 34L, 36L, 39L, 44L, 65L), Manejo = c(1L,
1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L,
1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L,
1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L,
1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L), Gest = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 90L,
90L, 90L, 90L, 90L, 90L, 90L, 90L, 90L, 90L, 90L, 90L, 90L, 90L,
110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L,
110L, 110L, 110L, 110L, 130L, 130L, 130L, 130L, 130L, 130L, 130L,
130L, 130L, 130L, 130L, 130L, 130L, 130L, 130L, 130L, 140L, 140L,
140L, 140L, 140L, 140L, 140L, 140L, 140L, 140L, 140L, 140L, 140L,
140L, 140L, 140L, 140L, 140L, 140L, 140L, 140L, 140L, 140L, 140L,
140L, 140L, 140L, 140L), Fetos = c(0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), NaGLAMA = c(0.515523054,
0.274319898, 0.260406616, 0.345393579, 0.941416811, 3.242298603,
0.543581754, NA, NA, 0.310913983, 0.103119122, 0.242179757, 1.511982572,
0.248561812, 1.377624119, 1.239927094, NA, 0.347712662, NA, 0.907352204,
NA, 1.629736193, 0.707560235, 1.260423046, 0.6423459, 1.314054397,
NA, 0.728530524, 0.398189115, 0.749234643, 0.544891837, NA, 5.434432736,
1.273166074, NA, 1.055026755, 0.937103858, 1.297767845, 0.691943258,
1.336532109, NA, 1.69233929, 2.762457777, 1.639361362, 1.220678864,
0.696944641, 0.555373873, 2.694735252, 1.593673698, 4.8664716,
1.14279477, 0.952757874, 1.538877833, 3.417410969, NA, 3.827188165,
4.90094219, NA, 1.254578538, 3.997852624, 1.562503764, 2.689082873,
8.459237956, 8.787103701, 2.535628503, 4.715973548, 2.187817632,
1.860875669, 2.656679208, 4.929889812, 2.548334487, 4.177756252,
4.293566946, 5.717494612, 1.55775636, 4.922141642, 4.650077264,
6.112568346, 5.235183032, 1.907048841, 2.814221997, 5.477504341,
5.465705692)), .Names = c("Animal", "Manejo", "Gest", "Fetos",
"NaGLAMA"), row.names = c(NA, -83L), class = "data.frame")<br><br>library(nlme)<br>NAGLM1<-gnls(NaGLAMA~a*exp(c*Gest),start=list(a=0.04,c=0.03),weight=varIdent(form=~1|Gest),na.action=na.omit,data=GM[-c(59,57,61),],subset=c(Gest>0 & Fetos==1))<br>
</pre></span><br></div>#Códigos fornecidos pelo Walmes Adaptado<br><br>criando função que representa o modelo, retorna gradidente e hessiano<br><br>expo.der <- deriv3(~a*exp(c*Gest),<br> c("a", "c"),<br>
function(Gest, a,c) NULL)<br>str(expo.der)<br><br><div dir="ltr">#-----------------------------------------------------------------------------<br>
# ajustando o modelo aos dados a partir dos valores iniciais via gráfico<br><br>n0 <- gnls(NaGLAMA~expo.der(Gest, a,c),weight=varIdent(form=~1|Gest),na.action=na.omit, data=GM[-c(59,57,61),], start=start)<br>summary(n0)<br>
confint(n0)<br>#----------------------------------------------------------------------------------------------------<br><div><code>pred <- data.frame(Gest=seq(90,150,20))<br>der <- do.call(expo.der, args=c(list(Gest=pred$Gest), as.list(coef(n0))))<br>
F <- attr(der, "gradient") # gradiente avaliado no novo t<br>U <- chol(vcov(n0))<br>se <- sqrt(apply(F%*%t(U), 1, function(x) sum(x^2))) # erro padrão<br>#-----------------------------------<br></code></div>
par(mar=c(3.1,4.8,2.1,4.8), usr=c(87.6,152.4,-0.0887938,5.0928551),cex=0.8)<br>plot(NaGLAMA~Gest, data=GM[GM[-c(59,57,61),]$Fetos==1,], xlab="Idade Gestacional(dias)",<br> ylab="Conteúdo de Sódio (g)",<br>
xlim=c(90,150))<br>matlines(pred$Gest,c(der)+<br> outer(se, qt(c(.5,.025,.975), df=summary(n0)$dim$N-summary(n0)$dim$p)),<br> type="l", col=c(1,1,1), lty=c(1,2,2))<br>legend("topleft",<br>
legend=c("valores observados", "valores preditos",<br> "intervalo de confiança (95%)"),<br> lty=c(NA,1,2), col=c(1,1,1), pch=c(1,NA,NA), bty="n")<br>grid()<br>
cf <- format(coef(n0), digits=3)<br>text(x=c(105),y=c(2.5),adj=NULL,<br> label=substitute(Na[g]==a%+-%(0.0027)%.%e^(c%+-%(0.007)%.%t),<br> list(a=cf[1], c=cf[2])),font=)<br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">Em 12 de julho de 2013 14:20, Benilton Carvalho <span dir="ltr"><<a href="mailto:beniltoncarvalho@gmail.com" target="_blank">beniltoncarvalho@gmail.com</a>></span> escreveu:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
exemplo *curto* que possamos reproduzir?<br>
<br>
Em 12 de julho de 2013 14:08, Fernando Antonio de souza<br>
<<a href="mailto:nandodesouza@gmail.com">nandodesouza@gmail.com</a>> escreveu:<br>
<div><div class="h5">> Boa tarde<br>
><br>
> Estou com uma dúvida! por que ao utilizar a função matlines() a linha<br>
> adcionda ao gráfico é quebrada e não contínua (parece um conjunto de retas<br>
> ligando os pontos). Como eu posso solucionar isso?<br>
><br>
> grato<br>
><br>
</div></div>> _______________________________________________<br>
> R-br mailing list<br>
> <a href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br>
> <a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
> Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código<br>
> mínimo reproduzível.<br>
_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br>
</blockquote></div><br></div>