In my linear model I have the variable of interest $x$, and a whole bunch of covariates that I condition on. The coefficient is significant and positive. I have reason to believe that the connection between my x and y is best described quadratically, but since my $x$ values range from $-2$ to $2$, and I want to preserve the sign, I cubed it. Now I have $x$ and $x^3$ in my model, and the coefficients are both negative and significant. What does this imply and what should I reasonably infer?

# panel data wage equations

I have in my panel data X countries, personal IDs for each individual per country and year. The panel runs for X years.

I set the panel based on ID and year.

IDs are grouped per country.

Running OLS and controlling for i.year and i.country is yielding very different results from

xtreg dep variable indep variables, fe

Any idea what may be causing this discrepancy?

# Nonlinear Gompertz model

Is it possible to use Gompertz to model a non time series data? i.e. change t (time) into x (independent variables). Data does not involve growth or survival.

# Resolve dispute over permanently latent variable?

I have data on variables ($y, x_1, x_2$), a linear model with the following form:

$$

y = beta_0 + beta_1x_1 + beta_2x_2

$$

and a theoretical model that the residuals represent a latent variable $x_3$:

$$

hat{y} – y = x_3

$$

E.g., AOK = monthly number of Acts of Kindness with a specific coding process.

$$

AOK = beta_0 + beta_1Parents’ AOK + beta_2Best friend’s AOK

$$

$$

x_3 = “Individual Moral Kindness”

$$

- multiple linear regression shows that $x_1$ and $x_2$ have a p-value <0.001,
- $R^2 = 0.2$.

**I want to say:**

- $x_1$ and $x_2$ cause, or are correlated with latent $X_4$ that causes, 20% of the variance in $y$
- $x_3$ is the cause of 80% of the variance in $y$

**How do I respond to a skeptic who says: ONLY $x_3$ and no other variable, latent or otherwise, has a causal relationship to $y$? Can I point to p-value to strengthen my case?**

**Do I confuse cause and correlation?**

# Constructing a data set for visualization

I am enrolled in a data analysis course and part of a course, I need to find a time series data set and generate visualizations and predictions based on my understanding of the findings. Instead of searching online, I took my electricity usage for the past 8 months, and generated a data set. Sample is shown below.

There would be more columns for Days until day 31. My intention is to compare my residence consumption with utility average and neighborhood average. I need suggestions on best way to arrange the data in the data set. Does the format I posted here look good? Would this kind of column/row arrangements give good visualizations? I will be using Tableau for generating visualizations.

Thanks.

# Advantage of GLMs in terminal nodes of a regression tree?

So I’m playing around with the idea of writing an algorithm that grows and prunes a regression tree from the data and then, in the terminal nodes of the tree, fits a GLM. I’ve been trying to read up on the idea but I cant seem to find any consistent name for the technique. I’ve read it as hybrid regression trees (HRT), model trees, and functional trees. Searches on these terms turn up very little.

Am I missing another name for this? Where can I find research on the effectiveness of this?

# Access specific glossary fields without triggering first usage

I would like to know if any of the fields that are manually configured during the creation of glossary entries can be accessed manually/deliberately in a macro or newcommand – possibly of the form:

```
newcommand{expectedFirst}[1]{???}
```

where ??? would be a defintion that would use the gls label, #1, to grab a predefined field such as short, name, label, long, description, firstplural, etc. I would create a new command for each field I wanted to pull, or possibly use

```
newcommand{expectedField}[2]{???}
```

where #1 would be the label string,

and #2 represents the field I want to extract or make accessible.

I poked through the .dtx glossaries file but didn’t find any macro definitions that looked like a variable creation that I could duplicate externally. What did look interesting and potentially useful was the presence of a tracking boolean to track whether the term had been called yet or not. This boolean would be another variable I would be interested in comparing with in my custom macros.

MWE:

```
documentclass{article}
usepackage[utf8]{inputenc}
setlengthparindent{0pt}
%=========================================================================================================================================
% PACKAGES REQUIRED FOR GLOSSARIES
%=========================================================================================================================================
% Glossaries must be loaded before amsmath as per details in the following forum answer
% http://tex.stackexchange.com/questions/85696/what-causes-this-strange-interaction-between--and-amsmath
usepackage[nogroupskip,toc,acronym]{glossaries} % must come after href
usepackage{scrwfile}%http://www.dickimaw-books.com/cgi-bin/faq.cgi?action=view&categorylabel=glossaries#glsnewwriteexceeded
makeglossaries
newglossaryentry{ICPMS}{ type={acronym}, sort={inductively coupled plasma mass spectrometry}, name={ICPMS}, short={ICPMS}, long={inductively coupled plasma mass spectrometry}, first={inductively coupled plasma mass spectrometry (ICPMS)}, description={inductively coupled plasma mass spectrometry} }
begin{document}
begin{itemize}
item gls{ICPMS}
item gls{ICPMS}
%item expectedFirst{ICPMS}
end{itemize}
end{document}
```

