Skip to content

Commit

Permalink
gtools-1.11.8 (2024-06-28); improved consest in greg
Browse files Browse the repository at this point in the history
Features

- `greg, savecons` saves `rss`, `tss`, `r2`, `consest` without
  having to specify `alphas`
- `greg` can now save `rss`, `tss`, `r2`, `consest` with `by()`

Bug fixes

- `greg` with `alphas()` saves `consest` with IV and only one absvar.
  • Loading branch information
mcaceresb committed Jun 29, 2024
2 parents 8d3302d + 1eff36a commit 950c0bd
Show file tree
Hide file tree
Showing 53 changed files with 8,333 additions and 7,149 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "generic-1.11.6-{build}"
version: "generic-1.11.8-{build}"

environment:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ provide a massive speed improvements to common Stata commands, including:
reshape, collapse, xtile, tabstat, isid, egen, pctile, winsor, contract,
levelsof, duplicates, unique/distinct, and more.

![Beta Version](https://img.shields.io/badge/beta-v1.11.6-blue.svg?longCache=true&style=flat-square)
![Beta Version](https://img.shields.io/badge/beta-v1.11.8-blue.svg?longCache=true&style=flat-square)
![Supported Platforms](https://img.shields.io/badge/platforms-linux--64%20%7C%20osx--64%20%7C%20win--64-blue.svg?longCache=true&style=flat-square)
[![github linux status](https://github.com/mcaceresb/stata-gtools/actions/workflows/linux.yml/badge.svg?branch=master)](https://github.com/mcaceresb/stata-gtools/actions/workflows/linux.yml)
[![github osx status](https://github.com/mcaceresb/stata-gtools/actions/workflows/osx.yml/badge.svg?branch=master)](https://github.com/mcaceresb/stata-gtools/actions/workflows/osx.yml)
Expand Down
14 changes: 13 additions & 1 deletion build/_gtools_internal.ado
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*! version 1.11.6 08Nov2023 Mauricio Caceres Bravo, [email protected]
*! version 1.11.8 28Jun2024 Mauricio Caceres Bravo, [email protected]
*! gtools function internals

* rc 17000
Expand Down Expand Up @@ -49,6 +49,7 @@ program _gtools_internal, rclass
tempfile gregvcovfile
tempfile gregclusfile
tempfile gregabsfile
tempfile greginfofile
tempfile ghdfeabsfile
tempfile gstatsfile
tempfile gbyvarfile
Expand All @@ -64,6 +65,7 @@ program _gtools_internal, rclass
GtoolsTempFile gregvcovfile
GtoolsTempFile gregclusfile
GtoolsTempFile gregabsfile
GtoolsTempFile greginfofile
GtoolsTempFile ghdfeabsfile
GtoolsTempFile gstatsfile
GtoolsTempFile gbyvarfile
Expand All @@ -79,6 +81,7 @@ program _gtools_internal, rclass
global GTOOLS_GREGVCOV_FILE: copy local gregvcovfile
global GTOOLS_GREGCLUS_FILE: copy local gregclusfile
global GTOOLS_GREGABS_FILE: copy local gregabsfile
global GTOOLS_GREGINFO_FILE: copy local greginfofile
global GTOOLS_GHDFEABS_FILE: copy local ghdfeabsfile
global GTOOLS_GSTATS_FILE: copy local gstatsfile
global GTOOLS_BYVAR_FILE: copy local gbyvarfile
Expand Down Expand Up @@ -727,6 +730,7 @@ program _gtools_internal, rclass
mata: st_numscalar("__gtools_gfile_gregvcov", strlen(st_local("gregvcovfile")) + 1)
mata: st_numscalar("__gtools_gfile_gregclus", strlen(st_local("gregclusfile")) + 1)
mata: st_numscalar("__gtools_gfile_gregabs", strlen(st_local("gregabsfile")) + 1)
mata: st_numscalar("__gtools_gfile_greginfo", strlen(st_local("greginfofile")) + 1)
mata: st_numscalar("__gtools_gfile_ghdfeabs", strlen(st_local("ghdfeabsfile")) + 1)

scalar __gtools_init_targ = 0
Expand Down Expand Up @@ -1710,6 +1714,7 @@ program _gtools_internal, rclass
prefix(str) /// save prepending prefix
PREDict(str) /// save fit in `predict'
alphas(str) /// save fixed effects in `alphas'
savecons /// save estimate for constant (memory-intensive)
resid /// save residuals in _resid_`yvarlist'
RESIDuals(str) /// save residuals in `residuals'
replace /// Replace targets, if they exist
Expand Down Expand Up @@ -1905,6 +1910,7 @@ program _gtools_internal, rclass
scalar __gtools_gregress_kvars = `:list sizeof varlist'
scalar __gtools_gregress_cons = `"`constant'"' != "noconstant"
scalar __gtools_gregress_consest = .
scalar __gtools_gregress_savecons = `"`savecons'"' == "savecons"
scalar __gtools_gregress_rss = .
scalar __gtools_gregress_tss = .
scalar __gtools_gregress_robust = `"`robust'"' != ""
Expand Down Expand Up @@ -3454,6 +3460,7 @@ program clean_all
global GTOOLS_GREGVCOV_FILE
global GTOOLS_GREGCLUS_FILE
global GTOOLS_GREGABS_FILE
global GTOOLS_GREGINFO_FILE
global GTOOLS_GHDFEABS_FILE
global GTOOLS_GSTATS_FILE
global GTOOLS_BYVAR_FILE
Expand All @@ -3470,8 +3477,11 @@ program clean_all
cap scalar drop __gtools_gfile_topmat
cap scalar drop __gtools_gfile_gregb
cap scalar drop __gtools_gfile_gregse
cap scalar drop __gtools_gfile_gregvcov
cap scalar drop __gtools_gfile_gregclus
cap scalar drop __gtools_gfile_gregabs
cap scalar drop __gtools_gfile_greginfo
cap scalar drop __gtools_gfile_ghdfeabs
cap scalar drop __gtools_gfile_hdfeabs
cap scalar drop __gtools_init_targ
cap scalar drop __gtools_any_if
Expand Down Expand Up @@ -5017,6 +5027,7 @@ program gregress_scalars
scalar __gtools_gregress_kvars = 0
scalar __gtools_gregress_cons = 0
scalar __gtools_gregress_consest = .
scalar __gtools_gregress_savecons = 1
scalar __gtools_gregress_rss = .
scalar __gtools_gregress_tss = .
scalar __gtools_gregress_robust = 0
Expand Down Expand Up @@ -5063,6 +5074,7 @@ program gregress_scalars
cap scalar drop __gtools_gregress_kvars
cap scalar drop __gtools_gregress_cons
cap scalar drop __gtools_gregress_consest
cap scalar drop __gtools_gregress_savecons
cap scalar drop __gtools_gregress_rss
cap scalar drop __gtools_gregress_tss
cap scalar drop __gtools_gregress_robust
Expand Down
24 changes: 14 additions & 10 deletions build/_gtools_internal.mata
Original file line number Diff line number Diff line change
Expand Up @@ -1966,10 +1966,10 @@ class GtoolsRegressOutput
real matrix se
real matrix Vcov
real scalar savese
real scalar consest
real scalar rss
real scalar tss
real scalar r2
real colvector consest
real colvector rss
real colvector tss
real colvector r2
real scalar J
real scalar by
Expand Down Expand Up @@ -2053,13 +2053,17 @@ void function GtoolsRegressOutput::init()
void function GtoolsRegressOutput::readMatrices()
{
real matrix qc
real matrix qc, info
real scalar runols, runse, runhdfe
J = strtoreal(st_local("r_J"))
consest = st_numscalar("__gtools_gregress_consest")
rss = st_numscalar("__gtools_gregress_rss")
tss = st_numscalar("__gtools_gregress_tss")
r2 = 1-rss/tss
J = strtoreal(st_local("r_J"))
info = GtoolsReadMatrix(st_local("greginfofile"), 3, J)
consest = info[1, .]
rss = info[2, .]
tss = info[3, .]
r2 = 1:-(rss:/tss)
// consest = st_numscalar("__gtools_gregress_consest")
// rss = st_numscalar("__gtools_gregress_rss")
// tss = st_numscalar("__gtools_gregress_tss")
if ( st_numscalar("__gtools_gregress_savemb") ) {
b = editmissing(GtoolsReadMatrix(st_local("gregbfile"), J, kx), 0)
}
Expand Down
22 changes: 21 additions & 1 deletion build/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
Change Log
==========

## gtools-1.11.8 (2024-06-28)

### Features

- `greg, savecons` saves `rss`, `tss`, `r2`, `consest` without
having to specify `alphas`
- `greg` can now save `rss`, `tss`, `r2`, `consest` with `by()`

## gtools-1.11.7 (2023-11-08)

### Bug fixes

- `greg` with `alphas()` saves `consest` with IV and only one absvar.

## gtools-1.11.6 (2023-11-08)

### Bug fixes

- `greg` with `glm` and absorb no longer gives error (can't dereference NULL)

## gtools-1.11.5 (2023-10-27)

### Bug fixes
Expand All @@ -14,7 +34,7 @@ Change Log
### Features

- `greg` saves `rss`, `tss`, `r2` in mata (not with `by()`)
- `greg` saves `cons` in mata with absorb (not with `by()`)
- `greg` saves `consest` in mata with absorb (not with `by()`)

## gtools-1.11.3 (2023-09-20)

Expand Down
2 changes: 1 addition & 1 deletion build/greg.ado
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*! version 1.11.1 03Apr2023 Mauricio Caceres Bravo, [email protected]
*! version 1.11.8 28Jun2024 Mauricio Caceres Bravo, [email protected]
*! Estimate linear regression via OLS by group and with HDFE

cap program drop greg
Expand Down
2 changes: 2 additions & 0 deletions build/greg.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ is, this assumes that the weight refers to the number of available
{p_end}
{synopt:{opt alphas(varlist)}}One per absorb variable; save FE (normalized to be mean zero).
{p_end}
{synopt:{opt savecons}}Save implied constant in mata (with {opt absorb()}).
{p_end}
{synopt:{opt predict(varname)}}Save linear fit.
{p_end}
{synopt:{opt resid(varname)}}Save residuals.
Expand Down
12 changes: 7 additions & 5 deletions build/gregress.ado
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*! version 1.11.1 03Apr2023 Mauricio Caceres Bravo, [email protected]
*! version 1.11.8 28Jun2024 Mauricio Caceres Bravo, [email protected]
*! Estimate linear regression via OLS by group and with HDFE

capture program drop gregress
Expand Down Expand Up @@ -376,13 +376,14 @@ end
capture program drop Display
program Display, eclass
syntax [namelist(max = 1)], [repost touse(str) *]
tempname by
tempname by nocoef
if ( "`namelist'" == "" ) {
disp as txt "Cannot display table without cached results; use option -mata()- to save"
}
else {
mata st_numscalar("`by'", `namelist'.by)
if ( `=scalar(`by')' == 0) {
mata st_numscalar("`by'", `namelist'.by)
mata st_numscalar("`nocoef'", (`namelist'.saveb == 0) | (`namelist'.savese == 0))
if ( (`=scalar(`by')' == 0) & (`=scalar(`nocoef')' == 0) ) {
tempname colnames sel nmiss
FreeMatrix b V
mata st_local("caller", `namelist'.caller)
Expand Down Expand Up @@ -412,7 +413,8 @@ program Display, eclass
_coef_table, `options'
}
else {
disp as txt "Cannot display table with by(); use {stata mata `namelist'.print()}"
if `=scalar(`by')' disp as txt "Cannot display table with by(); use {stata mata `namelist'.print()}"
if `=scalar(`nocoef')' disp as txt "Cannot display table with -nob- or -nose-"
}
}
end
Expand Down
2 changes: 2 additions & 0 deletions build/gregress.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ is, this assumes that the weight refers to the number of available
{p_end}
{synopt:{opt alphas(varlist)}}One per absorb variable; save FE (normalized to be mean zero).
{p_end}
{synopt:{opt savecons}}Save implied constant in mata (with {opt absorb()}).
{p_end}
{synopt:{opt predict(varname)}}Save linear fit.
{p_end}
{synopt:{opt resid(varname)}}Save residuals.
Expand Down
2 changes: 1 addition & 1 deletion build/gtools.ado
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*! version 1.11.6 08Nov2023 Mauricio Caceres Bravo, [email protected]
*! version 1.11.8 28Jun2024 Mauricio Caceres Bravo, [email protected]
*! Program for managing the gtools package installation

capture program drop gtools
Expand Down
4 changes: 2 additions & 2 deletions build/gtools.pkg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
v 1.11.6
v 1.11.8
d
d 'GTOOLS': Faster implementation of common Stata commands optimized for large datasets
d
Expand Down Expand Up @@ -63,7 +63,7 @@ d
d Author: Mauricio Caceres Bravo
d Support: email [email protected]
d
d Distribution-Date: 20231108
d Distribution-Date: 20240628
d
f _gtools_internal.ado
f _gtools_internal.mata
Expand Down
2 changes: 1 addition & 1 deletion build/gtools.sthlp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{smcl}
{* *! version 1.11.6 08Nov2023}{...}
{* *! version 1.11.8 28Jun2024}{...}
{viewerdialog gtools "dialog gtools"}{...}
{vieweralsosee "[R] gtools" "mansection R gtools"}{...}
{viewerjumpto "Syntax" "gtools##syntax"}{...}
Expand Down
Binary file modified build/gtools_macosx_v2.plugin
Binary file not shown.
Binary file modified build/gtools_macosx_v3.plugin
Binary file not shown.
2 changes: 1 addition & 1 deletion build/gtools_tests.do
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Created: Tue May 16 07:23:02 EDT 2017
* Updated: Mon Dec 05 09:39:49 EST 2022
* Purpose: Unit tests for gtools
* Version: 1.11.6
* Version: 1.11.8
* Manual: help gtools
* Note: You may need to run `ftools, compile` and `reghdfe, compile`
* to test gtools against ftools functions and reghdfe.
Expand Down
Loading

0 comments on commit 950c0bd

Please sign in to comment.