Simon Harmel
Simon Harmel

Reputation: 1489

Plotting the probability of being assigned to a group

There is a meaningful graph HERE (scroll down a bit) in this book that shows how the probability of assignment to a group in a study changes for a hypothetical continuous "X" (X-axis) variable.

I was wondering how (approximately) this function might be plotted in R?

enter image description here

Upvotes: 1

Views: 100

Answers (1)

jay.sf
jay.sf

Reputation: 73377

It's called the Sigmoid function.

f <- \(x, a, b, c) {a/(1 + b*c^-x)}
curve(f(x, a=1, b=1, c=.5), xlim=c(-10, 10), main='Sigmoids', col=4, lwd=2)
curve(exp(x)/(exp(x) + 1), xlim=c(-10, 10), col='orange', lwd=2, add=TRUE)
legend('right', legend=c('foo', 'logistic'), col=c(4, 'orange'), lwd=2)

enter image description here

Upvotes: 1

Related Questions