Learn R Programming

ljr (version 1.1-0)

ljr02: Perform test of 0 vs 2 joinpoints.

Description

This function tests the null hypothesis of 0 joinpoints versus the alternative of two joinpoints based on the likelihood ratio test statistic. The p-value is determined by a Monte Carlo method.

Usage

ljr02(y,n,tm,X,ofst,R=1000,alpha=.05)

Arguments

y
the vector of Binomial responses.
n
the vector of sizes for the Binomial random variables.
tm
the vector of ordered observation times.
X
a design matrix containing other covariates.
ofst
a vector of known offsets for the logit of the response.
R
number of Monte Carlo simulations.
alpha
significance level of the test.

Value

  • pvalThe estimate of the p-value via simulation.
  • CoefA table of coefficient estimates.
  • JoinpointThe estimates of the joinpoint, if it is significant.
  • wlikThe maximum value of the re-weighted log-likelihood.

Details

The re-weighted log-likelihood is the log-likelihood divided by the largest component of n.

References

Czajkowski, M., Gill, R. and Rempala, G. (2007). Model selection in logistic joinpoint regression with applications to analyzing cohort mortality patterns. To appear.

See Also

ljr0,ljr2,ljrb2,ljrf2

Examples

Run this code
library(ljr,lib.loc='~/myrlibrary')
 N=20
 m=2
 k=2
 beta=c(0.1,0.1,-0.05)
 gamma=c(0.1,-0.05,0.05)
 tau=c(3.5,6.5)
 ofst=runif(N,-2.5,-1.5)
 x1=round(runif(N,-0.5,9.5))
 x2=round(runif(N,-0.5,9.5))
 X=cbind(x1,x2)
 n=rep(10000,N)
 tm=c(1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10)
 eta=ofst+beta[1]+gamma[1]*tm
 if (m>0)
 for (i in 1:m)
  eta=eta+beta[i+1]*X[,i]
 if (k>0)
  for (i in 1:k) 
   eta=eta+gamma[i+1]*pmax(tm-tau[i],0) 
 y=rbinom(N,size=n,prob=exp(eta)/(1+exp(eta)))
 temp.ljr=ljr02(y,n,tm,X,ofst,R=1000)

Run the code above in your browser using DataLab