How to pass Gauss data set to likelihood function

The datamatrix that I want to pass to the lpr() procedure is "testnout" and it is in the GAUSS data format.
That is why I am writing following code.
struct DS d0;
d0 = dsCreate();
d0.dname = "testnout";

And then within the lpr() procedure definition I am trying to get the data in the local variable dta as follows:

proc lpr(struct PV p, struct DS ds_struct, ind);
   local dta;
   dta = ds_struct.datamatrix;

I would appreciate if somebody let me know what is the right procedure to pass a GAUSS data set to lpr(struct PV p, struct DS dta, ind).

Thanks and Regards.
Annesha

1 Answer



0



The DS structure has a member of every different GAUSS data type. The purpose is so that you can pass anything you like to your likelihood procedure while maintaining a consistent prototype (the number, names and types of the input arguments for your procedure) for the procedure. For example, someone may want their likelihood procedure to have one input, another may want two or three or 37, etc. The DS structure lets you pass in as much data as you need of any type. However, the DS structure is (almost entirely) empty until you place something into it. If you want something in the 'dataMatrix' member, then you need to place it there. For example, if you change your code to this:

struct DS d0;
d0 = dsCreate();
d0.dataMatrix = loadd("testnout");

assuming that you have a GAUSS dataset named testnout.dat in your current working directory. Then you likelihood procedure can look like this:

proc lpr(struct PV p, struct DS ds_struct, ind);
local dta;
dta = ds_struct.datamatrix;

...and now the 'datamatrix' member will have something inside of it. Take a look at this tutorial and I think it will help your understanding.

aptech

1,773

Your Answer

1 Answer

0

The DS structure has a member of every different GAUSS data type. The purpose is so that you can pass anything you like to your likelihood procedure while maintaining a consistent prototype (the number, names and types of the input arguments for your procedure) for the procedure. For example, someone may want their likelihood procedure to have one input, another may want two or three or 37, etc. The DS structure lets you pass in as much data as you need of any type. However, the DS structure is (almost entirely) empty until you place something into it. If you want something in the 'dataMatrix' member, then you need to place it there. For example, if you change your code to this:

struct DS d0;
d0 = dsCreate();
d0.dataMatrix = loadd("testnout");

assuming that you have a GAUSS dataset named testnout.dat in your current working directory. Then you likelihood procedure can look like this:

proc lpr(struct PV p, struct DS ds_struct, ind);
local dta;
dta = ds_struct.datamatrix;

...and now the 'datamatrix' member will have something inside of it. Take a look at this tutorial and I think it will help your understanding.


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy