Learn R Programming

supcluster (version 1.0.1)

binaryOutcome: Simulates a binary model for use with generate.cluster.data

Description

Given a vector of frailties, say \(x_1,...\) it creates a binary variable from a logistic model with log odds ratio \(\mu + x\)

Usage

binaryOutcome(mu)

Arguments

mu

Constant term \(\mu \)

Value

A vector of binary variables.

Examples

Run this code
# NOT RUN {
generatedData=generate.cluster.data(.25,npats=25,clusts=c(12,8),beta=c(-5,5),
                                    outcomeModel=binaryOutcome(0))
## The function is currently defined as
function (mu) 
{
    outpt = function(x) {
        m = length(x)
        p = exp(mu + x)/(1 + exp(mu + x))
        return(rbinom(m, 1, p))
    }
    return(outpt)
  }
# }

Run the code above in your browser using DataLab