Skip to content

Commit

Permalink
Small adjustments for CHECK
Browse files Browse the repository at this point in the history
- Some more namespace references
- FIX: win builder R CMD CHECK failed because it does not have
CompQuadForm and switches to saddle point, yielding a different p-value
(and failing the tests which leads to an ERROR)
  • Loading branch information
daob committed Nov 9, 2015
1 parent 9d80b44 commit 6e16a50
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,17 @@ Rene-Mayer/*
*.Rproj
*.bak
*.gz

muthen-example.R

croon_wide.dat

dk.example.multigroup.R

dk.example.R

lavaan.survey.R-bak

lavaan.survey.regression.R

ReadMe.txt
2 changes: 1 addition & 1 deletion lavaan.survey/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Description: Fit structural equation models (SEM) including factor analysis,
Incorporate clustering, stratification, sampling weights, and
finite population corrections into a SEM analysis.
Wrapper around packages lavaan and survey.
Depends: R(>= 2.14.0), lavaan(>= 0.5-20.901), survey(>= 3.30-3)
Depends: R(>= 2.14.0), lavaan(>= 0.5-20), survey(>= 3.30-3)
Imports: MASS
License: GPL (>=2)
URL: http://daob.nl/
Expand Down
5 changes: 4 additions & 1 deletion lavaan.survey/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ importFrom("lavaan",
lavInspect,
lavTech,
fitMeasures)

importFrom("stats",
as.formula,
cov,
median)
export("lavaan.survey")
export("pval.pFsum")
4 changes: 2 additions & 2 deletions lavaan.survey/R/lavaan.survey.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ lavaan.survey <-
any(eigen(Gamma.g, only.values=TRUE)$values < (.Machine$double.eps*100))
})
if(any(evs.too.small)) {
V.est <- vcov(new.fit)
V.est <- lavaan::vcov(new.fit)
if(any(Re(eigen(V.est, only.values=TRUE)$values) < (.Machine$double.eps*100))) {
long.string <- sprintf("Some of the standard errors may not be trustworthy.
Some of the observed covariances or means are
Expand All @@ -161,7 +161,7 @@ lavaan.survey <-
# Obtain residuals from a lavaan fit object, concatenating means w/ covariances
# (used in Yuan-Bentler correction)
get.residuals <- function(fit) {
r <- residuals(fit)
r <- lavaan::residuals(fit)
c(r$mean, lavaan::lav_matrix_vech(r$cov))
}

Expand Down
2 changes: 2 additions & 0 deletions lavaan.survey/tests/testthat/test_cardinale.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ test_that("scaled chi sq matches (MLMVS)", {
})

test_that("F test matches", {
skip_on_cran() # May not have CompQuadForm

expect_equal(pval.pFsum(fit.card.survey, survey.design = des.card), 0.609748, tolerance = 1e-5, check.attributes = FALSE)
expect_equal(pval.pFsum(fit.card.survey, survey.design = des.card, method="integration"), 0.6231761, tolerance = 1e-5, check.attributes = FALSE)
expect_equal(pval.pFsum(fit.card.survey, survey.design = des.card, method="satterthwaite")[1], 0.6079676, tolerance = 1e-5, check.attributes = FALSE)
Expand Down

0 comments on commit 6e16a50

Please sign in to comment.