Travis-CI Build Status

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)
library(gnlrim)
dose <- c(c(9,12,4,9,11,10,2,11,12,9,9,9,4,9,11,9,14,7,9,8), 3+c(9,12,4,9,11,10,2,11,12,9,9,9,4,9,11,9,14,7,9,8))
y_01 <- rep(as.numeric(c(8.674419, 11.506066, 11.386742, 27.414532, 12.135699,  4.359469,
                         1.900681, 17.425948,  4.503345,  2.691792,  5.731100, 10.534971,
                         11.220260,  6.968932,  4.094357, 16.393806, 14.656584,  8.786133,
                         20.972267, 17.178012) > 4),2)
id <- rep(1:8, each=5)

y_cbind = cbind(y_01, 1-y_01)

R-package gnlrim: Generalized Non-Linear Random Intercept Models

The goal of gnlrim is to have a freestanding, smaller footprint instance of repeated::gnlmix(). That is, I took the minimum amount of code from rmutil and repeated to get gnlmix working so that gnlrim did not require dependence/imports from rmutil and repeated. I am going to be making edits on gnlmix() to transform it into gnlrim() so that it is basically gnlmix() with the added functionality:

Example

This is a basic example which shows you how to solve a common problem:

## basic example code

Errors and Their (Potential) Fixes

   Likelihood returns Inf or NAs: invalid initial values, wrong model, or probabilities too small to calculate

This is sometimes due to not using a named lists for pmu and pmix.

## without named lists for `pmu` and `pmix`:
# fit_PPN_err <- gnlrim(y=y_cbind,
#                       mu=~pnorm(a+b*dose+rand),
#                       pmu=c(0,0),
#                       pmix=0.5,
#                       p_uppb = c(Inf ,  Inf,   1-1e-5),
#                       p_lowb = c(-Inf, -Inf,   0+1e-5),
#                       distribution="binomial",
#                       nest=id,
#                       random="rand",
#                       mixture="normal-phi")
# Error in gnlrim(y = y_cbind, mu = ~pnorm(a + b * dose + rand), pmu = c(0,  : 
#   Likelihood returns Inf or NAs: invalid initial values, wrong model, or probabilities too small to calculate

## with named lists for `pmu` and `pmix`:
fit_PPN_fix <- gnlrim(y=y_cbind,
                      mu=~pnorm(a+b*dose+rand),
                      pmu=c(a=0,b=0),
                      pmix=c(phi=0.5),
                      p_uppb = c(Inf ,  Inf,   1-1e-5),
                      p_lowb = c(-Inf, -Inf,   0+1e-5),
                      distribution="binomial",
                      nest=id,
                      random="rand",
                      mixture="normal-phi")
## a, b, phi:
fit_PPN_fix$coeff


swihart/gnlrim documentation built on Oct. 18, 2023, 8:29 p.m.