The `boot`

package, which comes shipped with R base, will be used for bootstrapping the odds ratio.

- Get the
`boot`

package using`library(boot)`

.The

`boot`

package is shipped with the R software itself, and thus it does not require separate installation. The main components for the`boot`

function will be soon explained. - Define the odds-ratio function:
OR <- function(data,i) { x <- data[,1]; y <- data[,2] odds.ratio <- (sum(x[i]==1,na.rm=TRUE)/length(na.omit(x[i])))/ (sum(y[i]==1,na.rm=TRUE)/length(na.omit(y[i]))) return(odds.ratio) }

The

`OR`

name stands, of course, for odds-ratio.`data`

for this function consists of two columns, one of which may have more observations than the other. The option`na.rm`

is ...

Start Free Trial

No credit card required