Skip to content

Instantly share code, notes, and snippets.

@lf-araujo
lf-araujo / style.theme
Created March 2, 2024 23:04
Report theme for emacs export
#+OPTIONS: org-html-head-include-default-style:nil
#+OPTIONS: num:nil
#+OPTIONS: html-style:nil
#+OPTIONS: html-scripts:nil
#+OPTIONS: html-postamble:nil
#+OPTIONS: broken-links:mark
#+HTML_HEAD: <style type="text/css">
#+HTML_HEAD: @charset "utf-8";
#+HTML_HEAD: @import url('https://fonts.googleapis.com/css?family=Roboto:300,400,500');
#+HTML_HEAD: @import url('https://fonts.googleapis.com/css?family=Roboto Slab:300,400,500');
html,button,input,select,textarea { color: #484C66;}html { font-size: 90%; line-height: 1.4;}*,*:before,*:after { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;}a { white-space: pre; white-space: pre-wrap; white-space: pre-line; white-space: -pre-wrap; white-space: -o-pre-wrap; white-space: -moz-pre-wrap; white-space: -hp-pre-wrap; word-wrap: break-word; text-decoration: none;}a:hover { color: #0A4C89;}/* * Remove text-shadow in selection highlight: h5bp.com/i * These selection rule sets have to be separate. * Customize the background color to match your design. */::-moz-selection { background: #0A4C89; color: #FFF; text-shadow: none;}::selection { background: #0A4C89; color: #FFF; text-shadow: none;}/* * A better looking default horizontal rule */hr { display: block; height: 1px; border: 0; border-top: 1px dashed #CCC; margin: 1em 0; padding: 0;}/* * Remove the gap between images, videos, audio and canvas and the bottom of * their containers:
@lf-araujo
lf-araujo / non-pos def.md
Created December 7, 2022 16:55
Correcting non-positive definite matrices and misspecification related to starting values

Correcting non-positive definite matrices and misspecification related to starting values

In OpenMx, as model complexity grows, the higher the chance of not setting starting values that will help the optimizer reach a solution. This is particularly true for longitudinal models. This post aims at defining a set of rules that can help you define good starting points and also present what is current available. Starting values can lead to time-consuming, annoying errors and thinking about them during model

@lf-araujo
lf-araujo / warp-no-more.md
Last active September 28, 2022 18:37
Wrap no more

Wrap no more

The ggplot2 plus syntax is a much better fit for what I was attempting. For model building, summing models makes more sense than piping them. And also, the code needed to implement this is much shorter. So for something like:

mb <- mxModel("bivariate Heterogeneity Path Specification", 
    type = "RAM",
    manifestVars = c('X','Y')) +
    mxPath( from=c('X','Y'), arrows=2, free=T, values=1, lbound=.01 ) +
@lf-araujo
lf-araujo / lunarvim.md
Created July 17, 2022 14:31
Lunarvim settings for R and Nim

Lunarvim R-IDE

Lunarvim settings for R statistics with neovim as an IDE.

--[[
lvim is the global options object

Linters should be
@lf-araujo
lf-araujo / wrap.md
Last active August 17, 2022 13:30
Mx.wrap(): Using R-base pipes to create OpenMx models

Mx.wrap(): Using R-base pipes to create OpenMx models

TLDR: Create OpenMx models using pipes.

Pipes (|) were introduced in bash in order to facilitate I/O redirection. Together with the UNIX tools, manipulation of data becomes very simple and short to write. In R the concept of the pipe came much more recently, with the magrittr package within the context of dplyr and tidy tools manifesto. One fundamental decision was to name the dplyr tools so that they can be read as verbs, which helps with memorizing what each tool does, in contrast to the less obvious naming of the UNIX tools.

@lf-araujo
lf-araujo / DZ.csv
Last active July 7, 2022 14:05
Datasets for testing mr-doc2.
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 8 columns, instead of 2 in line 7.
BMI1,SBP1,GVBMI1,GVSBP1,BMI2,SBP2,GVBMI2,GVSBP2
0.20450602349373012,0.15794185275913195,-0.6253460425789539,-1.4506357704541084,1.0368041873617186,2.3581301780775132,-0.8298045774825277,0.2977901609008576
0.02710841552909793,0.062340068970890866,1.165506516809426,2.5988269678085745,-0.7477862136123585,-0.039645920260557764,0.4720596468551339,1.121176751726064
-0.694968217893945,1.3316748984453453,-0.8845048916462366,-0.22485790797959493,-0.02986158818460549,2.1670362049186753,-0.7136479387220871,-1.1646095153104221
-0.46925474812234974,-1.5158469150202687,0.666265512952597,-0.2958073461218471,-1.3093263736540937,-3.185815004518587,1.848193553289432,-1.1532694234394503
-2.928643672028249,0.5173296570306684,-0.5450982105746571,1.494035128565943,-0.7657685814119848,0.3650675408550857,-0.9898203224153305,0.7430575670709684
-0.6822450262676277,-0.2730651897684174,-1.4524792824907986,-0.45730124749190254,-2.2362226201484505,-0.6163626791797621,0.04887399043839025,-0.6574261301364492
-0.45297495383569847,0.514131950
@lf-araujo
lf-araujo / init.vim
Created December 23, 2021 22:59
R IDE for R statistics, data analysis and a bit of Nim
This is the second version of my R as an IDE for stats using R. It is built on three tools: treesitter, lsp, and Nvim-R.
One has to manually run :TSInstall markdown, :TSInstall R, and :LspInstall R. Will update this with more time in the future
but the code is mostly self explaining:
```vimscript
" Installation {{{
call plug#begin(stdpath('data') . 'vimplug')
Plug 'EdenEast/nightfox.nvim'
Plug 'kristijanhusak/orgmode.nvim'
Plug 'scrooloose/nerdtree'
@lf-araujo
lf-araujo / r-ide.md
Last active July 16, 2024 12:05
Switching from Rstudio to Neovim

Neovim R-IDE

This is my init.vim to make a stable neovim installation act as a IDE for R statistical analyses (not too much for package development).

The settings are not using neovim-lsp, so expect this is a temporary solution until someone comes up with a complete lsp configuration for R.

Why?

@lf-araujo
lf-araujo / steam-de
Last active September 27, 2020 19:22
hdmi.sh
#!/bin/bash
# STEAM DE - Script for starting Steam at login
# Copyright (C) 2012 Thomaz de Oliveira dos Reis <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,