matrix operation efficiency question
by oleg_komashko@ukr.net
Dear all,
Let X be a matrix and A a symmetric matrix
(dimentions are compatible)
What is the best way to compute
x'A^-1x
?
Thanks,
Oleh
8 years
To users of the cnumber.gfn package
by Sven Schreiber
Hello,
this only concerns you if you are using the cnumber.gfn contributed
function package (by Sandro Monsueto).
In the next gretl release (and in the current development versions,
snapshots and git) Allin has added a new built-in function of the same
name "cnumber" which does the same thing and which will automatically be
used instead of the package when you call the function cnumber().
Therefore the cnumber.gfn package will now be removed from the package
server.
The difference between the old packaged function and the new built-in
function is that the former printed out the result as a line of text;
the latter of course just returns the result for further assignment, as
all built-in functions do.
If you rely on the cnumber.gfn package and you cannot wait for the next
gretl release, there are several options:
- keep the cnumber.gfn package which was on your local system
- install the latest snapshot (on Windows or Mac) or compile the latest
source (on Linux)
- substitute the cnumber.gfn package with these few lines of code
suggested by Jack:
<hansl>
function scalar cnumber (matrix X)
X = X ./ sqrt(sumc(X.^2))
lam = eigensym(X'X)
return sqrt(maxc(lam) / lam[1])
end function
</hansl>
Have a good weekend,
Sven
8 years
Re: [Gretl-users] Principal component analysis: Missing values encountered
by juergen.malitte@t-online.de
Hello,
Gretl should open a window indicating the number of missing observations.
It should ask: "Continue (yes/no)?"
So the user can decide what he wants to do.
With greetings
Jürgen Malitte
-----Original-Nachricht-----
> Betreff: Re: [Gretl-users] Principal component analysis: Missing
> values encountered
> Datum: Thu, 03 Nov 2016 22:33:13 +0100
> Von: Allin Cottrell <cottrell(a)wfu.edu>
> An: Gretl list <gretl-users(a)lists.wfu.edu>
> On Thu, 3 Nov 2016, Allin Cottrell wrote:
>
> > On Thu, 3 Nov 2016, Jaromir Baxa wrote:
> >
> >> Dear all,
> >> few days ago I've updated my gretl installation from 1.9.91 to
> 2016b and >> re-run one of my examples that I use in class and I've
> found that the >> principal components analysis behaves quite
> different now (perhaps a bug): >> After performing pca on the same
> dataset as before, gretl returns "Missing >> values encountered", both
> via GUI and via console and PC's are not >> calculated.
>
> Second response: OK, I can confirm that the "pca" command used to skip
> rows in the dataset on which there were missing values (in gretl
> version 1.9.*), but in current gretl missing values provoke an error.
>
> This isn't a bug, as such, but it may not be a well considered
> change in behavior. I think the motivation for the change may have
> been related to the fact that under the old behaviour there was no
> indication of the number of missing observations that were dropped.
> But of course that could be fixed by printing a count of
> observations actually used (or dropped), rather than rejecting a
> sample containing missing observations.
>
> Thoughts from other users on this?
>
> Allin Cottrell
> _______________________________________________
> Gretl-users mailing list
> Gretl-users(a)lists.wfu.edu
> http://lists.wfu.edu/mailman/listinfo/gretl-users
>
>
8 years
Re: [Gretl-users] Principal component analysis: Missing values encountered
by juergen.malitte@t-online.de
Hello it's me again,
The window can contain the text "Continue deletes all observations with missing values"
Greetings again J. Malitte
-----Original-Nachricht-----
> Betreff: Re: [Gretl-users] Principal component analysis: Missing
> values encountered
> Datum: Thu, 03 Nov 2016 22:33:13 +0100
> Von: Allin Cottrell <cottrell(a)wfu.edu>
> An: Gretl list <gretl-users(a)lists.wfu.edu>
> On Thu, 3 Nov 2016, Allin Cottrell wrote:
>
> > On Thu, 3 Nov 2016, Jaromir Baxa wrote:
> >
> >> Dear all,
> >> few days ago I've updated my gretl installation from 1.9.91 to
> 2016b and >> re-run one of my examples that I use in class and I've
> found that the >> principal components analysis behaves quite
> different now (perhaps a bug): >> After performing pca on the same
> dataset as before, gretl returns "Missing >> values encountered", both
> via GUI and via console and PC's are not >> calculated.
>
> Second response: OK, I can confirm that the "pca" command used to skip
> rows in the dataset on which there were missing values (in gretl
> version 1.9.*), but in current gretl missing values provoke an error.
>
> This isn't a bug, as such, but it may not be a well considered
> change in behavior. I think the motivation for the change may have
> been related to the fact that under the old behaviour there was no
> indication of the number of missing observations that were dropped.
> But of course that could be fixed by printing a count of
> observations actually used (or dropped), rather than rejecting a
> sample containing missing observations.
>
> Thoughts from other users on this?
>
> Allin Cottrell
> _______________________________________________
> Gretl-users mailing list
> Gretl-users(a)lists.wfu.edu
> http://lists.wfu.edu/mailman/listinfo/gretl-users
>
>
8 years
Principal component analysis: Missing values encountered
by Jaromir Baxa
Dear all,
few days ago I've updated my gretl installation from 1.9.91 to 2016b and re-run one of my examples that I use in class and I've found that the principal components analysis behaves quite different now (perhaps a bug): After performing pca on the same dataset as before, gretl returns "Missing values encountered", both via GUI and via console and PC's are not calculated. However, in 1.9.91 everything worked and PC's were calculated if some observations had missing values at some of the variables.
Is this a bug or an intention?
Is there any easy command how to skip observations with missing values?
Thanks for help,
Jaromir Baxa
Charles University in Prague
8 years
Logit: Conditional marginal effects+S.E.
by Artur T.
Dear all,
I am just preparing lecture notes for Logit exercises. STATA is the
default software used in teaching. However, usually I also provide
gretl examples to the students.
I want to compute the conditional marginal effects of x on the binary
variable y over a range of x-values; not just at the mean. For this I am
using Allin's "lp-mfx" function -- which works just fine -- in a loop
(see the example below).
However, is there is an easy way (without manipulating Allin's package)
to replicate Stata's marginsplot() command which also reports confidence
intervals? See here:
http://www.ats.ucla.edu/stat/stata/faq/margins_graph12.htm
Thanks,
Artur
<hansl>
set echo off
set messages off
open keane.gdt -q
include lp-mfx.gfn
logit manuf const lwage
#bundle b = binary_mfx(lwage, $xlist, $coeff, $vcv, $sample,1)
#lp_mfx_print(&b)
matrix xeduc = seq(0,max(educ),1)'
matrix x = ones(rows(xeduc),1)~xeduc
matrix dp_dx = zeros(rows(x),1)
loop i=1..rows(x) -q
dp_dx[i] = binary_dp_dx($coeff, $xlist, x[i,], 1)
endloop
matrix mplot = dp_dx ~ xeduc
gnuplot 1 2 --matrix=mplot --with-lines --fit=none --output=display \
{ set arrow from 50,graph(0,0) to 50,graph(1,1) nohead ; \
set title 'Conditional marginal effects of lwage' ; \
set ylabel 'Effects on Pr(manuf)' ; \
set xlabel 'lwage'; }
</hansl>
8 years
Gnuplot 5.x nicely supports dashed + monochrome lines now
by Artur Tarassow
Dear all,
in the past I struggled really often with gnuplot when trying to plot
dashed and/or monochrome lines. However, this has changed since gnuplot
5.x. Here is a simple illustration for all (which also acts as a
personal reminder for me!):
<hansl>
clear
set echo off
set messages off
open denmark.gdt --quiet
list Lplot = LRM LRY
plot Lplot
options with-lines time-series
literal set for [i=1:5] linetype i dashtype i
literal set mono
end plot --output=display
</hansl>
Enjoy!
Artur
8 years, 1 month