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

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- density function of missing dependant variable wit...

- 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

03-04-2012 12:01 PM

Hi,

Consider a situation in which I'm trying to predict monthly sales for different stores in the past and the future (forecast). I have different monthly sales for each store.

For the moment I've model it as a longitudinal mixed model. It would be something like:

y = Xβ + Zb + ε

where y are the sales, β are the fixed effects, b are the random effects and ε are the error terms.

In the other hand, I have two different groups of data for analyzing sales, stores are subjects, and also each store belongs to a chain.

The error terms are model as an AR(1) in which the group is each chain (some chains have just 1 store and others more).

The model in SAS would look something like the following:

proc mixed data = store_sales maxiter = 100 ;

class store store_kind store_time_in_market day_week month chain ;

model Rating2 =

month month_2

day_week

store_time_in_market / solution ddfm =res outpred =pdat2008 outpredm = pdat2009 alphap=0.4 ;

random int month / subject = store type = un solution g ;

repeated month / subject = store type = AR(1) group = chain;

RUN;

I use residual degrees of freedom because I have a lot of data and using another caused too long runs.

What I want is to get the probability density function (pdf) of the predicted values in the past and in the future. I'm sure that SAS has it somewhere because in outpred I can get confidence intervals (CI) for both kinds of data.

For known dependant variable:

I've read in proc mixed user guide that CI where calculated with the following formula (Page 3973 of SAS/STAT 9.2 User’s Guide ®The MIXED Procedure (Book Excerpt) SAS®):

L[β b]' +/- t(v,alpha/2)*sqrt(LCL')

where v are the approximate degrees of freedom and C is the approximate variance-covariance matrix of (β, b). For having the pdf I would replace L by X and Z of the monthly sale that I want to predict but I haven't see any way of having matrix Cas an output

For unknown dependant variables:

Question 1 would be:

In the same book page 3934 I found a formula for getting expected values and the variance of the predicted values when I have missing dependant variables but there is nowhere where it says which is the formula for calculating the CI, do you know which is used?

Question 2 would be:

Do you know any easier way of having the pdf than manually calculating C and then doing all the matrix multiplications... something like having in an output table the predicted value (this is easy) in a column and in other the +/- factor, in the case of known dependant variable it would be sqrt(LCL') .

Question 3 would be:

I'm having trouble outputting the R matrix for some stores. For some stores I can see it in the html file and in a table that I create but in other cases I don't get anything, not even an error in the log file. Somebody have had the same problem?

Thanks a lot,

Enrique