turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- General Programming
- /
- Infinite Sum

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-28-2013 04:38 PM

Is there are formula for computing an infinite sum in SAS?

I can compute an approximation for convergent sum by using a DO-WHILE-LOOP but I am trying to do MLE for a PDF using PROC NLMIXED; the parameters are dependent on an infinite sum and will not converge if I use a loop for the infinite sum. Is there a better way to do it?

thanks

-john

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to GoBrewers14

07-01-2013 08:40 AM

This definitely sounds interesting, but more info would be helpful. The first thing that occurs to me is perhaps reparameterizing so that the optimization within NLMIXED handles the convergence. Can you share the existing code?

The other is to move to PROC IML, where you could code the series and apply some of the optimization functions available to the likelihood function. See some of the posts by Rick Wicklin on this topic.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SteveDenham

07-01-2013 10:07 AM

here is an example of what the data would look like:

=====================================

data abc;

input n count_n;

datalines;

0 20

1 65

2 84

3 72

4 45

5 17

6 6

7 1

8 1

;

run;

====================================

I want to use some type of parameter estimation to fit this data to a modified Poisson distribution called the Conway-Maxwell-Poisson distribution ( Conway–Maxwell–Poisson distribution - Wikipedia, the free encyclopedia )

so the proc step would look like...

=====================================

PROC NLMIXED data = abc;

parms m = 0.5 v=0.5;

/* here is where I need to include a infinite sum Z(m,v) = ??? */

ll = count_n*(n*log(m)-v*log(fact(n))-log(Z));

model count_n ~ general(ll);

run;

======================================

thanks,

-john

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to GoBrewers14

07-01-2013 10:45 AM

Hi John,

Questions:

1. What does your DOW loop look like?

2a. Do you have PROC IML licensed?

2b. Have you ever used R packages?

The first question may make it possible to do in NLMIXED. It looks like the programming statements within NLMIXED support looping, so you might be able to get a close approximation that way (although it seems not from your post).

Question 2 addresses a work-around. There is an R package (compoisson) that will do what you are asking. If you want to run from SAS, though, you will need IML/IML plus to access R. There may also be a "pure" IML approach. Check the postings and blog of .

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SteveDenham

07-01-2013 01:57 PM

i used the approximation suggested in the next post and then compared it the solutions given by the package you suggested in R.

the approximations are very close.

thank you for your help

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to GoBrewers14

07-01-2013 12:07 PM

Hi John, Have you considered using the approximation given in:

http://www.stat.washington.edu/research/reports/2013/tr615.pdf

PG

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to PGStats

07-01-2013 01:55 PM

this works well. thanks for the suggestion.