<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do I model a Spatial Covariance structure for panel data in Proc Mixed? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-model-a-Spatial-Covariance-structure-for-panel-data-in/m-p/321241#M16988</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/25293"&gt;@sg248&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First I hadn't been aware of the&amp;nbsp;type=sp parameter.&amp;nbsp;And I think you're right about what it supposed to do for you - namely get spatial autocorrelation.&amp;nbsp; I've looked at some examples of proc mixed with "type=sp" and I can't find any that treats your situation - constant lat/long with a subject.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This goes beyond my depth of understanding, but does this link (&lt;A href="http://www.ats.ucla.edu/stat/sas/faq/spatial_reg.htm" target="_self"&gt;http://www.ats.ucla.edu/stat/sas/faq/spatial_reg.htm&lt;/A&gt;) offer any possibilty?&amp;nbsp; It uses "/subject=intercept", and then uses a type=sp.&amp;nbsp; If you have a time variable, would it work if you used time as a third spatial dimension?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; "repeated / subject=intercept type=sp(expa) (time lat&amp;nbsp;long)"&lt;/P&gt;
&lt;P&gt;I use "expa" instead of "exp", because the SAS documentation&amp;nbsp;states that&amp;nbsp;EXP is two-dimensional.&amp;nbsp; EXPA allows more dimensions.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And yes, in the absence of a solution using "type=sp", I was proposing Y_m' as a predictor.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Dec 2016 05:19:13 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2016-12-27T05:19:13Z</dc:date>
    <item>
      <title>How do I model a Spatial Covariance structure for panel data in Proc Mixed?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-model-a-Spatial-Covariance-structure-for-panel-data-in/m-p/321197#M16984</link>
      <description>&lt;P&gt;I have time-series cross-section data (a balanced panel) with multiple markets and mutiple weeks for each market. I have the spatial location coordinates for each market as (latitude longitude). So the data look like this (these are made up):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Market latitude longitude &amp;nbsp;Week &amp;nbsp; Y &amp;nbsp; &amp;nbsp;X&lt;/P&gt;&lt;P&gt;23 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;8.73 &amp;nbsp; &amp;nbsp; 77.53 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; 34 &amp;nbsp;11&lt;/P&gt;&lt;P&gt;23 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;8.73 &amp;nbsp; &amp;nbsp; 77.53 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; 21 &amp;nbsp;12&lt;/P&gt;&lt;P&gt;23 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;8.73 &amp;nbsp; &amp;nbsp; 77.53 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3 &amp;nbsp; 62 &amp;nbsp;14&lt;/P&gt;&lt;P&gt;24 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6.73 &amp;nbsp; &amp;nbsp; 87.53 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; 24 &amp;nbsp;9&lt;/P&gt;&lt;P&gt;24 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6.73 &amp;nbsp; &amp;nbsp; 87.53 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; 45 &amp;nbsp;8&lt;/P&gt;&lt;P&gt;24 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6.73 &amp;nbsp; &amp;nbsp; 87.53 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3 &amp;nbsp; 71 &amp;nbsp;14&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;I would like to model the spatial covariance in the error between markets, as a function of spatial proximity. I tried the following program:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc mixed;&lt;/P&gt;&lt;P&gt;model &amp;nbsp; y = x;&lt;/P&gt;&lt;P&gt;repeated week/subject = market type = sp(exp)(latitude longitude);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error this produces is "a nonpositive definite estimated R matrix for subject 1". I think this is happening because (latitude longitude) is repeated within subject. But I cannot figure out how to specify the model so I can allow for covariance between markets, as a function of (latitude longitude). Any suggestions greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Dec 2016 16:04:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-model-a-Spatial-Covariance-structure-for-panel-data-in/m-p/321197#M16984</guid>
      <dc:creator>sg248</dc:creator>
      <dc:date>2016-12-26T16:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I model a Spatial Covariance structure for panel data in Proc Mixed?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-model-a-Spatial-Covariance-structure-for-panel-data-in/m-p/321222#M16986</link>
      <description>&lt;P&gt;I'm not even sure you would get spatial covariance use lat/long, regardless of the nonpositive definite matrix.&amp;nbsp; Just specifying lat/long menas you think there is an east/west or north/south (or combination) trend over your study region.&amp;nbsp; But aren't you really interested in the spatial analog of serial autocorrelation?&amp;nbsp; I mean, isn't it "economic distance from competing/cooperationg markets" that you care about?&amp;nbsp; I don't know if you're really interested in estimating&amp;nbsp;the impact of other markets, or just eliminating that impact to assess other relations, but I don't see how lat/long will help with either objective.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without getting into robust spatial analysis (see &lt;A href="https://support.sas.com/rnd/app/stat/procedures/SpatialAnalysis.html" target="_self"&gt;https://support.sas.com/rnd/app/stat/procedures/SpatialAnalysis.html&lt;/A&gt;), I think you're just trying to get the impact of distance from other markets on each given market.&amp;nbsp; Or more likely, just the impact of the nearest markets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm just speculating here, but ...&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;If you believe that influence decays with distance (and probably distance-squared as in a gravity model), why not simplify and get the most important part?&amp;nbsp; That is&amp;nbsp;generate, for each market, a weighted sum of relevant&amp;nbsp;values for all other markets &lt;EM&gt;&lt;STRONG&gt;within a given distance&lt;/STRONG&gt;&lt;/EM&gt;, i.e. within a suitably small circle.&amp;nbsp;&amp;nbsp; You could probably get a second group of intermediate distance markets as well if you think they could be relevant.&lt;/LI&gt;
&lt;LI&gt;This approach, of course, assumes that your markets are on a " homogeneous transport plane"&amp;nbsp;(i.e. symmetric and&amp;nbsp;a given distance (e.g. 20 miles) has the same impact in densely populated regions as sparsely positive).&lt;/LI&gt;
&lt;LI&gt;If the fixed-size circle technique leaves some markets without a competitor market, or you don't like the homogeneous distance implication, then perhaps you can just take the closest 1 or 2 competitors&amp;nbsp;to each of your markets.&amp;nbsp; That would presumably capture the most relevent spatial interactions.&amp;nbsp;&amp;nbsp; And it kind-of assumes that spatial competition has already generated nearest neighbors at the economically relevant distance, regardless of actual mileage.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At least this approach would unburden you of the fixed lat/long values for each market.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2016 03:09:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-model-a-Spatial-Covariance-structure-for-panel-data-in/m-p/321222#M16986</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2016-12-27T03:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I model a Spatial Covariance structure for panel data in Proc Mixed?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-model-a-Spatial-Covariance-structure-for-panel-data-in/m-p/321223#M16987</link>
      <description>Hi mkeintz,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you for your response.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Indeed I am looking for the spatial analog of autocorrelation. And I am only looking to control for (or eliminate) such impact in order to correctly assess the effect of X on Y. I am not interested in the pattern of spatial covariance per se.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I think what you are proposing is that I include a weighted sum of Y_m' as a predictor in the model for Y_m, where m' are markets in the neighborhood of market m.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I was hoping that I could achieve this outcome by allowing the errors from a model without such predictors to be correlated based on the spatial location of the market. And I thought that is what Proc Mixed allowed via the TYPE = SP option. And the different types of spatial covariance structures (e.g. EXP, LIN, etc.) allowed different relationships between distance between markets and the strength of the correlation between their errors.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If that is not so, then what does such a covariance matrix represent?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Re: How do I model a Spatial Covariance structure for panel data in Proc Mixed?&lt;BR /&gt;&lt;BR /&gt;I'm not even sure you would get spatial covariance use lat/long, regardless of the nonpositive definite matrix. Just specifying lat/long menas you think there is an east/west or north/south (or combination) trend over your study region. But aren't you really interested in the spatial analog of serial autocorrelation? I mean, isn't it "economic distance from competing/cooperationg markets" that you care about? I don't know if you're really interested in estimating the impact of other markets, or just eliminating that impact to assess other relations, but I don't see how lat/long will help with either objective.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Without getting into robust spatial analysis (see &lt;A href="https://support.sas.com/rnd/app/stat/procedures/SpatialAnalysis.html" target="_blank"&gt;https://support.sas.com/rnd/app/stat/procedures/SpatialAnalysis.html&lt;/A&gt;), I think you're just trying to get the impact of distance from other markets on each given market. Or more likely, just the impact of the nearest markets.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I'm just speculating here, but ...&lt;BR /&gt;If you believe that influence decays with distance (and probably distance-squared as in a gravity model), why not simplify and get the most important part? That is generate, for each market, a weighted sum of relevant values for all other markets within a given distance, i.e. within a suitably small circle. You could probably get a second group of intermediate distance markets as well if you think they could be relevant. This approach, of course, assumes that your markets are on a " homogeneous transport plane" (i.e. symmetric and a given distance (e.g. 20 miles) has the same impact in densely populated regions as sparsely positive). If the fixed-size circle technique leaves some markets without a competitor market, or you don't like the homogeneous distance implication, then perhaps you can just take the closest 1 or 2 competitors to each of your markets. That would presumably capture the most relevent spatial interactions. And it kind-of assumes that spatial competition has already generated nearest neighbors at the economically relevant distance, regardless of actual mileage.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;At least this approach would unburden you of the fixed lat/long values for each market.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Dec 2016 03:26:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-model-a-Spatial-Covariance-structure-for-panel-data-in/m-p/321223#M16987</guid>
      <dc:creator>sg248</dc:creator>
      <dc:date>2016-12-27T03:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I model a Spatial Covariance structure for panel data in Proc Mixed?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-model-a-Spatial-Covariance-structure-for-panel-data-in/m-p/321241#M16988</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/25293"&gt;@sg248&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First I hadn't been aware of the&amp;nbsp;type=sp parameter.&amp;nbsp;And I think you're right about what it supposed to do for you - namely get spatial autocorrelation.&amp;nbsp; I've looked at some examples of proc mixed with "type=sp" and I can't find any that treats your situation - constant lat/long with a subject.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This goes beyond my depth of understanding, but does this link (&lt;A href="http://www.ats.ucla.edu/stat/sas/faq/spatial_reg.htm" target="_self"&gt;http://www.ats.ucla.edu/stat/sas/faq/spatial_reg.htm&lt;/A&gt;) offer any possibilty?&amp;nbsp; It uses "/subject=intercept", and then uses a type=sp.&amp;nbsp; If you have a time variable, would it work if you used time as a third spatial dimension?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; "repeated / subject=intercept type=sp(expa) (time lat&amp;nbsp;long)"&lt;/P&gt;
&lt;P&gt;I use "expa" instead of "exp", because the SAS documentation&amp;nbsp;states that&amp;nbsp;EXP is two-dimensional.&amp;nbsp; EXPA allows more dimensions.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And yes, in the absence of a solution using "type=sp", I was proposing Y_m' as a predictor.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2016 05:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-model-a-Spatial-Covariance-structure-for-panel-data-in/m-p/321241#M16988</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2016-12-27T05:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do I model a Spatial Covariance structure for panel data in Proc Mixed?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-model-a-Spatial-Covariance-structure-for-panel-data-in/m-p/321287#M16989</link>
      <description>&lt;P&gt;Thank you, mkeintz.&lt;/P&gt;&lt;P&gt;The ats.ucla link that you provided led me to this reference book&lt;/P&gt;&lt;P&gt;&lt;A href="http://ebooks.cawok.pro/SAS.Publishing.SAS.for.Mixed.Models.2nd.Edition.Mar.2006.pdf" target="_blank"&gt;http://ebooks.cawok.pro/SAS.Publishing.SAS.for.Mixed.Models.2nd.Edition.Mar.2006.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;that seems to have a very detailed chapter 11 on using Proc Mixed to estimate Spatial Covariance structures. I hope to find a solution there. I appreciate the input and help.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2016 12:09:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-model-a-Spatial-Covariance-structure-for-panel-data-in/m-p/321287#M16989</guid>
      <dc:creator>sg248</dc:creator>
      <dc:date>2016-12-27T12:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I model a Spatial Covariance structure for panel data in Proc Mixed?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-model-a-Spatial-Covariance-structure-for-panel-data-in/m-p/321301#M16991</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/25293"&gt;@sg248&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm quite curious to know the resolution of this problem.&amp;nbsp;&amp;nbsp; Please post it when you find one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2016 15:43:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-model-a-Spatial-Covariance-structure-for-panel-data-in/m-p/321301#M16991</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2016-12-27T15:43:05Z</dc:date>
    </item>
  </channel>
</rss>

