R Under development (unstable) (2025-10-16 r88927 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > library("mlt") Loading required package: basefun Loading required package: variables > options(digits = 4) > > set.seed(28) > n <- 100 > g <- gl(2, n) > y <- rnorm(length(g), mean = c(2, 1)[g], sd = c(.5, 1.5)[g]) > mydata <- data.frame(g = g, y = y) > > by <- polynomial_basis(numeric_var("y", support = range(y)), coef = c(1, 1), ci = c(-Inf, 0)) > m1 <- ctm(by, interacting = as.basis(~ g - 1, data = mydata)) > fm1 <- mlt(m1, data = mydata) > logLik(fm1) 'log Lik.' -259.6 (df=4) > vcov(fm1) (Intercept):g1 y:g1 (Intercept):g2 y:g2 (Intercept):g1 0.08823 -0.03936 0.000000 0.000000 y:g1 -0.03936 0.01980 0.000000 0.000000 (Intercept):g2 0.00000 0.00000 0.010911 -0.001366 y:g2 0.00000 0.00000 -0.001366 0.002048 > cf1 <- coef(fm1) > 1 / cf1[c(2, 4)] y:g1 y:g2 0.5025 1.5626 > -cf1[c(1, 3)] / cf1[c(2,4)] (Intercept):g1 (Intercept):g2 1.9878 0.6672 > > ### no constraints here! > m2 <- ctm(by, interacting = as.basis(~ g, data = mydata)) > fm2 <- mlt(m2, data = mydata) > logLik(fm2) 'log Lik.' -259.6 (df=4) > vcov(fm2) (Intercept):(Intercept) y:(Intercept) (Intercept):g2 (Intercept):(Intercept) 0.08823 -0.03936 -0.08823 y:(Intercept) -0.03936 0.01980 0.03936 (Intercept):g2 -0.08823 0.03936 0.09914 y:g2 0.03936 -0.01980 -0.04072 y:g2 (Intercept):(Intercept) 0.03936 y:(Intercept) -0.01980 (Intercept):g2 -0.04072 y:g2 0.02185 > (cf2 <- coef(fm2)) (Intercept):(Intercept) y:(Intercept) (Intercept):g2 -3.956 1.990 3.529 y:g2 -1.350 > c(cf1[1:2], cf1[3:4] - cf1[1:2]) (Intercept):g1 y:g1 (Intercept):g2 y:g2 -3.956 1.990 3.529 -1.350 > > 1 / cf2[2] y:(Intercept) 0.5025 > 1 / sum(cf2[c(2, 4)]) [1] 1.563 > > -cf2[1] / cf2[2] (Intercept):(Intercept) 1.988 > -sum(cf2[c(1, 3)]) / sum(cf2[c(2, 4)]) [1] 0.6672 > > proc.time() user system elapsed 1.73 0.37 2.10