R/corr.nn4pbo.R

Defines functions corr.nn4pbo

Documented in corr.nn4pbo

corr.nn4pbo<-function(lam, p, PO.cor=NULL){

x=rnorm(100000,0,1) ##underlying ordinal variable
xcdf=pnorm(x) ##obtain cdf of x

o=rep(0, length(x))
for(i in 1:length(x)){
for(j in 1:length(p)){
if(xcdf[i]>p[j]){o[i]=j}
}}

cxo=cor(x,o) 
cor.xp=PO.cor/cxo

y=rnorm(100000,0,1)
ypois=qpois(pnorm(y),lam)

corrected=cor.xp/cor(ypois,y)
return(corrected)
}

Try the PoisBinOrdNor package in your browser

Any scripts or data that you put into this service are public.

PoisBinOrdNor documentation built on March 22, 2021, 9:08 a.m.