How to compare two samples?

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

Liu
Posts: 90
Joined: Tue Jun 08, 2010 6:22 am

How to compare two samples?

Postby Liu » Wed Aug 20, 2014 11:30 am

Hi,
I want to either directly compare two sample objects, or extract them into strings and then compare or manipuate them. How can I do that?
I tried direct comparison for samples, but it doesn't work.

For example:

sample s1 1921 2010
sample s2 1920 2010

if s1=s2 then %error="Samples are the same"
else %error="Samples are not the same"
endif
show %error


Thank you.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13600
Joined: Tue Sep 16, 2008 5:38 pm

Re: How to compare two samples?

Postby EViews Gareth » Wed Aug 20, 2014 3:08 pm

What do you want to compare about them? Whether the text specification is the same, or whether they have identical observations?

Liu
Posts: 90
Joined: Tue Jun 08, 2010 6:22 am

Re: How to compare two samples?

Postby Liu » Thu Aug 21, 2014 8:28 am

I want to compare them as strings, or values. The reason is that I create multiple charts and they have different start and end date.
I have to write commands to save the information of each sample range for charts and compare them. That's why the sample comparison is very important to me.

Hope that make sense.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13600
Joined: Tue Sep 16, 2008 5:38 pm

Re: How to compare two samples?

Postby EViews Gareth » Thu Aug 21, 2014 12:53 pm

When I asked the question above I imagined that we had added a datamember for a sample to return its string specification. Turns out we didn't. So you're pretty much out of luck. I can't think of a way to do it.

For the values, the only thing available is to set the workfile sample equal to each sample, generate a series, then compare the values of the series under each sample. Something like:

Code: Select all

smpl s1 series comparison1 = 1 smpl s2 series comparison2 = 1 smpl if comparison1<>comparison2 if @obssmp>0 then 'samples are different endif smpl @all


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests