[R] help with R

John Fox jfox at mcmaster.ca
Sun Jun 13 03:09:03 CEST 2010


Dear Hannah,

If I understand you correctly, you want a solution when rho is 0.5; if so,

> f <- function(x){
+   pnorm(-x)*pnorm((0.5*dnorm(x)/pnorm(x)-x)/sqrt(1-0.5^2)) - 0.05
+ }

> uniroot(f, c(-3, 3))

$root
[1] 0.8031289

$f.root
[1] -1.565857e-06

$iter
[1] 11

$estim.prec
[1] 6.103516e-05

I hope this helps,
 John

--------------------------------
John Fox
Senator William McMaster 
  Professor of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
> Behalf Of li li
> Sent: June-12-10 8:31 PM
> To: r-help
> Subject: [R] help with R
> 
> Hi all,
>    I want to solve the following equation for x with rho <- 0.5
> 
>    pnorm(-x)*pnorm((rho*dnorm(x)/pnorm(x)-x)/sqrt(1-rho^2))==0.05
> 
>    Is there a function in R to do this?
> 
>       Thank you very much!
>                                          Hannah
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.



More information about the R-help mailing list