diff --git a/DESCRIPTION b/DESCRIPTION index 7bab12c..34de767 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,8 +2,8 @@ Encoding: UTF-8 Package: RSA Type: Package Title: Response Surface Analysis -Version: 0.9.9 -Date: 2015-04-13 +Version: 0.9.10 +Date: 2016-02-22 Author: Felix Schönbrodt Maintainer: Felix Schönbrodt Description: Advanced response surface analysis. The main function RSA computes diff --git a/R/RSA.R b/R/RSA.R index 8a608e9..188052f 100644 --- a/R/RSA.R +++ b/R/RSA.R @@ -27,7 +27,7 @@ #' @param models A vector with names of all models that should be computed. Should be any from \code{c("absdiff", "absunc", "diff", "mean", "additive", "IA", "SQD", "RR", "SRR", "SRRR", "SSQD", "SRSQD", "full", "null", "onlyx", "onlyy", "onlyx2", "onlyy2")}. For \code{models="all"}, all models are computed, for \code{models="default"} all models besides absolute difference models are computed. #' @param cubic Should a cubic model with the additional terms Y^3, XY^2, YX^2, and X^3 be included? WARNING: This is experimental, and not all functions will treat the cubic extension properly yet. #' @param control.variables A string vector with variable names from \code{data}. These variables are added as linear predictors to the model (in order "to control for them"). No interactions with the other variables are modeled. WARNING: This feature is not implemented yet! -#' @param estimator Type of estimator that should be used by lavaan. Defaults to "MLR", which provides robust standard errors, a robust scaled test statistic, and can handle missing values. +#' @param estimator Type of estimator that should be used by lavaan. Defaults to "MLR", which provides robust standard errors, a robust scaled test statistic, and can handle missing values. If you want to reproduce standard OLS estimates, use \code{estimator="ML"} and \code{se="standard"} #' @param se Type of standard errors. This parameter gets passed through to the \code{sem} function of the \code{lavaan} package. See options there. By default, robust SEs are computed. If you use \code{se="boot"}, \code{lavaan} provides CIs and p-values based on the bootstrapped standard error. If you use \code{confint(..., method="boot")}, in contrast, you get CIs and p-values based on percentile bootstrap (see also \code{\link{confint.RSA}}). #' @param missing Handling of missing values. By default (\code{NA}), Full Information Maximum Likelihood (FIML) is employed in case of missing values. If cases with missing values should be excluded, use \code{missing = "listwise"}. #' @param ... Additional parameters passed to the \code{lavaan} \code{\link{sem}} function. @@ -416,7 +416,7 @@ withCallingHandlers({ "PA1.curv := b3 - b4*p11 + b5*(p11^2)", "PA2.curv := b3 - b4*p21 + b5*(p21^2)", "meaneffect := a1", - "C := (b2-b1) / (4*b3)", + "C := (b1-b2) / (4*b3)", # eigenvalues "l1 := (b3 + b5 + sqrt((b3+b5)^2 - 4*b3*b5 + b4^2))/2", "l2 := (b3 + b5 - sqrt((b3+b5)^2 - 4*b3*b5 + b4^2))/2", diff --git a/R/compare.R b/R/compare.R index 04bb72c..f0ea771 100644 --- a/R/compare.R +++ b/R/compare.R @@ -33,7 +33,7 @@ compare <- function(x, verbose=TRUE, plot=FALSE, digits=3, ...) { cat("-------------------------------------------------------------------------\n") } - res1 <- cModels(list(cubic=cubic, full=full, IA=IA, additive=additive, diff=diff, null=null), set="directed", free.max) + res1 <- cModels(mL=list(cubic=cubic, full=full, IA=IA, additive=additive, diff=diff, null=null), set="directed", free.max=free.max) if (verbose==TRUE & !is.null(res1)) { cat("Testing directed difference models: Interaction, additive main effects, difference model :\n") cat("-------------------------------------------------------------------------\n") diff --git a/R/helpers.R b/R/helpers.R index 869475a..12acac0 100644 --- a/R/helpers.R +++ b/R/helpers.R @@ -64,7 +64,8 @@ anovaList <- function(modellist) { paste("force(mods[[",x,"]])",sep = "") } }) - pStr2 <- paste0("anova(", paste(pStr, collapse=", "), ")") + #pStr2 <- paste0("lavTestLRT(", paste(pStr, collapse=", "), ", method='satorra.bentler.2010')") + pStr2 <- paste0("lavTestLRT(", paste(pStr, collapse=", "), ", method='default')") a1 <- eval(parse(text = pStr2)) @@ -89,10 +90,14 @@ cModels <- function(mL, set, free.max) { R <- inspect(X, "r2") names(R) <- "R2" n <- lavaan::nobs(X) - k <- free.max - F["df"] - R2.p <- ifelse(k==0, - NA, - pf(((n-k-1)*R)/(k*(1-R)), k, n-k-1, lower.tail=FALSE)) + k <- free.max - F["df"] + + suppressWarnings({ + R2.p <- ifelse(k==0, + NA, + pf(((n-k-1)*R)/(k*(1-R)), k, n-k-1, lower.tail=FALSE)) + }) + names(R2.p) <- "R2.p" # compute AICc diff --git a/cran-comments.md b/cran-comments.md index 585606b..05f44e9 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -4,8 +4,7 @@ * win-builder (devel and release) ## R CMD check results -There were no ERRORs, WARNINGs, or NOTEs. - +There were no ERRORs, WARNINGs, or relevant NOTEs. ## Downstream dependencies None. \ No newline at end of file diff --git a/inst/News.Rd b/inst/News.Rd index a7e9b31..d274a93 100644 --- a/inst/News.Rd +++ b/inst/News.Rd @@ -3,6 +3,19 @@ \encoding{UTF-8} +\section{Version 0.9.10}{ + + + +\subsection{Bug fixes}{ + \itemize{ + \item Fixed a wrong sign in the C parameter of the SRR model (thanks to Sarah Humberg for detecting the bug.) + } +} + +} + + \section{Version 0.9.9}{ diff --git a/man/RSA.Rd b/man/RSA.Rd index 8adea14..d96ffb1 100644 --- a/man/RSA.Rd +++ b/man/RSA.Rd @@ -32,7 +32,7 @@ RSA(formula, data = NULL, center = FALSE, scale = FALSE, na.rm = FALSE, \item{add}{Additional syntax that is added to the lavaan model. Can contain, for example, additional constraints, like "p01 == 0; p11 == 0"} -\item{estimator}{Type of estimator that should be used by lavaan. Defaults to "MLR", which provides robust standard errors, a robust scaled test statistic, and can handle missing values.} +\item{estimator}{Type of estimator that should be used by lavaan. Defaults to "MLR", which provides robust standard errors, a robust scaled test statistic, and can handle missing values. If you want to reproduce standard OLS estimates, use \code{estimator="ML"} and \code{se="standard"}} \item{se}{Type of standard errors. This parameter gets passed through to the \code{sem} function of the \code{lavaan} package. See options there. By default, robust SEs are computed. If you use \code{se="boot"}, \code{lavaan} provides CIs and p-values based on the bootstrapped standard error. If you use \code{confint(..., method="boot")}, in contrast, you get CIs and p-values based on percentile bootstrap (see also \code{\link{confint.RSA}}).}