Giter Club home page Giter Club logo

Comments (8)

cdriveraus avatar cdriveraus commented on August 18, 2024 1

Thanks. I'll reduce the text size again :)

from ctsem.

emstruong avatar emstruong commented on August 18, 2024 1

it's a bit tricky yeah, you can output the tex directly by setting compile=F. But here is how I solved it for some blogdown posts: https://cdriver.netlify.app/post/dtbivariate/

```{r TEX,echo=FALSE,out.width='100%',out.height='100%', fig.align='left'}
ctModelLatex(model,textsize = 'small', folder=savedir,
  filename = 'dtbivariate',open=FALSE)

bitmap <- pdftools::pdf_render_page(paste0(savedir,'/dtbivariate.pdf'),dpi=72)
png::writePNG(bitmap, paste0(savedir,'/dtbivariate.png'))
knitr::include_graphics(paste0('dtbivariate.png'))

That solution works. (BTW, I couldn't help but mention that it's somewhat blurry on my browser... perhaps svg would be crisper?)

from ctsem.

emstruong avatar emstruong commented on August 18, 2024 1

to output just the equation and not the entire document, use the equationonly=TRUE argument.

D'oh!

from ctsem.

emstruong avatar emstruong commented on August 18, 2024

Is there any chance that the ctModelLatex() function could give something that I could copy-paste into a R-Markdown document as opposed to a separate pdf? Perhaps, the way equatiomatic does things? https://datalorax.github.io/equatiomatic/

I really appreciate the Latex functionality, makes interpreting the model a lot more approachable.

from ctsem.

cdriveraus avatar cdriveraus commented on August 18, 2024

it's a bit tricky yeah, you can output the tex directly by setting compile=F. But here is how I solved it for some blogdown posts:
https://cdriver.netlify.app/post/dtbivariate/

```{r TEX,echo=FALSE,out.width='100%',out.height='100%', fig.align='left'}
ctModelLatex(model,textsize = 'small', folder=savedir,
  filename = 'dtbivariate',open=FALSE)

bitmap <- pdftools::pdf_render_page(paste0(savedir,'/dtbivariate.pdf'),dpi=72)
png::writePNG(bitmap, paste0(savedir,'/dtbivariate.png'))
knitr::include_graphics(paste0('dtbivariate.png'))

from ctsem.

cdriveraus avatar cdriveraus commented on August 18, 2024

I couldn't figure out in 2 minutes what equatiomatic was really doing or how it would help, I gladly accept summaries (or pull requests hah) ;)

from ctsem.

emstruong avatar emstruong commented on August 18, 2024

I couldn't figure out in 2 minutes what equatiomatic was really doing or how it would help, I gladly accept summaries (or pull requests hah) ;)

So my understanding is that equatiomatic automatically transforms regression models into the sort of equation forms that you might find in a statistics textbook. So it's quite similar to what happens with ctModelLatex().

Although, as far as I can tell, it's different in that the latex it outputs can be directly copy-pasted into a R-markdown file like so:

$$
\begin{aligned}
  \operatorname{hamd}_{i}  &\sim N \left(\alpha_{j[i]} + \beta_{1j[i]}(\operatorname{time}), \sigma^2 \right) \\    
\left(
  \begin{array}{c} 
    \begin{aligned}
      &\alpha_{j} \\
      &\beta_{1j}
    \end{aligned}
  \end{array}
\right)
  &\sim N \left(
\left(
  \begin{array}{c} 
    \begin{aligned}
      &\mu_{\alpha_{j}} \\
      &\mu_{\beta_{1j}}
    \end{aligned}
  \end{array}
\right)
, 
\left(
  \begin{array}{cc}
     \sigma^2_{\alpha_{j}} & \rho_{\alpha_{j}\beta_{1j}} \\ 
     \rho_{\beta_{1j}\alpha_{j}} & \sigma^2_{\beta_{1j}}
  \end{array}
\right)
 \right)
    \text{, for id j = 1,} \dots \text{,J}
\end{aligned}
$$

Whereas, my memory of ctModelLatex was that it's different because ctModelLatex gives you enough latex to generate an entire pdf based on the output itself... Which is a lot to parse through for people who aren't as fluent in latex.

from ctsem.

cdriveraus avatar cdriveraus commented on August 18, 2024

to output just the equation and not the entire document, use the equationonly=TRUE argument.

from ctsem.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.