<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Statalist - General</title>
		<link>https://www.statalist.org/forums/</link>
		<description>Discuss Stata statistical software</description>
		<language>en</language>
		<lastBuildDate>Mon, 07 Sep 2026 11:01:22 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>images/misc/rss.png</url>
			<title>Statalist - General</title>
			<link>https://www.statalist.org/forums/</link>
		</image>
		<item>
			<title>How to reduce the number of GMM instruments in xtendothresdpd with a small panel (N=8, T=22)?</title>
			<link>https://www.statalist.org/forums/forum/general-stata-discussion/general/1787250-how-to-reduce-the-number-of-gmm-instruments-in-xtendothresdpd-with-a-small-panel-n-8-t-22</link>
			<pubDate>Mon, 07 Sep 2026 00:49:55 GMT</pubDate>
			<description>Hi everyone, I need help reducing the number of instruments when using Kremer’s (2013) threshold effects method (implemented via the...</description>
			<content:encoded>Hi everyone, I need help reducing the number of instruments when using Kremer’s (2013) threshold effects method (implemented via the `xtendothresdpd` command). While I get good results, the number of instruments is very high—well over 30—even though I am working with a panel of only 8 countries. Could you help me find a way to reduce this? I am currently a Master’s student.</content:encoded>
			<category domain="https://www.statalist.org/forums/forum/general-stata-discussion/general">General</category>
			<dc:creator>DENE Dalil</dc:creator>
			<guid isPermaLink="true">https://www.statalist.org/forums/forum/general-stata-discussion/general/1787250-how-to-reduce-the-number-of-gmm-instruments-in-xtendothresdpd-with-a-small-panel-n-8-t-22</guid>
		</item>
		<item>
			<title>round_exact updated to version 4.0.6 on SSC</title>
			<link>https://www.statalist.org/forums/forum/general-stata-discussion/general/1787249-round_exact-updated-to-version-4-0-6-on-ssc</link>
			<pubDate>Sun, 06 Sep 2026 21:50:29 GMT</pubDate>
			<description>Dear Statalist users, 
 
-round_exact- has been updated on SSC to version 4.0.6. 
 
New features include: 
 
* Direct conversion and exact rounding...</description>
			<content:encoded><![CDATA[  Dear Statalist users,<br />
<br />
-round_exact- has been updated on SSC to version 4.0.6.<br />
<br />
New features include:<br />
<br />
* Direct conversion and exact rounding of string variables using either -generate()- or -replace-.<br />
<br />
* Raw-macro interception for string literals with -fromstring-, allowing exact decimal evaluation before binary floating-point conversion.<br />
<br />
* A revised machine-precision-aware rounding boundary:<br />
<br />
          delta_z = 4*c(epsdouble)*z + 1e-12<br />
<br />
* Faster processing through replacement of regular-expression parsing with pure string operations, improved handling of &quot;.&quot; and empty-string missing values, and reduced memory usage through -str2045- temporary storage.<br />
<br />
To install or update:<br />
<br />
         ssc install round_exact, replace<br />
<br />
Comments and bug reports are greatly appreciated.<br />
<br />
Best regards,<br />
<br />
Anne Fengyan Shi<br />
<br />
Pew Research Center<br />
]]></content:encoded>
			<category domain="https://www.statalist.org/forums/forum/general-stata-discussion/general">General</category>
			<dc:creator>Anne Shi</dc:creator>
			<guid isPermaLink="true">https://www.statalist.org/forums/forum/general-stata-discussion/general/1787249-round_exact-updated-to-version-4-0-6-on-ssc</guid>
		</item>
		<item>
			<title>New -nestpreserve- Module for Nested Dataset-State Management</title>
			<link>https://www.statalist.org/forums/forum/general-stata-discussion/general/1787244-new-nestpreserve-module-for-nested-dataset-state-management</link>
			<pubDate>Sat, 05 Sep 2026 22:44:39 GMT</pubDate>
			<description>Thanks as always to Kit Baum, the new -nestpreserve- module is now available on SSC. 
 
 
-nestpreserve- provides nested dataset-state management for...</description>
			<content:encoded><![CDATA[<span style="font-size:13px">Thanks as always to Kit Baum, the new -nestpreserve- module is now available on SSC.</span><br />
<br />
<br />
-nestpreserve- provides nested dataset-state management for Stata. It implements a disk-backed, last-in-first-out stack of checkpoints, allowing users to preserve, inspect, and restore multiple analytical states rather than being limited to a single preserve/restore cycle. The module is designed for workflows in which a dataset passes through multiple temporary transformations and intermediate states, while keeping restoration order explicit and auditable.<br />
<br />
The main components are:<ol class="decimal"><li><b>-nestpreserve-</b>: creates a new dataset-state checkpoint. Multiple checkpoints may be nested, with each checkpoint belonging to the frame in which it was created.</li>
<li><b>-nestrestore-</b>: restores checkpoints in last-in-first-out order, helping prevent accidental restoration of the wrong analytical state.</li>
<li><b>-neststatus-</b>: inspects the current checkpoint stack and reports information about stored states.</li>
<li><b>-nesttransaction-</b>: runs a Stata command as a temporary dataset transaction. Dataset changes made by the command are automatically rolled back after either successful execution or failure.</li>
<li><b>-nestrecover- and -nestclear-</b>: provide recovery and cleanup for checkpoint stacks left behind after a Stata process terminates. Recovery is deliberately fail-closed: automatic action is taken only when a single intact abandoned stack can be identified and its originating process is confirmed to be no longer running. Ambiguous, live, corrupt, legacy, or otherwise unverifiable checkpoint stacks are not modified automatically.</li>
</ol>For each checkpoint, -nestpreserve- records information such as dataset dimensions, changes in variables and observations, dataset signatures, and transaction history. Checkpoints are disk-backed and are managed separately for individual Stata frames. The module manages <b>dataset state</b>, rather than attempting to snapshot the complete Stata session. This distinction is intentional.<br />
<br />
To install:<br />
ssc inst nestpreserve<br />
<br />
To update an existing installation:<br />
. ssc inst nestpreserve, replace<br />
<br />
The help file, accessible with<br />
<br />
help nestpreserve<br />
<br />
includes numerous worked examples covering typical workflows and common use cases, intended to make the package easy to learn and apply in practice.<br />
<br />
Comments, bug reports, and suggestions are very welcome.]]></content:encoded>
			<category domain="https://www.statalist.org/forums/forum/general-stata-discussion/general">General</category>
			<dc:creator>smith Jason</dc:creator>
			<guid isPermaLink="true">https://www.statalist.org/forums/forum/general-stata-discussion/general/1787244-new-nestpreserve-module-for-nested-dataset-state-management</guid>
		</item>
		<item>
			<title>Table with horizontal line above the total</title>
			<link>https://www.statalist.org/forums/forum/general-stata-discussion/general/1787241-table-with-horizontal-line-above-the-total</link>
			<pubDate>Sat, 05 Sep 2026 20:00:23 GMT</pubDate>
			<description>Using table and collect not very often I am struggling with the collect commands. 
 
I am using 
clear 
* Example generated by -dataex-. For more...</description>
			<content:encoded><![CDATA[Using <span style="font-family:courier new">table</span> and <span style="font-family:courier new">collect</span> not very often I am struggling with the collect commands.<br />
<br />
I am using
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<pre class="bbcode_code">clear
* Example generated by -dataex-. For more info, type help dataex
clear
input float grade_st byte age
14 13
14 14
14 15
14 14
16 16
14 14
15 16
15 15
14 14
14 14
14 14
15 15
15 15
16 16
14 13
15 15
14 14
15 15
14 14
16 16
14 14
13 13
16 16
13 13
14 15
13 14
15 15
16 16
15 15
13 14
16 16
16 17
17 19
15 15
13 13
16 18
14 .a
14 14
14 15
16 16
15 16
16 17
15 15
15 .a
18 16
18 18
16 16
15 15
17 17
14 14
14 13
16 16
13 13
15 14
15 14
17 18
14 14
13 13
17 17
16 16
13 13
15 14
13 13
end
label values age age
label def age .a &quot;no answer&quot;, modify

qui table grade_st, statistic(n age) statistic(mean age) statistic(sd age) ///
    statistic(min age) statistic(max age)
collect label levels result count &quot;Obs&quot; mean &quot;Mean&quot; sd &quot;Std. dev.&quot; ///
    min &quot;Min&quot; max &quot;Max&quot;, modify
collect style cell result[mean sd], nformat(%4.1f)
collect style cell result[count min max], nformat(%6.0fc)
collect preview</pre>
</div>amd get
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<pre class="bbcode_code">. collect preview

----------------------------------------------
         |  Obs   Mean   Std. dev.   Min   Max
---------+------------------------------------
grade_st |                                    
  13     |    9   13.2         0.4    13    14
  14     |   18   14.0         0.6    13    15
  15     |   15   14.9         0.6    14    16
  16     |   13   16.3         0.6    16    18
  17     |    4   17.8         1.0    17    19
  18     |    2   17.0         1.4    16    18
  Total  |   61   15.0         1.5    13    19
----------------------------------------------</pre>
</div>How to get a horizontal line above the Total?]]></content:encoded>
			<category domain="https://www.statalist.org/forums/forum/general-stata-discussion/general">General</category>
			<dc:creator>Dirk Enzmann</dc:creator>
			<guid isPermaLink="true">https://www.statalist.org/forums/forum/general-stata-discussion/general/1787241-table-with-horizontal-line-above-the-total</guid>
		</item>
		<item>
			<title>Row Percentages and Exporting Tables using SVY suite of commands</title>
			<link>https://www.statalist.org/forums/forum/general-stata-discussion/general/1787223-row-percentages-and-exporting-tables-using-svy-suite-of-commands</link>
			<pubDate>Thu, 03 Sep 2026 16:26:30 GMT</pubDate>
			<description>Hi everyone, I have a question that is two-fold. 
 
I am using the svy suite of commands in Stata 18. I have a huge survey dataset that includes over...</description>
			<content:encoded><![CDATA[Hi everyone, I have a question that is two-fold.<br />
<br />
I am using the svy suite of commands in Stata 18. I have a huge survey dataset that includes over 100 variables. I am trying to create tables that contain each of the 17 variables listed below in local vars (age4_new through ruralurban) stratfied by the other survey variables. I want the localvars in the rows and the other variable in the columns. The code below includes an example of one of the other (column) variables called &quot;whyunins.&quot; The code below produces multiple tables (e.g. age4_new x whyuins, race x whyunins) and my first question is this: Is there a different coding process that I could use to create one large table with all the local vars on the rows and the other variable (whyunins, in this case) in the columns? <br />
<br />
My second question is this: How do I export the results with the row percentages to Excel once I have the output? I have already output the column percentage tables using the dtable command and it was easy enough to use &quot;collect&quot; to export the results to Excel. However, I cannot figure out how to use the collect function to export ROW percentages using the svy commands. I have tried many ways and, while collect will output an Excel spreadsheet, the spreadsheet is empty. <br />
<br />
<br />
local vars age4_new race hispanic gender sexor maritalstatus edu income ///<br />
    fulltime parttime retired student employment_other selfemployed ///<br />
    unemployed party ruralurban<br />
<br />
foreach var of local vars {<br />
    svy: tab `var' whyunins, row count<br />
}<br />
<br />
<br />
Any guidance is appreciated! Thank you!]]></content:encoded>
			<category domain="https://www.statalist.org/forums/forum/general-stata-discussion/general">General</category>
			<dc:creator>Melissa Eggen</dc:creator>
			<guid isPermaLink="true">https://www.statalist.org/forums/forum/general-stata-discussion/general/1787223-row-percentages-and-exporting-tables-using-svy-suite-of-commands</guid>
		</item>
		<item>
			<title>egen mode() misleading warning?</title>
			<link>https://www.statalist.org/forums/forum/general-stata-discussion/general/1787222-egen-mode-misleading-warning</link>
			<pubDate>Thu, 03 Sep 2026 09:52:31 GMT</pubDate>
			<description>I have the following code to produce example data and to reproduce my problem: 
 
 
clear 
input id year status target 
1 2001 0 2 
1 2002 1 2 
1...</description>
			<content:encoded><![CDATA[I have the following code to produce example data and to reproduce my problem:<br />
<br />

<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<pre class="bbcode_code">clear
input id year status target
1 2001 0 2
1 2002 1 2
1 2003 1 2
1 2004 1 4
1 2005 0 3
2 1999 1 4
2 2000 1 4
2 2001 1 5
2 2002 0 1
2 2003 1 5
3 2004 0 3
3 2005 1 .
3 2006 1 .
3 2007 1 .
3 2008 1 .
3 2009 0 .
end

bysort id: egen modeflag = mode(target) if status==1, minmode
bysort id: egen modefinal = mode(modeflag)

/*
warning: Multiple modes encountered in one or more groups.  Generating missing values for the modes in these groups.  Use option minmode, maxmode, or nummode() to select one of the modes.
(6 missing values generated)
*/</pre>
</div><br />
When running the second mode() command<br />
<br />

<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<pre class="bbcode_code">bysort id: egen modefinal = mode(modeflag)</pre>
</div>at least Stata 18 and Stata 19.5 throw the error specified in the comment:<br />
&quot;Multiple modes encountered in one or more groups.&quot;<br />
<br />
However, as you can see if you run this example, there are absolutely no multiple modes encountered in any bysort group at variable modeflag. I believe this should be fixed, as it has caused me to do unnecessary verifications to find out there were no multiple modes. Am I missing something here?<br />
<br />
Best regards,<br />
Kasper]]></content:encoded>
			<category domain="https://www.statalist.org/forums/forum/general-stata-discussion/general">General</category>
			<dc:creator>Kasper Kotisaari</dc:creator>
			<guid isPermaLink="true">https://www.statalist.org/forums/forum/general-stata-discussion/general/1787222-egen-mode-misleading-warning</guid>
		</item>
		<item>
			<title>Claude Code-like tool for Stata</title>
			<link>https://www.statalist.org/forums/forum/general-stata-discussion/general/1787220-claude-code-like-tool-for-stata</link>
			<pubDate>Wed, 02 Sep 2026 18:57:09 GMT</pubDate>
			<description><![CDATA[I've been building a tool that helps produce publication quality graphs and tables using simple english in Stata. Think of it like Cursor or Claude...]]></description>
			<content:encoded><![CDATA[I've been building a tool that helps produce publication quality graphs and tables using simple english in Stata. Think of it like Cursor or Claude Code, but for Stata.<br />
<br />
Download (macOS only for now): <a href="https://www.noolioapp.com/" target="_blank">https://www.noolioapp.com/</a><br />
How it works: <a href="https://drive.google.com/file/d/11K47jn_2jSmCV7h1mCwmWsMrQl4wpV7Z/view" target="_blank">https://drive.google.com/file/d/11K4...rQl4wpV7Z/view</a><br />
<br />
Try it out! Enjoy <img src="https://www.statalist.org/forums/core/images/smilies/smile.png" border="0" alt="" title="Smile" smilieid="1" class="inlineimg" /><br />
<br />
Very much a first version. Bug reports and feedback welcome.]]></content:encoded>
			<category domain="https://www.statalist.org/forums/forum/general-stata-discussion/general">General</category>
			<dc:creator>Daniel Abraham</dc:creator>
			<guid isPermaLink="true">https://www.statalist.org/forums/forum/general-stata-discussion/general/1787220-claude-code-like-tool-for-stata</guid>
		</item>
		<item>
			<title>SSC Activity, August 2026</title>
			<link>https://www.statalist.org/forums/forum/general-stata-discussion/general/1787215-ssc-activity-august-2026</link>
			<pubDate>Tue, 01 Sep 2026 12:26:50 GMT</pubDate>
			<description>The SSC Archive contains 28 new packages added in August, as well as revised versions of 41 packages. Updates to the archive and production of...</description>
			<content:encoded>The SSC Archive contains 28 new packages added in August, as well as revised versions of 41 packages. Updates to the archive and production of download statistics will be delayed until 8 September, following the UK Stata Conference. </content:encoded>
			<category domain="https://www.statalist.org/forums/forum/general-stata-discussion/general">General</category>
			<dc:creator>KitBaum</dc:creator>
			<guid isPermaLink="true">https://www.statalist.org/forums/forum/general-stata-discussion/general/1787215-ssc-activity-august-2026</guid>
		</item>
		<item>
			<title>Eventstudy2</title>
			<link>https://www.statalist.org/forums/forum/general-stata-discussion/general/1787213-eventstudy2</link>
			<pubDate>Mon, 31 Aug 2026 08:12:27 GMT</pubDate>
			<description>This is syntax correct? eventstudy2 cusip date using security_ret, ret(ret) evwlb(-10) evwub(10) mod(MA) marketfile(market_return) mar(vwretd)...</description>
			<content:encoded>This is syntax correct? eventstudy2 cusip date using security_ret, ret(ret) evwlb(-10) evwub(10) mod(MA) marketfile(market_return) mar(vwretd) car1lb(-1) car1ub(1) car5lb(-2) car5ub(2) car8lb(-2) car8ub(5) arfillevent replace</content:encoded>
			<category domain="https://www.statalist.org/forums/forum/general-stata-discussion/general">General</category>
			<dc:creator>Benjamin Agyeman</dc:creator>
			<guid isPermaLink="true">https://www.statalist.org/forums/forum/general-stata-discussion/general/1787213-eventstudy2</guid>
		</item>
		<item>
			<title>EventStudy2 111 error</title>
			<link>https://www.statalist.org/forums/forum/general-stata-discussion/general/1787211-eventstudy2-111-error</link>
			<pubDate>Sun, 30 Aug 2026 20:17:50 GMT</pubDate>
			<description>I have run eventstudy2 and been faced with this error 
 
279 out of 279 events completed. ...succeeded Assessing statistical significance of abnormal...</description>
			<content:encoded><![CDATA[I have run eventstudy2 and been faced with this error<br />
<br />
279 out of 279 events completed. ...succeeded Assessing statistical significance of abnormal returns... variable __00000X not found r(111)<br />
Please how do I resolved it?]]></content:encoded>
			<category domain="https://www.statalist.org/forums/forum/general-stata-discussion/general">General</category>
			<dc:creator>Benjamin Agyeman</dc:creator>
			<guid isPermaLink="true">https://www.statalist.org/forums/forum/general-stata-discussion/general/1787211-eventstudy2-111-error</guid>
		</item>
		<item>
			<title>Updated -midas- package with new post-estimation subcommand -midas jsroc-</title>
			<link>https://www.statalist.org/forums/forum/general-stata-discussion/general/1787210-updated-midas-package-with-new-post-estimation-subcommand-midas-jsroc</link>
			<pubDate>Sat, 29 Aug 2026 21:12:44 GMT</pubDate>
			<description>Thanks as always to Kit Baum, a new version of the -midas- package is now 
available on SSC. 
 
-midas- is a comprehensive suite for the...</description>
			<content:encoded><![CDATA[Thanks as always to Kit Baum, a new version of the -midas- package is now<br />
available on SSC.<br />
<br />
-midas- is a comprehensive suite for the meta-analysis of diagnostic test<br />
accuracy studies, built around the bivariate mixed-effects logistic<br />
regression model. Version 3 of the package, released earlier this year,<br />
provides five estimation engines (maximum likelihood, maximum simulated<br />
likelihood with quasi-random draws, Metropolis-Hastings, Hamiltonian Monte<br />
Carlo, and integrated nested Laplace approximation), together with<br />
postestimation graphics, exploratory diagnostics, and data management<br />
utilities, all dispatched through a single -midas- command with<br />
subcommands.<br />
<br />
New in this update:<br />
<br />
1. -midas jsroc- : a new postestimation graphic drawing the joint summary<br />
ROC curve. It plots the Rutter-Gatsonis-equivalent SROC curve in ROC space<br />
and reports the area under the curve (trapezoidal integration with a<br />
Wilson-type confidence interval). On the same plot it can overlay, each at<br />
the user's option: the joint confidence region or ellipse about the<br />
summary operating point; the joint prediction region or ellipse for a<br />
future study; the observed study estimates, optionally sized by study<br />
weights and labeled; and the summary operating point with its confidence<br />
intervals. Region areas can be computed by polygon integration, yielding<br />
heterogeneity indices (overlap coefficient, heterogeneity area index, log<br />
area ratio, standardized area difference) with an interpretive assessment.<br />
A -noextrapolate- option restricts the displayed curve to the range of<br />
observed specificities. -midas jsroc- complements the existing<br />
-midas rgsroc- and -midas bvsroc- subcommands.<br />
<br />
2. -midas_d0- : the d0 likelihood evaluator used by -midas qrsim- (maximum<br />
simulated likelihood) now ships as its own file, resolving an<br />
&quot;unrecognized command: midas_d0&quot; error that could arise in some<br />
configurations.<br />
<br />
3. Help files updated accordingly, including the addition of -jsroc- to<br />
the main -midas- subcommand table.<br />
<br />
A GUI dialog for the new subcommand has been added to the companion<br />
dialogs package, -midas_dlg-.<br />
<br />
To install or update:<br />
<br />
. ssc install midas, replace<br />
. ssc install midas_dlg, replace<br />
<br />
or<br />
<br />
. adoupdate midas midas_dlg, update<br />
<br />
-midas- requires Stata 16 or later. The Bayesian and INLA engines have<br />
additional requirements documented in their respective help files.<br />
<br />
Comments, bug reports, and suggestions are welcome.<br />
<br />
Ben A. Dwamena, MD<br />
Division of Nuclear Medicine and Molecular Imaging, Department of Radiology<br />
University of Michigan, Ann Arbor<br />
<a href="mailto:bdwamena@umich.edu">bdwamena@umich.edu</a>]]></content:encoded>
			<category domain="https://www.statalist.org/forums/forum/general-stata-discussion/general">General</category>
			<dc:creator>Ben A. Dwamena</dc:creator>
			<guid isPermaLink="true">https://www.statalist.org/forums/forum/general-stata-discussion/general/1787210-updated-midas-package-with-new-post-estimation-subcommand-midas-jsroc</guid>
		</item>
		<item>
			<title>mergin datasets</title>
			<link>https://www.statalist.org/forums/forum/general-stata-discussion/general/1787192-mergin-datasets</link>
			<pubDate>Wed, 26 Aug 2026 15:02:51 GMT</pubDate>
			<description>I have two datasets that wish to merge but cannot find a way to do so.  The data set are asss followws with my command to mrge them, but the command...</description>
			<content:encoded><![CDATA[<br />
<br />
I have two datasets that wish to merge but cannot find a way to do so.  The data set are asss followws with my command to mrge them, but the command didn't wrk:<br />
<br />
First data set:<br />
<br />
 p:\Data\Data\ivscum.dta<br />
<br />
  oneway ancestry country,tab<br />
<br />
    <br />
. <br />
<br />
. collapse proudnationality - trustothernationality bornhere respetlaws-immigrantskeepcustoms justifiableillegal justifiableimmoral,by(country)<br />
<br />
. fsum *<br />
<br />
                 Variable |        N     Mean       SD      Min      Max                                                                                                                              <br />
--------------------------+---------------------------------------------<br />
                  country |       49   433.41   273.20     8.00   915.00  <br />
         proudnationality |       49     1.67     0.23     1.13     2.12  <br />
              trustpeople |       31     2.27     0.29     1.82     3.04  <br />
        trustneighborhood |       36     2.04     0.21     1.56     2.53  <br />
 trustknowotherpersonally |       36     1.83     0.25     1.21     2.23  <br />
           trustfirsttime |       36     2.81     0.33     2.09     3.50  <br />
       trustotherreligion |       36     2.46     0.30     1.85     3.05  <br />
    trustothernationality |       36     2.44     0.31     1.78     3.07  <br />
                 bornhere |       47     0.92     0.09     0.55     1.00  <br />
               respetlaws |       49    -0.53     1.57    -4.00     1.94  <br />
                 ancestry |       49    -0.25     1.55    -4.00     2.73  <br />
                     lang |       49    -0.55     1.52    -4.00     1.93  <br />
       immigrantstakejobs |       47     5.32     0.95     3.36     7.46  <br />
          immigrantscrime |       47     4.59     0.77     2.87     6.37  <br />
  immigrantsstrainwelfare |       47     4.53     0.92     1.87     6.41  <br />
    immigrantskeepcustoms |       47     5.58     0.69     3.88     7.07  <br />
       justifiableillegal |       13     0.06     0.29    -0.24     0.77  <br />
       justifiableimmoral |       13    -0.02     0.28    -0.47     0.35  <br />
<br />
.  save &quot;p:\Data\Data\ivscum.dta&quot;, replace<br />
file p:\Data\Data\ivscum.dta saved<br />
<br />
<br />
second dataset:<br />
<br />
 <br />
<br />
-&gt;  oneway immigrantstakejobs country,tab<br />
<br />
<br />
my command that didn't work:<br />
<br />
. collapse proudnationality - trustothernationality bornhere respetlaws-immigrantskeepcustoms justifiableillegal justifiableimmoral,by(country)<br />
<br />
. fsum *<br />
<br />
                 Variable |        N     Mean       SD      Min      Max                                                                                                                              <br />
--------------------------+---------------------------------------------<br />
                  country |       49   433.41   273.20     8.00   915.00  <br />
         proudnationality |       49     1.67     0.23     1.13     2.12  <br />
              trustpeople |       31     2.27     0.29     1.82     3.04  <br />
        trustneighborhood |       36     2.04     0.21     1.56     2.53  <br />
 trustknowotherpersonally |       36     1.83     0.25     1.21     2.23  <br />
           trustfirsttime |       36     2.81     0.33     2.09     3.50  <br />
       trustotherreligion |       36     2.46     0.30     1.85     3.05  <br />
    trustothernationality |       36     2.44     0.31     1.78     3.07  <br />
                 bornhere |       47     0.92     0.09     0.55     1.00  <br />
               respetlaws |       49    -0.53     1.57    -4.00     1.94  <br />
                 ancestry |       49    -0.25     1.55    -4.00     2.73  <br />
                     lang |       49    -0.55     1.52    -4.00     1.93  <br />
       immigrantstakejobs |       47     5.32     0.95     3.36     7.46  <br />
          immigrantscrime |       47     4.59     0.77     2.87     6.37  <br />
  immigrantsstrainwelfare |       47     4.53     0.92     1.87     6.41  <br />
    immigrantskeepcustoms |       47     5.58     0.69     3.88     7.07  <br />
       justifiableillegal |       13     0.06     0.29    -0.24     0.77  <br />
       justifiableimmoral |       13    -0.02     0.28    -0.47     0.35  <br />
<br />
p:\icvsnew2026augustnew.dta <br />
<br />
. fsum *<br />
<br />
               Variable |        N     Mean       SD      Min      Max                                                                                                                              <br />
------------------------+---------------------------------------------<br />
                country |       49   433.41   273.20     8.00   915.00  <br />
     neighborscriminals |       48     0.53     0.19     0.16     0.83  <br />
       priorityimmsjobs |       36     3.62     0.59     2.46     4.72  <br />
  unfairjobshandicapped |       49    -3.22     0.79    -4.00    -0.60  <br />
          workforsalary |       47     2.47     0.38     1.71     3.16  <br />
                   lazy |       47     2.28     0.38     1.68     3.60  <br />
               equality |       49    -0.15     1.15    -4.00     1.47  <br />
            competition |       49     3.05     1.03    -0.88     4.30  <br />
               concernY |       46     1.60     0.48     1.08     3.22  <br />
          neighbourhood |       47     2.81     0.36     1.67     3.67  <br />
                 region |       47     2.99     0.33     1.96     3.61  <br />
             countrymen |       47     2.91     0.30     1.96     3.43  <br />
               europeas |       47     3.44     0.25     2.85     3.95  <br />
              humanrace |       47     3.16     0.34     2.25     3.93  <br />
                elderly |       47     2.10     0.23     1.55     2.73  <br />
             unemployed |       47     2.55     0.37     1.67     3.32  <br />
             immigrants |       47     3.23     0.36     2.46     3.99  <br />
               disabled |       47     2.18     0.25     1.49     2.76  <br />
                taxrich |       49    -1.50     2.08    -4.00     5.64  <br />
              interpret |       49    -2.33     1.39    -4.00     2.03  <br />
            elecleaders |       49    -0.94     2.61    -4.00     8.88  <br />
        unemploymentaid |       49    -1.19     2.42    -4.00     8.09  <br />
         churchracedisc |       26     0.68     0.12     0.44     0.88  <br />
       churcheuthanasia |       26     0.60     0.13     0.32     0.89  <br />
    churchhomosexuality |       26     0.43     0.15     0.22     0.80  <br />
          churchecology |       26     0.60     0.11     0.34     0.85  <br />
 churchgovernmentpolicy |       26     0.28     0.10     0.15     0.45  <br />
<br />
<br />
<br />
I then typed:<br />
<br />
 collapse proudnationality - trustothernationality bornhere respetlaws-immigrantskeepcustoms justifiableillegal justifiableimmoral,by(country)<br />
<br />
. fsum *<br />
<br />
                 Variable |        N     Mean       SD      Min      Max                                                                                                                              <br />
--------------------------+---------------------------------------------<br />
                  country |       49   433.41   273.20     8.00   915.00  <br />
         proudnationality |       49     1.67     0.23     1.13     2.12  <br />
              trustpeople |       31     2.27     0.29     1.82     3.04  <br />
        trustneighborhood |       36     2.04     0.21     1.56     2.53  <br />
 trustknowotherpersonally |       36     1.83     0.25     1.21     2.23  <br />
           trustfirsttime |       36     2.81     0.33     2.09     3.50  <br />
       trustotherreligion |       36     2.46     0.30     1.85     3.05  <br />
    trustothernationality |       36     2.44     0.31     1.78     3.07  <br />
                 bornhere |       47     0.92     0.09     0.55     1.00  <br />
               respetlaws |       49    -0.53     1.57    -4.00     1.94  <br />
                 ancestry |       49    -0.25     1.55    -4.00     2.73  <br />
                     lang |       49    -0.55     1.52    -4.00     1.93  <br />
       immigrantstakejobs |       47     5.32     0.95     3.36     7.46  <br />
          immigrantscrime |       47     4.59     0.77     2.87     6.37  <br />
  immigrantsstrainwelfare |       47     4.53     0.92     1.87     6.41  <br />
    immigrantskeepcustoms |       47     5.58     0.69     3.88     7.07  <br />
       justifiableillegal |       13     0.06     0.29    -0.24     0.77  <br />
       justifiableimmoral |       13    -0.02     0.28    -0.47     0.35  <br />
<br />
.  save &quot;p:\Data\Data\ivscum.dta&quot;, replace<br />
file p:\Data\Data\ivscum.dta saved<br />
<br />
and received<br />
<br />
. merge  1:1 proudnationality -  justifiableimmoral by(country) using p:\icvsnew2026augustnew.dta<br />
factor-variable and time-series operators not allowed<br />
r(101);<br />
<br />
But thee are no factor-variable and time-series operators in either data set, What did I do wrong?  Any helpwould be appreciated,<br />
<br />
RiC Uslaner]]></content:encoded>
			<category domain="https://www.statalist.org/forums/forum/general-stata-discussion/general">General</category>
			<dc:creator>Euslaner</dc:creator>
			<guid isPermaLink="true">https://www.statalist.org/forums/forum/general-stata-discussion/general/1787192-mergin-datasets</guid>
		</item>
		<item>
			<title>Identify Outliers in Time Series Data with mostly Zeros</title>
			<link>https://www.statalist.org/forums/forum/general-stata-discussion/general/1787191-identify-outliers-in-time-series-data-with-mostly-zeros</link>
			<pubDate>Wed, 26 Aug 2026 14:33:19 GMT</pubDate>
			<description>Hello everyone, 
 
I have district level daily news reports from 2015-2015 and I want to identify days in each district that have unusually high...</description>
			<content:encoded><![CDATA[Hello everyone,<br />
<br />
I have district level daily news reports from 2015-2015 and I want to identify days in each district that have unusually high reporting. I then want to use these outliers do investigate if people react to such a high media event. <br />
<br />
Seasonal-trend decomposition seems a potential option to achieve that. However, for most districts, the fast majority of days have zero reports. For example, district 1 has 3774 observations (days), of which only 32 days have any reports at all. Applying the seasonal trend decomposition would therefor mark every day with a report as an outlier. While these days are technically outliers, I don't expect people to react to a single news report. <br />
<br />
So far, I have used the following approach:<br />
<br />

<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<pre class="bbcode_code">*** Estimate Regression
gen yhat  = .
gen resid = .

levelsof district, local(districts)

foreach d of local districts {
    quietly reg reports date i.year i.month i.dow if district == `d'
    quietly predict yhat_tmp if district == `d', xb
    quietly predict resid_tmp if district == `d', residuals
    quietly replace yhat  = yhat_tmp  if district == `d'
    quietly replace resid = resid_tmp if district == `d'
    drop yhat_tmp resid_tmp
}


*** Identify spike days
bysort district: egen resid_sd = sd(resid)
gen t_stat = resid / resid_sd
gen d_spike = (t_stat &gt; 2.576) &amp; reports&gt;=20
lab var d_spike &quot;Significantly Increased Reporting&quot;</pre>
</div><br />
I included the condition of <i>reports&gt;=20</i> to circumvent that every day with &gt;0 reporting is marked as an outlier, but it is quite arbitrary.<br />
<br />
The level of reporting is also not stable across the years. 2015 has the highest level of reporting, 2021 the lowest. Following, using just one residual standard deviation would find outliers in 2016 but probably not in 2021. I was thinking of using a rolling window technique but that would loose observations at the beginning of the time series that I need for my further analysis later on.<br />
<br />
Any ideas what the best way to go about this is?<br />
<br />
Here is an example of my data:<br />

<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<pre class="bbcode_code">* Example generated by -dataex-. For more info, type help dataex
clear
input float date double state long district float(reports year month dow)
20331  6 486  0 2015  8 1
20182 27 314  0 2015  4 6
20389 36 503  0 2015 10 3
20415 34 376  0 2015 11 1
20276 19 249  0 2015  7 2
20207 22 261  0 2015  4 3
20234  6 460  0 2015  5 2
20184 17 158  0 2015  4 1
20405 38 325  0 2015 11 5
20379  8 177  0 2015 10 7
20138  5 109  0 2015  2 4
20359 16 302  0 2015  9 1
20339 10 173  0 2015  9 2
20118 36 129  0 2015  1 5
20240 32 443  0 2015  6 1
20242 14 397  0 2015  6 3
20161  4 632  0 2015  3 6
20240 38 384  0 2015  6 1
20438 33 602  0 2015 12 3
20284 25 523  0 2015  7 3
20245 36 297  0 2015  6 6
20090 34 505  0 2015  1 5
20261 21 123  0 2015  6 1
20249  6  35  0 2015  6 3
20362 25 541  0 2015 10 4
20397 21 556  0 2015 11 4
20263 18 161  0 2015  6 3
20286 26 618  0 2015  7 5
20372 21 552  0 2015 10 7
20112 22 407  0 2015  1 6
20197 33 373  0 2015  4 7
20199 18 336  0 2015  4 2
20126 13 154  0 2015  2 6
20352 21 457  0 2015  9 1
20124  6 108  0 2015  2 4
20133 13 379  0 2015  2 6
20096  8 496  0 2015  1 4
20377 16 345  0 2015 10 5
20332 22 166  0 2015  9 2
20247 36 503  0 2015  6 1
20174  8 375  0 2015  3 5
20394 22 599  0 2015 11 1
20403 33 306  0 2015 11 3
20365 31 130  0 2015 10 7
20149 18 551  0 2015  3 1
20220 36 398  0 2015  5 2
20414  6 310  0 2015 11 7
20193  6 108  0 2015  4 3
20268 37 636  0 2015  6 1
20377 30 465  0 2015 10 5
20287 17 120  0 2015  7 6
20436 21  28  0 2015 12 1
20107 27 385  0 2015  1 1
20303 36 553  0 2015  8 1
20335 36 232  0 2015  9 5
20102 18 125  0 2015  1 3
20209 18 414  0 2015  5 5
20225  6  29  0 2015  5 7
20438  5 405  0 2015 12 3
20152 31 256  0 2015  3 4
20159 15 550  0 2015  3 4
20402 22  36  0 2015 11 2
20423 22  19  0 2015 12 2
20169 33 425  0 2015  3 7
20299 25   6  0 2015  7 4
20396 22 332  0 2015 11 3
20323 19   9  0 2015  8 7
20250  4 366  0 2015  6 4
20242  6 410  0 2015  6 3
20360 27 277  0 2015  9 2
20379  6 323  0 2015 10 7
20311 17 320  0 2015  8 2
20269  5 329  0 2015  6 2
20152 36 276  0 2015  3 4
20198  8 375  0 2015  4 1
20420  8 208  0 2015 11 6
20118 22 648  0 2015  1 5
20356  8 375  0 2015  9 5
20113 27 385  0 2015  1 7
20216 22 332  0 2015  5 5
20091 17 175  0 2015  1 6
20139 27 527  0 2015  2 5
20337 11 651 12 2015  9 7
20364 17 320  0 2015 10 6
20259 38 384  0 2015  6 6
20414  5 289  0 2015 11 7
20193 29 299  0 2015  4 3
20305 36 382  0 2015  8 3
20447 35 218  0 2015 12 5
20200  8  50  0 2015  4 3
20272 30  72  0 2015  7 5
20313 12 578  0 2015  8 4
20311 35 319  0 2015  8 2
20399 31 563  0 2015 11 6
20395  4 458  0 2015 11 2
20163  6 371  0 2015  3 1
20203  8 143  0 2015  4 6
20200 38 325  0 2015  4 3
20383 36 312  0 2015 10 4
20129 16 361  0 2015  2 2
end
format %td date</pre>
</div> ]]></content:encoded>
			<category domain="https://www.statalist.org/forums/forum/general-stata-discussion/general">General</category>
			<dc:creator>Charles Ehmat</dc:creator>
			<guid isPermaLink="true">https://www.statalist.org/forums/forum/general-stata-discussion/general/1787191-identify-outliers-in-time-series-data-with-mostly-zeros</guid>
		</item>
		<item>
			<title>Wald test</title>
			<link>https://www.statalist.org/forums/forum/general-stata-discussion/general/1787186-wald-test</link>
			<pubDate>Wed, 26 Aug 2026 02:36:21 GMT</pubDate>
			<description><![CDATA[Hi everyone, 
 
I'm running a hierarchical model to examine predictors for my outcome (yes/no), in a backward stepwise rationale, following this...]]></description>
			<content:encoded><![CDATA[<span style="font-size:14px"><span style="font-family:arial">Hi everyone,<br />
<br />
I'm running a hierarchical model to examine predictors for my outcome (yes/no), in a backward stepwise rationale, following this conceptual approach: </span></span><a href="https://doi.org/10.1093/ije/26.1.224" target="_blank">https://pubmed.ncbi.nlm.nih.gov/9126524/</a><br />
<br />
<span style="font-size:14px"><span style="font-family:arial">I have only categorical independent variables with 3-5 categories each, so after run the regression, I used Wald test for each variable to generate an <b>'overall' p-value</b> and then check if this p-value is less or equal than <span style="color:#FF0000"><b>0.20</b></span> (to decide about retain or not the variable in the final model).<br />
<b>testparm i.[variable] </b><br />
<br />
I am wondering if that is correct or if actually I have to check the p-value for each level/category of the variable, as this can <b>change the decision</b> about retain or not the variable in the final model.<br />
<br />
An example bellow - note that based on Wald test I would <b>not</b> retain this variable, but based on individual p-value I would retain it:</span></span><br />
<br />
<br />
Survey: Poisson regression<br />
<br />
Number of strata = 1 Number of obs = 4,507<br />
Population size = 1,274,022<br />
Replications = 100<br />
Design df = 99<br />
F(19, 81) = 8.61<br />
Prob &gt; F = 0.0000<br />
<br />
----------------------------------------------------------------------------------------<br />
| Jknife *<br />
<b>OUTCOME</b> | Coefficient std. err. t P&gt;|t| [95% conf. interval]<br />
-----------------------+----------------------------------------------------------------<br />
|<br />
<b>independent_variable_1</b> |<br />
2 | .1107948 .1343242 0.82 0.411 -.1557337 .3773232<br />
3 | .0821731 .1372108 0.60 0.551 -.1900828 .3544291<br />
4 | .2458391 .120644 2.04 <span style="color:#FF0000"><b> 0.044</b> </span> .0064551 .485223<br />
5 | .1734045 .1234669 1.40 <span style="color:#FF0000"><b> 0.163 </b></span> -.0715806 .4183896<br />
----------------------------------------------------------------------------------------<br />
<br />
. testparm i.<b>independent_variable_1</b><br />
<br />
Adjusted Wald test<br />
<br />
( 1) [kidwhtR_high]2.q_pca_upp = 0<br />
( 2) [kidwhtR_high]3.q_pca_upp = 0<br />
( 3) [kidwhtR_high]4.q_pca_upp = 0<br />
( 4) [kidwhtR_high]5.q_pca_upp = 0<br />
<br />
F( 4, 96) = 1.34<br />
<span style="color:#FF0000"><b>Prob &gt; F = 0.2596</b></span>]]></content:encoded>
			<category domain="https://www.statalist.org/forums/forum/general-stata-discussion/general">General</category>
			<dc:creator>Carol Gallo</dc:creator>
			<guid isPermaLink="true">https://www.statalist.org/forums/forum/general-stata-discussion/general/1787186-wald-test</guid>
		</item>
		<item>
			<title>survey weighted negative binomial regression test for overdispersion</title>
			<link>https://www.statalist.org/forums/forum/general-stata-discussion/general/1787181-survey-weighted-negative-binomial-regression-test-for-overdispersion</link>
			<pubDate>Tue, 25 Aug 2026 15:00:22 GMT</pubDate>
			<description><![CDATA[I'm reposting, hoping someone can answer.  
 
Hello, I had a quick question. I want to assess whether a count model using data from a survey suffers...]]></description>
			<content:encoded><![CDATA[I'm reposting, hoping someone can answer. <br />
<br />
Hello, I had a quick question. I want to assess whether a count model using data from a survey suffers from overdispersion. Can I test for overdispersion using the alpha parameter from a survey-weighted nbreg model? I understand why the LR test is not produced when using survey-weighted data, but can I trust the alpha parameter to properly assess overdispersion? In the case below, because the confidence interval for the alpha parameter does not contain 0, is there evidence of overdispersion?<br />
<br />
<br />
<br />

<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<pre class="bbcode_code">
     
.  local contrls ///
&gt;             c.ppage ///  
&gt;             i.race_alt ///
&gt;                       i.income ///
&gt;                          i.personal_debt ///
&gt;                          i.region ///
&gt;                         i.housetype_alt /// 
&gt;                          i.employment ///
&gt;                          i.arrested ///
&gt;                         i.asud /// 
&gt;                          i.LifetimePTSDcriteria_positive ///
&gt;                          i.any_lifetime_suicide_attempt ///
&gt;                          

. svy: nbreg home_loss `contrls', exposure(total_years) irr  
(running nbreg on estimation sample)

Survey: Negative binomial regression

Number of strata =     1                          Number of obs   =      1,283
Number of PSUs   = 1,283                          Population size = 1,258.0535
                                                  Design df       =      1,282
                                                  F(19, 1264)     =       5.59
Dispersion: mean                                  Prob &gt; F        =     0.0000

-------------------------------------------------------------------------------
              |             Linearized
    home_loss |        IRR   std. err.      t    P&gt;|t|     [95% conf. interval]
--------------+----------------------------------------------------------------
        ppage |    .982977   .0126402    -1.34   0.182     .9584894     1.00809
              |
     race_alt |
 1.Non-White  |   1.858577   .5590613     2.06   0.040     1.030141     3.35324
              |
       income |
15,000-$~999  |   2.323929   1.060695     1.85   0.065     .9491779    5.689813
$30,000-~999  |   .8925358   .4195413    -0.24   0.809     .3549242     2.24448
 &gt;= $60,0000  |   .2782457   .1839597    -1.93   0.053     .0760558    1.017946
              |
personal_debt |
2.less tha..  |   1.968493   .9617833     1.39   0.166     .7548373    5.133508
3.$15,00~000  |   1.336246   .7598767     0.51   0.610     .4379052    4.077487
4.$35,00~000  |   1.107194   .7143556     0.16   0.875     .3122585    3.925846
              |
       region |
     Midwest  |   2.420599   1.614974     1.33   0.185     .6538554    8.961153
       South  |   2.357167   1.494536     1.35   0.176     .6794933    8.177029
        West  |   .8547957   .6390102    -0.21   0.834      .197214    3.704989
              |
housetype_alt |
2.Apartmen..  |   1.482899   .5088747     1.15   0.251     .7563719    2.907285
     3.Other  |   1.184448   .8015107     0.25   0.803     .3140271    4.467501
              |
   employment |
Working pa..  |   .1982927   .1220356    -2.63   0.009     .0592864    .6632205
 Not working  |   .4308464    .184369    -1.97   0.049     .1860928    .9975055
              |
     arrested |
  1.Arrested  |   1.616884   .5399287     1.44   0.150     .8397831    3.113082
              |
         asud |
         Yes  |   1.941994   .8153613     1.58   0.114     .8521709     4.42557
              |
LifetimePTS~e |
         Yes  |   1.944238   .8600343     1.50   0.133     .8163272     4.63057
              |
any_lifeti~pt |
         Yes  |   4.136422   1.841605     3.19   0.001      1.72702    9.907229
        _cons |   .0172554   .0184194    -3.80   0.000     .0021254    .1400889
ln(total_y~s) |          1  (exposure)
--------------+----------------------------------------------------------------
     /lnalpha |   .8077066   .4349825                     -.0456491    1.661062
--------------+----------------------------------------------------------------
        alpha |   2.242759   .9755607                      .9553772    5.264901
-------------------------------------------------------------------------------
Note: Estimates are transformed only in the first equation to incidence-rate
      ratios.
Note: _cons estimates baseline incidence rate.</pre>
</div>]]></content:encoded>
			<category domain="https://www.statalist.org/forums/forum/general-stata-discussion/general">General</category>
			<dc:creator>Luis Mijares Castaneda</dc:creator>
			<guid isPermaLink="true">https://www.statalist.org/forums/forum/general-stata-discussion/general/1787181-survey-weighted-negative-binomial-regression-test-for-overdispersion</guid>
		</item>
	</channel>
</rss>
