Creating sampling distribution

For questions regarding programming in the EViews programming language.

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

gamma
Posts: 6
Joined: Wed Aug 24, 2011 7:50 pm

Creating sampling distribution

Postby gamma » Thu Aug 25, 2011 11:06 pm

Hi guys,

I am currently trying to program (this is the first semester I have ever used Eviews)
1) Create 100 observations from gamma distribution - I understand to use @rgamma (b,r)
2) Calculate the average of this sample
3) Repeat steps 1,2 one hundred times to get a data set that would have 100 estimates of mean coming from these randomly generated data sets

I'm not sure how to loop this, as the examples in the tutorial are mainly regression related.

Any hints, help would be greatly appreciated.
Thank you

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

Re: Creating sampling distribution

Postby EViews Gareth » Fri Aug 26, 2011 7:58 am

Code: Select all

create u 100 vector(100) means for !i=1 to 100 series rand = @rgamma(b,r) means(!i) = @mean(rand) next

gamma
Posts: 6
Joined: Wed Aug 24, 2011 7:50 pm

Re: Creating sampling distribution

Postby gamma » Fri Aug 26, 2011 4:33 pm

Thank you very much Eviews Gareth!

May I ask one further question, I've run this program and when I check the means there are a few N/A entries e.g. I only got 39 observations out of 100 run
Is this supposed to happen?
I am using (2,1) for (b,r) in the gamma function if it is relevant.

Thank you

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: Creating sampling distribution

Postby startz » Fri Aug 26, 2011 5:06 pm

The program ran fine for me in version 7.

Is your EViews uptodate? Any chance you made a typo?

gamma
Posts: 6
Joined: Wed Aug 24, 2011 7:50 pm

Re: Creating sampling distribution

Postby gamma » Mon Sep 12, 2011 9:14 pm

Hi startz,

The code is fine now. It appears there was an issue with the Citrix client.

Thank you for taking the time to verify the code!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests