Skip to content

how to interpolate a plot with a logistic curve

5 messages · Dylan Beaudette, Christian Ritz, Simone Gabbriellini

#
hello,

I have this simple question. This is my dataset

	size
1	57
2	97
3	105
4	123
5	136
6	153
7	173
8	180
9	193
10	202
11	213
12	219
13	224
14	224
15	248
16	367
17	496
18	568
19	618
20	670
21	719
22	774
23	810
24	814
25	823

I plot it with:

plot(generalstats[,1], type="b", xlab="Mesi", ylab="Numero di  
vertici", main="");

and try to interpolate with a linear regression with

abline(lm(generalstats[, 
1 
]~ 
c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25)),  
lty=3, col="red");

how to interpolate the data with a logistic curve? I cannot find the -  
I suppose easy - solution..

thank you,
Simone
#
On Wednesday 05 December 2007, Simone Gabbriellini wrote:
try:

glm(formula, data, family=binomial())

require(Design)
lrm()


Cheers,
#
Dear Simone,

you can use the package 'drc' to fit a logistic model, that is a non-linear regression 
model based on the equation c+(d-c)/(1+exp(b(x-e))), to your data (below named 'simone'):


## Fitting a 4-parameter logistic model (also called Boltzmann model)
simone.m1 <- drm(size~x, data=simone, fct=B.4())

## Plotting the data together with the fitted curve
plot(simone.m1, log="")


The fit is not great due to the bend.


Christian
#
Dear Christian,

it works great, and it is simple to understand, thank you very much.

just a detail, is it possible to plot just the fitted curve and not  
the data? it's because I would like to have data in black and the  
fitted curve in red.. I don't know how to pick up the single parts, if  
I simply wrote
everything became red..

thank in advance,
Simone


Il giorno 06/dic/07, alle ore 09:00, Christian Ritz ha scritto:
#
Dear Christian,

it works great, and it is simple to understand, thank you very much.

just a detail, is it possible to plot just the fitted curve and not  
the data? it's because I would like to have data in black and the  
fitted curve in red.. I don't know how to pick up the single parts, if  
I simply wrote
everything became red..

thank in advance,
Simone


Il giorno 06/dic/07, alle ore 09:00, Christian Ritz ha scritto: