# Equations and matrices in a hypr object are always congruent
# Therefore creating a hypr object h and then copying ...
h <- hypr(mu1~0, mu2~mu1)
# ... its equations, ...
h2 <- hypr()
formula(h2) <- formula(h)
# ... its hypothesis matrix, ...
h3 <- hypr()
hmat(h3) <- hmat(h)
# ... or its contast matrix ...
h4 <- hypr()
cmat(h4) <- cmat(h)
# ... over to another hypr object is the same as copying the object:
h5 <- h
# check that hypr objects are equal by comparing hmat() and cmat()
stopifnot(all.equal(hmat(h), hmat(h2)))
stopifnot(all.equal(cmat(h), cmat(h2)))
stopifnot(all.equal(hmat(h), hmat(h3)))
stopifnot(all.equal(cmat(h), cmat(h3)))
stopifnot(all.equal(hmat(h), hmat(h4)))
stopifnot(all.equal(cmat(h), cmat(h4)))
stopifnot(all.equal(hmat(h), hmat(h5)))
stopifnot(all.equal(cmat(h), cmat(h5)))
h <- hypr(mu1~0, mu2~mu1)
formula(h)
h2 <- hypr()
formula(h2) <- formula(h)
h2
formula(h2)
# After updating, matrices should be equal
stopifnot(all.equal(hmat(h), hmat(h2)))
stopifnot(all.equal(cmat(h), cmat(h2)))
Run the code above in your browser using DataLab