You don't need an equation solver. This is basic algebra.
The solution is:
X = (log(prob) - log(1 - prob) + 3.33) / 0.0102
Ravi.
----------------------------------------------------------------------------
-------
Ravi Varadhan, Ph.D.
Assistant Professor, The Center on Aging and Health
Division of Geriatric Medicine and Gerontology
Johns Hopkins University
Ph: (410) 502-2619
Fax: (410) 614-9625
Email: rvaradhan at jhmi.edu
Webpage:
http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h
tml
----------------------------------------------------------------------------
--------
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
Behalf Of Yash Gandhi
Sent: Thursday, September 10, 2009 3:35 PM
To: r-help at r-project.org
Subject: [R] function to solve equations
Hi,
I am trying to solve this equation prob = exp(-3.33 + 0.0102*x)/(1+exp(-3.33
+ 0.0102*x)). I want to write a function where I call the function and enter
the 'prob' value and the output should be the 'x'. Im not sure
how to write
this. I have a basic structure but im not sure if its correct.
calc <- function(prob){
prob <- exp(-3.33+0.0102*x)/(1+exp(-3.33 + 0.0102*x))
solve(prob)
x
}
Thanks
Yash Gandhi
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.