# After installing textgreek, lgrenc.def still not available

I installed MacTeX’s texlive 2014basic to avoid having to download too much all at once. One of the papers I wanted to build uses the `textgreek`

package. Though I can install that with tlmgr

```
sudo tlmgr install textgreek
```

This still results in the following error when I try to `pdflatex`

the paper

```
! Package textgreek Error: Cannot find the file lgrenc.def.
```

I can’t figure out which `tlmgr`

package to install to get that file generated. I wonder also if I should just be using a `tlmgr generate`

command. But I can’t tell what arguments I should pass to that (`tlmgr help`

doesn’t seem to provide a relevant example).

# Substitute string that contains a backslash

I need to create a function that will transform a string such as:

```
Hellotextbackslash{}Bye
```

into this:

```
Hello \ Bye
```

I have tried using `StrSubstitute`

(from the `xstring`

package) without success. I have attempted things along these lines:

```
newcommand{TRANSFORM}[1]{StrSubstitute{#1}{textbackslash{}}{ noexpand\ }}
TRANSFORM{Hellotextbackslash{}Bye}
```

# How can I properly align two minipages under a table?

I have a table, and I want to put two legends underneath. These are minipages (I found no other way of getting this done), but I am having a hard time aligning them in the center of the page and on the same height. vspace and hspace do not move the minipage in question up or down (or left or right), but make things jump around the page unpredictably. How can I align them properly.

```
documentclass{article}
usepackage[table]{xcolor}
defhbar#1#2{%%
{color{#2}rule{4mm}{#1mm}}}
deflegbox#1#2{%%
{color{#1}rule{4mm}{4mm}} hspace{0.4mm}#2 hspace{3mm}\}
begin{document}
begin{figure}[h!]
vspace*{-4.0cm}
hspace*{-4.2cm}
centering
{setlength{extrarowheight}{50pt}%
begin{tabular}{lllccl}
arrayrulecolor{gray}hline
hline
Item Description Name & Most Recent Update & State District & Governmental Body & Bars & More bars \
hline
Item 1 & Jan 1, 2010 & District 1 & GB 3 &
hbar{14}{green} hbar{20}{green} hbar{10}{green} hbar{15}{red}
hbar{19}{red} hbar{6}{red} hbar{10}{red} &
hbar{15}{red} hbar{19}{red} hbar{6}{red} \
Item 2 & Jan 1, 2010 & District 1 & GB 3 &
hbar{14}{green} hbar{20}{green} hbar{10}{green} hbar{15}{red}
hbar{19}{red} hbar{6}{red} hbar{10}{red} &
hbar{15}{red} hbar{19}{red} hbar{6}{red} \
Item 3 & Jan 1, 2010 & District 1 & GB 3 &
hbar{14}{green} hbar{20}{green} hbar{10}{green} hbar{15}{red}
hbar{19}{red} hbar{6}{red} hbar{10}{red} &
hbar{15}{red} hbar{19}{red} hbar{6}{red} \
Item 4 & Jan 1, 2010 & District 1 & GB 3 &
hbar{14}{green} hbar{20}{green} hbar{10}{green} hbar{15}{red}
hbar{19}{red} hbar{6}{red} hbar{10}{red} &
hbar{15}{red} hbar{19}{red} hbar{6}{red} \
Item 5 & Jan 1, 2010 & District 1 & GB 3 &
hbar{14}{green} hbar{20}{green} hbar{10}{green} hbar{15}{red}
hbar{19}{red} hbar{6}{red} hbar{10}{red} &
hbar{15}{red} hbar{19}{red} hbar{6}{red} \
end{tabular}
}
caption{Here goes a table caption to describe the table}
hspace{-10cm}
begin{minipage}[t]{5cm}
vspace{1cm}
textbf{Legend 1} \
legbox{black}{Long Label 1}
legbox{blue}{Label 2}
legbox{black}{Long Label 3}
legbox{blue}{Label 4}
legbox{black}{Long Label 5}
legbox{blue}{Label 6}
legbox{black}{Long Label 7}
end{minipage}
begin{minipage}{6cm}
hspace{8cm}
vspace{-4.7cm}
\textbf{Legend 2} \
legbox{blue}{Another label}
legbox{black}{Mini}
legbox{green}{A pretty long label}
legbox{green}{A label}
end{minipage}
end{figure}
end{document}
```

Here is how it looks:

And here is how I would like it to look (line only for illustrative purposes):