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

View source: R/binary_link.R

binaryLinkR Documentation

Used with supcluster when the outcome data object is binary

Description

Calculates the log-likelihood for a logistic model with log-odds μ+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 μ calculates the log-likelihood

Author(s)

David Alan Schoenfeld

Examples

#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)
  }

supcluster documentation built on May 20, 2022, 1:07 a.m.