You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The vignette is coming along nicely. It would be nice to add one or two more substantive examples.
What comes to mind is an example of a linear hypothesis, $\mathbf{C} \mathbf{B} = \mathbf{0}$, but
spelled out using latexMatrix().
Here's one I worked out by hand before we did the symbolic stuff: A MLM with three $y$ s and 3 $x$ s,
testing whether neither $x_2$ and $x_3$ contribute
Hi,
I think that prefix.row and prefix.col are nice additions. I'd put them
below suffix because it seem sensible to me for the prefix and suffix
args to be together.
Also, maybe we should get rid of the lhs argument. Can't what it does be
done directly in Eqn()?
John
On 2024-08-19 8:15 p.m., Phil Chalmers wrote:
Caution: External email.
I had to push a |prefix.col| and |prefix.row| arg to |latexMatrix()|,
but this will do it:
|Eqn("\\mathcal{H}_0 : \\mathbf{C} \\mathbf{B} & = ",
latexMatrix(matrix(c(0,1,1,0), nrow=1)), latexMatrix('\\beta', ncol = 3,
nrow=4, comma=TRUE, prefix.col = 'y_'), Eqn_newline(), Eqn_newline(),
latexMatrix('\\beta', ncol = 3, nrow=2, comma=TRUE, prefix.col = 'y_',
lhs = '&' ), "= \\mathbf{0}_{(2 \\times 3)}", align=TRUE) |
—
Reply to this email directly, view it on GitHub <https://github.com/friendly/matlib#57#issuecomment-2297733457>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/
ADLSAQUYXZYIMOR3RLRD4MLZSKDCVAVCNFSM6AAAAABMYO7BW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJXG4ZTGNBVG4>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
I fleshed out this example in the vignette. However there's a slight problem with the intercept in terms of with how the context is described, and what can be represented in this form using latexMatrix.
Note in my manual example, I included the intercept as row 1 of B.
I simplified Phil's example a bit for sake of exposition:
But, if I try to start the rows of \beta at zero I get an error:
> B <- latexMatrix('\\beta', ncol = 3, nrow=4,
+ zero.based = c(TRUE, FALSE),
+ comma=TRUE, prefix.col = 'y_')
Error in latexMatrix("\\beta", ncol = 3, nrow = 4, zero.based = c(TRUE, :
zero-based indexing not available for numeric 'nrow'
I don't want to push this too far to require more mods or extra arguments for the sake of this example, but I don't see why numeric rows/cols can't be zero-based.
A less-than-general alternative is to simplify the description of a linear hypothesis by ignoring the intercept.
On 2024-08-20 8:04 a.m., Michael Friendly wrote:
Caution: External email.
I fleshed out this example in the vignette. However there's a slight
problem with the intercept in terms of with how the context is
described, and what can be represented in this form using |latexMatrix|.
Note in my manual example, I included the intercept as row 1 of B.
I simplified Phil's example a bit for sake of exposition:
|C <- latexMatrix(matrix(c(0,1,1,0), nrow=1), matrix = "bmatrix") B <-
latexMatrix('\\beta', ncol = 3, nrow=4, comma=TRUE, prefix.col = 'y_')
B0 <- latexMatrix('\\beta', ncol = 3, nrow=2, comma=TRUE, prefix.col =
'y_') Eqn("\\mathcal{H}_0 : \\mathbf{C} \\mathbf{B} & = ", C, B,
Eqn_newline(), Eqn_newline(), '&\n', B0, "= \\mathbf{0}_{(2 \\times
3)}", align=TRUE) |
Which typesets as:
image.png (view on web) <https://github.com/user-attachments/
assets/232557c7-49b7-4ef7-89db-def5b5d7ae19>
But, if I try to start the rows of |\beta| at zero I get an error:
|> B <- latexMatrix('\\beta', ncol = 3, nrow=4, + zero.based = c(TRUE,
FALSE), + comma=TRUE, prefix.col = 'y_') Error in latexMatrix("\\beta",
ncol = 3, nrow = 4, zero.based = c(TRUE, : zero-based indexing not
available for numeric 'nrow' |
I don't want to push this too far to require more mods or extra
arguments for the sake of this example, but I don't see why numeric
rows/cols can't be zero-based.
I believe that using zero-based indexing with numeric dimensions causes
a problem with the dim slot of the object.
I can look into this but probably not today. Alternatively, you could
try to fix it -- I think that the code is pretty straightforward.
John
Hi, I think that prefix.row and prefix.col are nice additions. I'd put them below suffix because it seem sensible to me for the prefix and suffix args to be together. Also, maybe we should get rid of the lhs argument. Can't what it does be done directly in Eqn()? John
I agree with removal of the lhs argument. Using it in longer, more structured presentation feels a little awkward.
On 2024-08-20 12:31 p.m., Phil Chalmers wrote:
Caution: External email.
Hi, I think that prefix.row and prefix.col are nice additions. I'd
put them below suffix because it seem sensible to me for the prefix
and suffix args to be together. Also, maybe we should get rid of the
lhs argument. Can't what it does be done directly in Eqn()? John
I agree with removal of the |lhs| argument. Using it in longer, more
structured presentation feels a little awkward.
—
Reply to this email directly, view it on GitHub <https://github.com/friendly/matlib#57#issuecomment-2299277580>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/
ADLSAQX7Q5BV5SAD67SF7LLZSNVONAVCNFSM6AAAAABMYO7BW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJZGI3TONJYGA>.
You are receiving this because you commented.Message ID: <friendly/
***@***.***>
I was able to get this done today, that is, to allow 0-based indexing
with matrices with numeric dimensions. AFAICS everything works OK but
should be tested more.
John
A thought: Rather than using functions to add things like a newline, might it be more natural to export a variable -- something like Eqn_newline with contents ' \\\\ \n' instead?
Hi John,
I've been thinking about this as well, and will likely work on some type of
string parser to use in character inputs to Eqn(). I'll keep you posted
since I'll likely need some early feedback.
Phil
@john-d-fox The change to allow zero-based matrices with numeric dimensions works perfectly for my example, and is useful generally. Does it screw up anything with the dim slot?
No, as long as you're happy with, say, a matrix with indices 0:4, 0:3
having dimension 5, 4.
I did a few tests of arithmetic, etc., which seemd to work OK. As I
said, more tests wouldn't hurt.
John
Activity
philchalmers commentedon Aug 20, 2024
I had to push a
prefix.colandprefix.rowarg tolatexMatrix(), but this will do it:friendly commentedon Aug 20, 2024
Beautiful! Thanks so much.
I wonder if this might be of enough general use for a
linear_hypothesis()function, at least for the C B = part,also giving the result of C %*% B?
john-d-fox commentedon Aug 20, 2024
friendly commentedon Aug 20, 2024
I fleshed out this example in the vignette. However there's a slight problem with the intercept in terms of with how the context is described, and what can be represented in this form using
latexMatrix.Note in my manual example, I included the intercept as row 1 of B.
I simplified Phil's example a bit for sake of exposition:
Which typesets as:
But, if I try to start the rows of
\betaat zero I get an error:I don't want to push this too far to require more mods or extra arguments for the sake of this example, but I don't see why numeric rows/cols can't be zero-based.
A less-than-general alternative is to simplify the description of a linear hypothesis by ignoring the intercept.
john-d-fox commentedon Aug 20, 2024
friendly commentedon Aug 20, 2024
I'll try, but we're going out for the aft. here.
philchalmers commentedon Aug 20, 2024
I agree with removal of the
lhsargument. Using it in longer, more structured presentation feels a little awkward.john-d-fox commentedon Aug 20, 2024
john-d-fox commentedon Aug 20, 2024
friendly commentedon Aug 20, 2024
I suppose that what was intended by removing the
lhsarg is just to specifyone as one of the ... args to
Eqn(), as inI note that
Eqn_hspace()has alhsarg, but I don't quite understand what is intended.The other functions documented with
Eqn()should be at least mentioned in the Descriptionphilchalmers commentedon Aug 21, 2024
Hi Michael,
Eqn_hspace()can be used to add general spaces uses LaTeX convention or apply symmetric spacing around a middle point, most often symbols such as '='.john-d-fox commentedon Aug 21, 2024
A thought: Rather than using functions to add things like a newline, might it be more natural to export a variable -- something like
Eqn_newlinewith contents' \\\\ \n'instead?philchalmers commentedon Aug 21, 2024
friendly commentedon Aug 21, 2024
@john-d-fox The change to allow zero-based matrices with numeric dimensions works perfectly for my example, and is useful generally. Does it screw up anything with the dim slot?
john-d-fox commentedon Aug 21, 2024
friendly commentedon Aug 22, 2024
That seems reasonable