Skip to content

Commit

Permalink
pré 4.0-3 submission fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Lawrence committed Aug 7, 2012
1 parent 3b3b23e commit 52ef376
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 35 deletions.
6 changes: 4 additions & 2 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
4.0-3
- fixed bug in ezMixed when family=gaussian (default)
- changed author email address
- Fixed bug in ezMixed when family=gaussian (default)
- Fixed bug in ezMixed use of gam_args and mer_args
- Added ability to use bam instead of gam via argument to ezMixed
- Changed author email address

4.0-2
- updated .Rbuildignore to ignore .gitignore
Expand Down
87 changes: 54 additions & 33 deletions R/ezMixed.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function(
, gam_smooth = c('s','te')
, gam_bs = 'ts'
, gam_k = Inf
, use_bam = FALSE
, alarm = FALSE
, term_labels = NULL
, highest = Inf
Expand Down Expand Up @@ -187,35 +188,37 @@ function(
)
, '+'
)
if(is.null(covariates[covariates %in% numeric_covariates])){
formula_base = paste(
formula_base
, '+'
, paste(
gam_smooth[1]
,'('
, covariates[covariates %in% numeric_covariates]
, ',bs="'
, gam_bs
, '")'
, collapse = '+'
if(!is.null(covariates)){
if(!is.null(covariates[covariates %in% numeric_covariates])){
formula_base = paste(
formula_base
, '+'
, paste(
gam_smooth[1]
,'('
, covariates[covariates %in% numeric_covariates]
, ',bs="'
, gam_bs
, '")'
, collapse = '+'
, sep = ''
)
, '+'
, sep = ''
)
, '+'
, sep = ''
)
}
if(is.null(covariates[!(covariates %in% numeric_covariates)])){
formula_base = paste(
formula_base
, '+'
, paste(
covariates[!(covariates %in% numeric_covariates)]
, collapse = '+'
)
, '+'
, sep = ''
)
}
if(!is.null(covariates[!(covariates %in% numeric_covariates)])){
formula_base = paste(
formula_base
, '+'
, paste(
covariates[!(covariates %in% numeric_covariates)]
, collapse = '+'
)
, '+'
, sep = ''
)
}
}
}else{
formula_base = paste(
Expand Down Expand Up @@ -362,11 +365,21 @@ function(
fit <- withCallingHandlers(
{
eval(parse(text=paste(
"bam( formula ="
ifelse(
use_bam
, 'bam'
, 'gam'
)
, "( formula ="
, formula
, ", data = this_data , method = 'ML' "
, gam_args
, ", data = this_data , method = 'ML' , family = family"
, ifelse(
!is.null(gam_args)
, paste(',',gam_args)
, ''
)
, ")"
, sep = ''
)))
}
, warning = function(x) {w<<-c(w,x$message)}
Expand All @@ -378,20 +391,28 @@ function(
try(
fit <- withCallingHandlers(
{
if(identical(family,gaussian)|(family=='gaussian')){
if(!identical(family,gaussian)|identical(family,'gaussian')){
eval(parse(text=paste(
"lmer( formula = "
, formula
, ", data = this_data , REML = FALSE"
, mer_args
, ifelse(
!is.null(mer_args)
, paste(',',mer_args)
, ''
)
, ")"
)))
}else{
eval(parse(text=paste(
"glmer( formula ="
, formula
, ", data = this_data, family = family"
, mer_args
, ifelse(
!is.null(mer_args)
, paste(',',mer_args)
, ''
)
, ")"
)))
}
Expand Down
4 changes: 4 additions & 0 deletions man/ezMixed.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ ezMixed(
, gam_smooth = c('s','te')
, gam_bs = 'ts'
, gam_k = Inf
, use_bam = FALSE
, alarm = FALSE
, term_labels = NULL
, highest = Inf
Expand Down Expand Up @@ -67,6 +68,9 @@ Character specifying the name of the smooth term to use when using gam.
\item{gam_k}{
Numeric value specifying the maximum value for \code{k} to supply to calls to gam. Higher values yield longer computation times but may better capture non-linear phenomena. If set to \code{Inf} (default), \code{ezMixed} will automatically use the maximum possible value for k given the number of unique combinations of values in the numeric predictors being evaluated. If a finite positive value is supplied, k will be set to that value or less (if the supplied k exceeds the maximum possible k for a given effect).
}
\item{use_bam}{
Logical. If TRUE, \code{\link[mgcv]{bam}} is used rather than \code{\link[mgcv]{gam}}.
}
\item{alarm}{
Logical. If TRUE, call the \code{\link[utils]{alarm}} function when \code{\link{ezMixed}} completes.
}
Expand Down

0 comments on commit 52ef376

Please sign in to comment.