Skip to content

Commit c25bd6a

Browse files
author
stevencarlislewalker
committed
bugs
1 parent 47430b3 commit c25bd6a

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

R/pirls.R

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pirls <- function(X,y,Zt,Lambdat,thfun,theta,
4141
if (is.function(family)) family <- family() # ensure family is a list
4242

4343
local({
44-
nth <- max(thfun(theta))
44+
nth <- length(theta)
4545
betaind <- -seq_len(nth) # indices to drop 1:nth
4646
linkinv <- family$linkinv
4747
variance <- family$variance
@@ -70,9 +70,9 @@ pirls <- function(X,y,Zt,Lambdat,thfun,theta,
7070
cvgd <- FALSE
7171
for(i in 1:npirls){
7272
# update w and muEta
73-
Whalf <- Diagonal(x=sqrt(weights/variance(mu)))
73+
Whalf <- Diagonal(x = sqrt(weights / variance(mu)))
7474
# update weighted design matrix
75-
LtZtMWhalf <- LtZt %*% (Diagonal(x=muEta(eta)) %*% Whalf)
75+
LtZtMWhalf <- LtZt %*% (Diagonal(x = muEta(eta)) %*% Whalf)
7676
# update Cholesky decomposition
7777
L <- update(L, LtZtMWhalf, 1)
7878
# alternative (more explicit but slower)
@@ -84,7 +84,7 @@ pirls <- function(X,y,Zt,Lambdat,thfun,theta,
8484
delu <- as.vector(solve(L, LtZtMWhalf %*% wtres - u))
8585
if (verbose > 0L) {
8686
cat(sprintf("inc: %12.4g", delu[1]))
87-
nprint <- min(5,length(delu))
87+
nprint <- min(5, length(delu))
8888
for (j in 2:nprint) cat(sprintf(" %12.4g", delu[j]))
8989
cat("\n")
9090
}

R/templateApproach.R

+5
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ mkTheta <- function(templates){
125125

126126

127127
##' Make random effects structures for the single correlation template model
128+
##'
129+
##' @param corr a correlation matrix template
130+
##' @param grp a grouping factor vector
131+
##' @param n sample size
128132
##' @export
129133
mkRanefStructuresCorr <- function(corr, grp, n){
130134
# create indicator matrix and order it
@@ -152,3 +156,4 @@ mkRanefStructuresCorr <- function(corr, grp, n){
152156
lower = 0, # lower and
153157
upper = Inf) # upper bounds on theta parameters
154158
}
159+

0 commit comments

Comments
 (0)