The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

semnova

Vignette Author

2020-06-18

Using the semnova() function

This is a simple example how to use semnova() function.

library(semnova)

set.seed(323412431)

data("semnova_test_data", package = "semnova")

idata <- expand.grid(A = c("A1", "A2", "A3"), B = c("B1", "B2"))

mmodel <- create_mmodel(
    A1B1 = "var1",
    A2B1 = "var2",
    A3B1 = "var3",
    A1B2 = "var4",
    A2B2 = "var5",
    A3B2 = "var6",
    lv_scaling = "referent"
)

fit_semnova <-
    semnova(
        formula = cbind(A1B1, A2B1, A3B1, A1B2, A2B2, A3B2) ~ 1,
        data = semnova_test_data,
        idata = idata,
        idesign = ~ A * B,
        mmodel = mmodel
    )

summary(fit_semnova)
#> ------------------------------------------
#> 
#> term: (Intercept)
#> 
#> Response transformation matrix:
#>       (Intercept)
#> A1.B1     0.40825
#> A2.B1     0.40825
#> A3.B1     0.40825
#> A1.B2     0.40825
#> A2.B2     0.40825
#> A3.B2     0.40825
#> 
#> multiv. tests:
#>       Df test stat approx F num Df den Df Pr(>F)
#> Wald   1   0.09447 0.094467      1     99 0.7592
#> Wilks  1   0.99906 0.093522      1     99 0.7604
#> 
#> univ. test:
#>         Sum Sq num Df Error SS den Df F value Pr(>F)
#> F-test 0.30923      1   327.35     99  0.0935 0.7604
#> 
#> ------------------------------------------
#> 
#> term: A
#> 
#> Response transformation matrix:
#>         A1       A2
#> A1.B1 -0.5  0.28868
#> A2.B1  0.0 -0.57735
#> A3.B1  0.5  0.28868
#> A1.B2 -0.5  0.28868
#> A2.B2  0.0 -0.57735
#> A3.B2  0.5  0.28868
#> 
#> multiv. tests:
#>       Df test stat approx F num Df den Df Pr(>F)
#> Wald   2    3.4527   1.7264      2    198 0.1806
#> Wilks  1    0.9666   1.6919      2     98 0.1895
#> 
#> univ. test:
#>        Sum Sq num Df Error SS den Df F value Pr(>F)
#> F-test  1.628      2   94.479    198  1.7059 0.1843
#> 
#> ------------------------------------------
#> 
#> term: B
#> 
#> Response transformation matrix:
#>             B1
#> A1.B1 -0.40825
#> A2.B1 -0.40825
#> A3.B1 -0.40825
#> A1.B2  0.40825
#> A2.B2  0.40825
#> A3.B2  0.40825
#> 
#> multiv. tests:
#>       Df test stat approx F num Df den Df Pr(>F)
#> Wald   1   0.26776  0.26776      1     99 0.6060
#> Wilks  1   0.99733  0.26509      1     99 0.6078
#> 
#> univ. test:
#>         Sum Sq num Df Error SS den Df F value Pr(>F)
#> F-test 0.15035      1   56.151     99  0.2651 0.6078
#> 
#> ------------------------------------------
#> 
#> term: A:B
#> 
#> Response transformation matrix:
#>       A1:B1    A2:B1
#> A1.B1   0.5 -0.28868
#> A2.B1   0.0  0.57735
#> A3.B1  -0.5 -0.28868
#> A1.B2  -0.5  0.28868
#> A2.B2   0.0 -0.57735
#> A3.B2   0.5  0.28868
#> 
#> multiv. tests:
#>       Df test stat approx F num Df den Df Pr(>F)
#> Wald   2   1.05674  0.52837      2    198 0.5904
#> Wilks  1   0.98954  0.51780      2     98 0.5974
#> 
#> univ. test:
#>        Sum Sq num Df Error SS den Df F value Pr(>F)
#> F-test 0.5627      2   104.34    198  0.5339 0.5872
#> 
#> ------------------------------------------

Using the lgc() function

This is a simple example how to use lgc() function.

library(semnova)

set.seed(323412431)

data("semnova_test_data", package = "semnova")

mmodel <- create_mmodel(
    A1B1 = "var1",
    A2B1 = "var2",
    A3B1 = "var3",
    A1B2 = "var4",
    A2B2 = "var5",
    A3B2 = "var6",
    lv_scaling = "referent"
)

hypotheses <- list(
    Intercept = c(1),
    A        = c(2, 3),
    B        = c(4),
    AB       = c(5, 6)
)

C_matrix <- matrix(
    c(
        1, 1, 0, 1, 1, 0,
        1, 0, 1, 1, 0, 1,
        1,-1,-1, 1,-1,-1,
        1, 1, 0,-1,-1, 0,
        1, 0, 1,-1, 0,-1,
        1,-1,-1,-1, 1, 1
    ),
    nrow = 6
)

fit_lgc <-
    lgc(
        data = semnova_test_data,
        mmodel = mmodel,
        C_matrix = C_matrix,
        hypotheses = hypotheses
    )

summary(fit_lgc)
#> ------------------------------------------
#> 
#> term: Intercept
#> 
#> Response transformation matrix:
#>   V1
#> 1  1
#> 2  1
#> 3  1
#> 4  1
#> 5  1
#> 6  1
#> 
#> multiv. tests:
#>       Df test stat approx F num Df den Df Pr(>F)
#> Wald   1   0.09447 0.094467      1     99 0.7592
#> Wilks  1   0.99906 0.093522      1     99 0.7604
#> 
#> ------------------------------------------
#> 
#> term: A
#> 
#> Response transformation matrix:
#>   V1 V2
#> 1  1  0
#> 2  0  1
#> 3 -1 -1
#> 4  1  0
#> 5  0  1
#> 6 -1 -1
#> 
#> multiv. tests:
#>       Df test stat approx F num Df den Df Pr(>F)
#> Wald   2    3.4527   1.7264      2    198 0.1806
#> Wilks  1    0.9666   1.6919      2     98 0.1895
#> 
#> ------------------------------------------
#> 
#> term: B
#> 
#> Response transformation matrix:
#>   V1
#> 1  1
#> 2  1
#> 3  1
#> 4 -1
#> 5 -1
#> 6 -1
#> 
#> multiv. tests:
#>       Df test stat approx F num Df den Df Pr(>F)
#> Wald   1   0.26776  0.26776      1     99 0.6060
#> Wilks  1   0.99733  0.26509      1     99 0.6078
#> 
#> ------------------------------------------
#> 
#> term: AB
#> 
#> Response transformation matrix:
#>   V1 V2
#> 1  1  0
#> 2  0  1
#> 3 -1 -1
#> 4 -1  0
#> 5  0 -1
#> 6  1  1
#> 
#> multiv. tests:
#>       Df test stat approx F num Df den Df Pr(>F)
#> Wald   2   1.05674  0.52837      2    198 0.5904
#> Wilks  1   0.98954  0.51780      2     98 0.5975
#> 
#> ------------------------------------------

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.