Re: [R] ggplot2 stat_smooth formula different units

2020-11-11 Thread David Winsemius
On 11/11/20 2:11 PM, Marcelo Laia wrote: Hi, I am running these approaches: Model 1 ggplot( dat , aes(x=DAP, y=Altura, color=as.factor(Espacamento) )) + geom_point(size=0.5) + stat_smooth(method = "lm", formula = y ~ x + I(x^2), size = 1) + facet_grid(Espacame

Re: [R] ggplot2 stat_smooth formula different units

2020-11-11 Thread Marcelo Laia
Hi Rui, You are very welcome! On 11/11/20 at 11:10, Rui Barradas wrote: > > dput(head(dat, 20)) > structure(list(Bloco = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), Espacamento = c("3 x 1", "3 x 1", "3 x 1", "3 x 1", "3 x 1", "3 x 1", "3 x 1", "3 x 1",

Re: [R] ggplot2 stat_smooth formula different units

2020-11-11 Thread Rui Barradas
Hello, Try removing I() from I(log(y)). But it's hard to say without a reproducible example, please post the output of dput(dat) or, if dat is big, the output of dput(head(dat, 20)) Hope this helps, Rui Barradas Às 22:11 de 11/11/20, Marcelo Laia escreveu: Hi, I am running these approa

Re: [R] ggplot2 stat_smooth

2016-06-29 Thread Nathan Pace
help@r-project.org" Subject: Re: [R] ggplot2 stat_smooth > >> On Jun 29, 2016, at 2:17 PM, Nathan Pace wrote: >> >> I want to add a logistic plot to data. >> >> My call to ggplot is: >> >> >> ggplot(data = SSI.dt, aes(x = elapsed,

Re: [R] ggplot2 stat_smooth

2016-06-29 Thread David Winsemius
> On Jun 29, 2016, at 2:17 PM, Nathan Pace wrote: > > I want to add a logistic plot to data. > > My call to ggplot is: > > > ggplot(data = SSI.dt, aes(x = elapsed, y = 1 - control)) + geom_point() + > stat_smooth(method = 'glm', family = binomial) + > xlab('Surgery Duration (min)') + ylab('Pr

Re: [R] ggplot2: stat_smooth for family=binomial with cbind(Y, N) formula

2013-12-17 Thread ONKELINX, Thierry
, Thierry Van: Michael Friendly [frien...@yorku.ca] Verzonden: dinsdag 17 december 2013 19:42 Aan: ONKELINX, Thierry; R-help Onderwerp: Re: [R] ggplot2: stat_smooth for family=binomial with cbind(Y, N) formula Thanks very much for this helpful reply, Thierry Using aes(wei

Re: [R] ggplot2: stat_smooth for family=binomial with cbind(Y, N) formula

2013-12-17 Thread Michael Friendly
Thanks very much for this helpful reply, Thierry Using aes(weight=trials) in stat_smooth() was part of what I was missing and solves my main question. However, for this data, I want to show the extrapolated prediction over a wider range than in the data. Adding xlim() doesn't help here-- the

Re: [R] ggplot2: stat_smooth for family=binomial with cbind(Y, N) formula

2013-12-17 Thread ONKELINX, Thierry
Dear Michael, Calculate the propotions. Then it is easy to use the weight option of glm data("SpaceShuttle", package="vcd") SpaceShuttle$trials <- 6 fm <- glm(cbind(nFailures, 6 - nFailures) ~ Temperature, data = SpaceShuttle, family = binomial) fm2 <- glm(nFailures/trials ~ Temperature, data =