Histogram with two variables
by climnios@providence.edu
Hello all,
I did a search on google and I have also done a search from within the forum list and couldn't find an answer to my question; nonetheless, please forgive me if this is posted elsewhere.
I am looking for a way to overlay the histograms of two variables in order to provide a visual comparison in a paper I'm writing.
Here's an example of a blog post describing something similar using R: https://www.spsanderson.com/steveondata/posts/2023-09-15/index.html
I have done this in R (I suppose I can export the work natively from within gretl), but let's be honest -- gnuplot is as good as it gets and I'd prefer to put my graphs together from within gretl.
As always, any help is appreciated.
Best,
Chris L.
3 months
return a bundle with a list from a series in a function
by Sven Schreiber
Hi,
I'm facing the problem how to store a series as a 1-element list in a
bundle inside a function which returns that bundle. The background is to
mirror the structure of the $model bundle which results from the 'panel'
command; there the dependent variable is in the form of the 'ylist' list
type member of the bundle. (Why that is so is maybe also worthy of
clarification, but is another question.)
The best I can come up with is to "secretely" change the input argument
type of the function from 'series' to 'list', and the caller is still
allowed to specify the name of a single series; like this:
<hansl>
function bundle ylistb(list Ly)
errorif(nelem(Ly)>1, "just want 1-elem list")
/* some basic tests
series y = Ly[1] # to see if conversion works
ols y 0 --quiet # trivial test for the converted series y
*/
list ylist = Ly # work with a "copy"
return _(ylist)
end function
open denmark
bundle b = ylistb(LRM) # single series given as anonymous 1-element list
eval sum(abs(LRM - b.ylist[1])) # 0 as wanted
list ylist = b.ylist # copy needed for printing
list ylist print # LRM as wanted
</hansl>
This works in this simple isolated setting, but there's a little problem
when I want to get it working also as the GUI function for a contributed
package. In that case it would be cleaner to really have the 'series'
type for the input field of the dependent variable. For example, for the
'series' type you get a nice drop-down list to choose from existing
series with the mouse.
So, is there another technique which can be used to put a series inside
a bundle as a 1-element list, surviving the transfer from the function
scope to the outer scope?
thanks
sven
3 months
Updates of gretl
by T L
Hello!
Is it recommended to uninstall the old version from the computer before
installing a new version of gretl?
Regards
Torbjørn
3 months
gretl, regression
by gene shackman
Hi all
I'm working on regression, in this case, just OLS. I used Birth Rate, Agriculture, Services, GDP Per Capita and Population to predict Infant Mortality.
So far, there is good news. The values that gretl generates are the same values, or close enough, to the values SAS generates. There are some differences with naming outcomes, but I'm okay with that.
I have some questions. The default output (what first appears when doing the model / OLS) includes these
| Mean dependent var | 20.75258 |
| Sum squared resid | 19737.38 |
| S.E. of regression | 9.581323 |
|
|
|
| R-squared | 0.759917 |
| Adjusted R-squared | 0.754334 |
| F(5, 215) | 136.1049 |
| P-value(F) | 1.39E-64 |
|
|
|
| S.D. dependent var | 19.33093 |
Any particular reason the Sum squared resid, S.E. of regression and the S.D. dependent var are included?
The S.E. of regression is the Root MSE on SAS's default output, so that makes sense.
And the output has the mean of the dependent var, so okay, the S.D. dependent var could make sense too.
But why is the Sum squared resid on the default output? That's on the ANOVA (as the error sum of squares), but error mean squares is also on ANOVA but not on the default output. And the model sum of squares and mean square are also on the ANOVA but not on the default output.
That is, the ANOVA has regression sum of squares and regression mean square, and the residual sum of squares and the residual mean square. But the the only thing from the ANOVA that's on the default output is the residual sum of squares. Why that one?
Thanks
Gene
3 months
gretl, correlation
by g s
Hi Sven
Thanks for responding.
"new topic"Oops, sorry. I'm now sending this as a new email. (Unless your previous email was also new).
Yes, I'm not exactly clear on what the results are showing.
1) I did a correlation matrix of the following variables: BirthRate, Agriculture, Service, GDPPerCap, Population, InfantMort. I did NOT click on "ensure uniform sample size".
The top of the results box says
Correlation Coefficients, using the observations 4 - 229
(missing values were skipped)
Two-tailed critical values for n = 221: 5% 0.1320, 1% 0.1729
A couple of results:
BirthRate and Agriculture = 0.7021Population and GDPPerCap = -0.0687
2) Next, I did another correlation matrix of the same variables, but this time I DID click on "ensure uniform sample size".
The top of the results box says
Correlation Coefficients, using the observations 4 - 229
(missing values were skipped)
Two-tailed critical values for n = 221: 5% 0.1320, 1% 0.1729
A couple of results BirthRate and Agriculture = 0.7021.Population and GDPPerCap = -0.0707
3) Next, I did a correlation matrix of JUST BirthRate and Agriculture.Here are the results:
corr(BirthRate, Agriculture) = 0.68261942
Under the null hypothesis of no correlation:
t(220) = 13.855, with two-tailed p-value 0.0000
The correlation here is different from steps 1 or 2, and also this correlation agrees with the correlation between these two variables I got using SAS.
The number of cases used to do this correlation (from an analysis with SAS) is 222.
4) Finally, a correlation of JUST Population and GDPPerCap. Here are the results:
corr(GDPPerCap, population) = -0.06858619
Under the null hypothesis of no correlation:
t(226) = -1.03351, with two-tailed p-value 0.3025
The results here are different from step 2 and very slightly different from step 1. The results, however, of the above, of JUST Population and GDPPerCap are the same as the results from SAS, = -0.06859. And, by the way, the p-value is also the same as the results from SAS.
Also, the number of cases used to do this correlation (from an analysis with SAS) is 228.
CONCLUSION: It looks like if I run correlation of JUST two variables of interest, I can get the same results as from SAS.
Just to mention, my reference was a correlation matrix from SAS of all of the above variables in the same analysis, specifying pairwise correlation.
Thanks
Gene
----- Forwarded Message ----- From: Sven Schreiber <sven.schreiber(a)fu-berlin.de>To: "gretl-users(a)gretlml.univpm.it" <gretl-users(a)gretlml.univpm.it>Sent: Saturday, June 1, 2024 at 10:29:36 PM EDTSubject: [Gretl-users] Re: Gretl: correlations
Am 30.05.2024 um 19:28 schrieb g s:
Hi all This is a new topic. In the future, please don't just reply within an existing thread (even if you change the subject line), but send a fresh email message to the list.
My data set has some missing values for some variables. When I do correlation, using the drop down menus (view and then correlation matrix), I notice that gretl reports a correlation matrix excluding all cases with any missing values for any of the variables.
I don't think that's correct. Notice that in the dialog window there's a tick box saying "ensure uniform sample". And the results differ depending on whether you tick the box or not.
However, at the top of the result printout there's the line "using obs x to y", insinuating that the same sample applies to all, even if the tick box wasn't active. So that seems to be misleading, and I guess that printout could be improved (or perhaps omitted).
cheers
sven
3 months, 1 week
gretl, x-y scatter plot
by gene shackman
Hi all
Just thought folks might want to know, I did a scatter plot of two variables in my data set, birth rate (y axis) and infant mortality (x axis). No problem doing this, the drop downs were easy to find. As far as I can tell, the resulting graph looks just like the one I got from SAS, except gretl has a least square fit line. The line is nice to have, but it might be nice to have the option to not show that, if you -just- want the x-y plot.
Good to get an easy result.
Thanks
Gene
3 months, 1 week
Anyone not getting gretl emails
by g s
Hi all
I mentioned this in another email, but I wanted to check, anyone else not getting emails from the gretl email list, or is this just me? If it's just me, I'll have to check my settings. Somewhere I must have done something.
Gene
gsociology(a)yahoo.com
3 months, 1 week
gretl, downloading windows version
by g s
Hi Allin
Thanks for responding.
Okay, -now- hopefully a new thread.
Now clicking on "gretl for Windows", and getting to the page that goes to, https://gretl.sourceforge.net/win32/now I see gretl_install-64.exe there. Was that recently added?
Should the release date for 64 say "latest release (May 21, 2024)" or should that be June 2, 2024?
Thanks
Gene
On Sun, 9 Jun 2024, g s wrote:
...
Gene: First, I hope I got this on a new thread. If not, I'll try again.
Allin: You're fine.
...
Gene: Thanks very much for pointing out where to get the 64 bit version. I'm not an experienced sourceforge user, so I wouldn't know that I have to go to the projects / files / snapshots page or to the file listing / snapshot page to get to the most up to date versions.
Allin: That's an option, but you don't have to go there.
...
Gene: When I go to the gretl main page
https://gretl.sourceforge.net/index.html the second option on the left side listing is "gretl for Windows", so that's where I go to get gretl.
Allin: That's perfectly OK. The snapshot downloads linked there (64- and 32-bit) are the same as in the files / snapshots area, it's just a different interface. The "gretl for Windows" page allows us to add a little guidance, as opposed to the "raw" listing under "files", so I'd say it's actually the recommended place to go.
Allin
3 months, 1 week