lx.est: Write latex math equation of lm estimation for rmarkdown file

View source: R/lxest.R

lx.estR Documentation

Write latex math equation of lm estimation for rmarkdown file

Description

Write latex math equation of lm estimation for rmarkdown file

Usage

lx.est(
  lm.mod,
  lm.dt,
  style = "srf",
  lm.n = 3,
  obs = "i",
  opt = c("s", "t"),
  inf = c(""),
  digits = c(2, 4, 2, 4),
  lm.label = NULL,
  lm.tag = NULL,
  no_dollar = FALSE
)

Arguments

lm.mod

character. you should use formula() function

lm.dt

data.frame

style

character. equation style on c("srf", "srm"), with default value style="srf"

lm.n

integer. numbers of independent vars of each row in the right equation. default value lm.n = 3

obs

character. lower script for variables on c("i", "t"), with default value obs ="i"

opt

character. list of "soft" option on c("s", "t", "p"), with the default value opt=c("s", "t")

inf

character. list of "soft" option on c("over","fit","Ftest"), with the default value opt=c("")

digits

integer. list of digits specification on coef result, with the default value digits=c(2,4,2,4), respectively to c("c","s", "t", "p")

lm.label

character. Options for equation label, default value NULL

lm.tag

character. Options for equation tag, default value "NULL".

no_dollar

Logistic value. The equation environment should contains double dollars, with default value "no_dollar = FALSE"

Value

out

Examples

require("magrittr")
require("wooldridge")

mroz_new <- wooldridge::mroz %>%
  tibble::as_tibble() %>%
  dplyr::select(tidyselect::all_of(c("lwage", "educ", "exper", "fatheduc","motheduc")),
    tidyselect::everything()) %>%
    dplyr::filter(!is.na(lwage)) %>%
    dplyr::rename('educ_p_q'='educ')

mod_origin <- formula(lwage ~ educ_p_q + nwifeinc + exper + I(exper^2) + I(exper^2*city))

lx_out <- lx.est(lm.mod = mod_origin, lm.dt = mroz_new)

lx_out2 <- lx.est(lm.mod = mod_origin, lm.dt = mroz_new,
  style = c('srf'),inf = c('over','fit','Ftest'),
  lm.label = 'test-srm')


huhuaping/xmerit documentation built on Nov. 10, 2023, 4:34 a.m.