Learn R Programming

supcluster (version 1.0.1)

binaryLink: Used with supcluster when the outcome data object is binary

Description

Calculates the log-likelihood for a logistic model with log-odds \(\mu+x\) where \(x\) is a frailty

Usage

binaryLink(x)

Arguments

x

A vector of binary data with values of 0 and 1 or TRUE, FALSE

Value

A function that given a vector of frialties followed by a value of \(\mu\) calculates the log-likelihood

Examples

Run this code
# NOT RUN {
#Note the number of iterations is small to control run time
generatedData=generate.cluster.data(.25,npats=25,clusts=c(12,8),beta=c(-5,5),
                                    outcomeModel=binaryOutcome(0))
usBinary=supcluster(generatedData[[1]],outcome="outcome",
maxclusters=5,nstart=100,n=200,fbeta=FALSE,
linkLikelihood=binaryLink(generatedData[[2]]))
## The function is currently defined as
function (x) 
{
    m = length(x)
    outfcn = function(parm2) {
        bx = parm2[m + 1] + parm2[1:m]
        loglik = sum(x * bx) - sum(log(1 + exp(bx)))
        return(loglik)
    }
    return(outfcn)
  }
# }

Run the code above in your browser using DataLab