How to Estimate Spatial Panel Data Models in Stata

Поділитися
Вставка
  • Опубліковано 3 лют 2025
  • Ігри

КОМЕНТАРІ • 210

  • @hollythurston6260
    @hollythurston6260 Рік тому +3

    Hello Diogo, looks like it’s been 5 years since you posted this and it’s still helping people! I would never had figured out some of the idiosyncrasies to formatting without your help! Thanks so much!

  • @leaftr
    @leaftr 2 роки тому

    Thank you so much from Turkey for telling us what we couldn't find in the books.

  • @ameliase.me.3223
    @ameliase.me.3223 4 роки тому +1

    I don’t know what my research would be like without your guidance here. Thank you from Indonesia.

  • @HalitDuran-z6b
    @HalitDuran-z6b Рік тому

    Hi Diogo. With your guidance with this tutorial , I managed to publish my latest article on a very important journal in the field.
    Thanks a lot.

    •  Рік тому

      Thanks for sharing and congrats! I'm happy for you.

  • @GizemAcetDonmez
    @GizemAcetDonmez 2 роки тому

    The most useful video on UA-cam I've ever watched. Thank you so much!

  • @ridhotamadarsih9680
    @ridhotamadarsih9680 7 років тому +2

    wow... thank u for your channel. I was looking this information months ago but I found nothing, and thanks for share your knowledge in here which is very important to me. Thanks.

  • @simonhan9932
    @simonhan9932 8 місяців тому

    Thank you so much from Cambridge!! You are literaturally a hero !

  • @mahatmaalimibrahim6631
    @mahatmaalimibrahim6631 4 роки тому +4

    fantastic! i really appreciate your generosity and knowledge you have shared with us. Thank you a lot.

  • @Edward_Sub
    @Edward_Sub 7 місяців тому

    such a great tutorial, thanks helped me a lot for my phd thesis

  • @davidmerriman3647
    @davidmerriman3647 3 роки тому

    It is very kind of you to post this helpful video.

  • @diegofelipelopezospina1363
    @diegofelipelopezospina1363 7 років тому

    Es único este video en cuanto al tema, explicación y tratamiento de la información. Muchas gracias Nuno por subirlo.

  • @sethusimelane2662
    @sethusimelane2662 2 роки тому +3

    I think you helped me save my dissertation. Very informative! Thank you

  • @halitduran5564
    @halitduran5564 4 роки тому

    thank you very much for this highly informative video. It helped me a lot in running spatial panel data models in stata.

  • @curiositytoknowledge5393
    @curiositytoknowledge5393 2 роки тому

    Thanks, sir, for such an informative video

  • @LH-tp4ct
    @LH-tp4ct 5 років тому

    Thank you so much for this fantastic teaching! I have learned so many useful things.

    •  5 років тому

      Thanks Lisa

  • @kelas-statistik
    @kelas-statistik 5 років тому +1

    Terima kasih banyak Sir. Sangat membantu sekali dalam penelitian saya

  • @두더지대왕
    @두더지대왕 6 років тому

    Wow, it was a perfect example!! Thank you very much!!

    •  5 років тому

      Thank you very much :)

  • @阿凡提-q5y
    @阿凡提-q5y 2 роки тому

    thank you for all of data files.

  • @siasmaul19
    @siasmaul19 7 місяців тому

    Thank you for providing the spatial panel analysis tutorial. But how to display the residuals from the model so that classical regression assumptions can be tested?
    And how we get LM test and LR test?

  • @AD-ds6gy
    @AD-ds6gy 4 роки тому

    This was incredibly helpful. Thank you!!!!!

  • @MrDamon76
    @MrDamon76 5 років тому

    You are great!! Your lecture is fantastic!

    •  5 років тому +1

      You are great too :p thanks!

  • @ticianagreccozanonmoura3294
    @ticianagreccozanonmoura3294 6 років тому

    Obrigada, Diogo! Muito bom o seu vídeo, o melhor que já vi.

    •  6 років тому

      Muito obrigado senhora

  • @faridzarmast4907
    @faridzarmast4907 4 роки тому

    Thank you soo much. It is very helpful. please do similar video for cross section data and if we can use it for spatial regression.

    •  4 роки тому +1

      Hi. Thank you. For cross section data you don't need to use stata. You can run the regression in Geoda. Good luck!

  • @shuangli9316
    @shuangli9316 4 роки тому

    thanks for your sharing i learnt a lot

  • @cu19591
    @cu19591 3 роки тому +1

    Hi Diogo, thank you very much for this excellent tutorial. I followed your instructions carefully, but when I got to the part where I issue the command "spmat dta W m*, ...", Stata gives me the following error message: "main diagonal must contain zero elements". I'm not sure why I'm getting this message because I downloaded your weights file and compared it to mine and they look similar...

    •  3 роки тому

      Hi. The matrix must have only 0s in it's diagonal, otherwise the spatial units are neighbours of themselves, which doesn't make sense.
      For example, the matrix must have its first value as a 0, because the first observation/spatial unit can't be a neighbour of itself.
      Imagine a matrix of Portugal and Spain (they are neighbours). The matrix would be:
      0 1
      1 0

  • @GulshanKumar-wm5it
    @GulshanKumar-wm5it 6 років тому

    Thank you for the informative video!!

    •  5 років тому

      Thank you sir

  • @ВазифаАхмедова

    hi, thanks for the video, could you tell me how to download the matrix of weights from excel in the stata (in excel, the matrix of trade flows by region)

  • @outps
    @outps Рік тому

    Is there away someone can reach out to you, thank you. This video is really great but could use more guidance as I am a beginner on this and no one in my circles has an idea

  • @sajidnoor9482
    @sajidnoor9482 5 років тому +3

    Hi Diogo, Thanks for uploading this video. You are awesome. However, I have a question. Is it possible to get direct, indirect, and total effects for spatial panel model? Such as Spatial panel durbin model or spatial panel lag dependent variable? Your answer will be appreciated. Thanks

    • @vaibhavpuri9278
      @vaibhavpuri9278 Рік тому

      The paper he refers to by Belotti & Hughes has the command 'effects' within the main command 'xsmle' to compute these effects. Do refer the paper, it is very detailed!. Thanks @Diogo for this amazing tutorial.

  • @materialystudenci3728
    @materialystudenci3728 5 років тому +1

    It's a great video!, thanks

  • @PoYinChang
    @PoYinChang 2 роки тому +1

    Hi Diogo.
    Thanks for the excellent tutorial video, it describes the whole process of learning spatial regression and it helped me a lot. When I convert shp > gal > txt files, I have a question.
    There are some islands in my research data, how can I solve the problem that the islands have no neighbors?
    Thank you!

  • @nikeesilayach3685
    @nikeesilayach3685 8 місяців тому

    Greetings Diogo,
    Thank you for uploading this; it is really helpful. I have a question. What if we are not considering every district or municipality? What if we have data for only 30 out of 35 areas? How should we go about that?

    •  8 місяців тому

      Hey. If you have missing/unbalanced data, check the paper I reference at the end of the video (the link is in the description). They explain your options.

    • @nikeesilayach3685
      @nikeesilayach3685 8 місяців тому

      I've excluded five states from my analysis because I lack any information about them. The paper suggests imputation, but unfortunately, that's not feasible in my case. Among the excluded areas, two are islands with no shared boundaries with any other states, two share a border with just one state each, and one shares borders with three states. I'm wondering if there's an alternative approach to address this issue. Specifically, I'm considering dropping these five states at the time of creating the spatial weight matrix. Would this be a viable solution?

    •  8 місяців тому

      @@nikeesilayach3685 It may be a viable solution to exclude States from your study.
      If you are going for a contiguity spatial weights matrix (as I show in this video), by definition, you must exclude islands.
      Regarding the 3 states for which you have missing data, assuming you have no way of getting hold of the missing data and you cannot find a way to input the missing data, in my opinion, you are left with no good options.
      You can exclude those 3 states from your analysis but this can potentially limit the explanatory power / scope of your study (because you are in effect pottentially ignoring significant spatial interactions between states).

  • @rifathossain6752
    @rifathossain6752 4 роки тому

    Very helpful. I just wanted to know, If I have any neighborless spatial unit, then what I should do? I don't want to remove them from the analysis because they are important. TIA

  • @salaheddinesarihassoun3861
    @salaheddinesarihassoun3861 9 місяців тому

    Thank you very much

  • @soufianemahjoubi5758
    @soufianemahjoubi5758 3 роки тому

    I have to estimate SDM ans SEM model without log, it's possible to estimate that??

  • @estheramoako1197
    @estheramoako1197 Рік тому

    Hello Diogo, I find your video to be very helpful. I performing a similar analysis with Chicago census tract data and I keep getting the error that "
    main diagonal must contain zero elements". I am finding it difficult to identify where the issue is in the matrix. Is there a way to directly contact you for assistance? Thank you.

    •  Рік тому

      Hello,
      The matrix must have only 0s in its diagonal, otherwise the spatial units are neighbours of themselves, which doesn't make sense.
      For example, the matrix must have its first value as a 0, because the first observation/spatial unit can't be a neighbour of itself.
      Imagine a matrix of Portugal and Spain (they are neighbours). The matrix would be:
      0 1
      1 0
      Check your matrix carefully!

    • @estheramoako1197
      @estheramoako1197 Рік тому

      @ thanks, I will go through it again. Thank you.

  • @andi5023
    @andi5023 3 роки тому

    Hello Diogo Tome,
    I tried replicating the do-file you wrote, but it does not work for the data I am using.
    I use provincial-level data in Indonesia. Can you provide input? I would be delighted if you could help. I am very willing to provide the data da do-file that I have written.
    Thank you.

  • @sayedshad722
    @sayedshad722 6 років тому +1

    Hi Diogo, your video is helpful. Thanks. I use xsmle, but how to do LM error and LM lag tests for each effect? fixed effect and time fixed effect for example

  • @vasconceloswakim
    @vasconceloswakim 4 роки тому

    hello there, All the examples, beforing, are to balanced panel, so you could show us as estimating an unbalanced panel data in Stata?

  • @ShivamKumar-jl1rj
    @ShivamKumar-jl1rj Рік тому

    hi diogo, thankyou for this really informative video. I am actually encountering a problem i.e. the univariate local moran 1 is not showing the island data but the .gal file is showing it and even after i edited it and added artificial neighbours to the islands, stata is showing invalid data

  • @ramonbicudo5220
    @ramonbicudo5220 4 роки тому

    Dear Diogo Tomé, thanks for the very usefull video. I have a doubt and I would like to address. Do STATA compute the Global and Local Durbin Models. The local is known as Spatial Durbin Error Model. Thanks.

  • @mannniron8042
    @mannniron8042 6 років тому +1

    So cool!! Thanks very much~

    •  6 років тому

      Thank you!

  • @mohddec
    @mohddec 2 роки тому

    Hi, When I plug in my data I am getting 3200 conformability error

  • @aurelieshapiro1520
    @aurelieshapiro1520 7 років тому

    very well done, thank you so much!

    •  7 років тому

      Thank you!

    • @aurelieshapiro1520
      @aurelieshapiro1520 7 років тому

      so i'm pretty new to Stata - is it possible to create a variable list and then run the models on a list instead of copy pasting the variable list?

    •  7 років тому

      Aurélie Shapiro yes just work on a .do file and then run it!

  • @itzkumarc
    @itzkumarc 4 роки тому

    Without a shape file what is the procedure to create a weight matrix only by using panel data
    Please give the code. it will very helpful to me

  • @mohammedsyedulislam6449
    @mohammedsyedulislam6449 4 роки тому

    In the following command "xsmle Y X1 X2 X3, wmat(W) model(sdm) fe type(ind) nolog" I assume this is spatial fixed effect model. inside the parenthesis, what does "ind" stand for? For SDM direct, indirect, total effects model, how can we define short-run and long-run? I would appreciate if you refer any material.

  • @mohammadrezaeskandariata7066
    @mohammadrezaeskandariata7066 4 роки тому

    thanks for useful video.I have question about regression with two matrix, I mean one regression with two lag matrix and than two rho coefficient, plz help me how could run and find codes for stata, thank you very much.

  • @thiago_af
    @thiago_af 3 роки тому

    What should I do if the gspre model has problems with initial values?

  • @youhenok
    @youhenok 5 років тому

    Hi Diogo, Thank you for the video. Do you have any knowledge on the spm package? It extends the xsmle that is able to estimate spatial models using two spatial weights. 'help spm' in stata command.

  • @mohammedsyedulislam6449
    @mohammedsyedulislam6449 4 роки тому

    For SDM with spatial fixed effects [data transformed according to Lee and Yu (2010)], there is a error report "variable wmat not found". For all Hausman Test, error report "_xsmle_hausman_ml(): 3200 conformability error" and ": - function returned error" shows. How may I fix these report? Thanks in advance.

    • @mohammedsyedulislam6449
      @mohammedsyedulislam6449 4 роки тому

      Is there any issue with weight matrix?, though I created weight for 48 continental states plus Washington D.C. (USA).

    • @mohammedsyedulislam6449
      @mohammedsyedulislam6449 4 роки тому

      I could solve the weight matrix, but still suffering with Hausman Test. Do you have any advice please?

  • @sofwatunnida6410
    @sofwatunnida6410 2 роки тому

    Hi Diogo,
    Thanks for your video! it's very helpful!
    I have a question, is the "id" in the weights="mun" file in the data panel? I mean, should we have the same code in the both files?

    •  2 роки тому

      Correct. The IDs have to represent the same thing both in weights file and in the excel data

    • @sofwatunnida6410
      @sofwatunnida6410 2 роки тому

      @ thank you for your reply

  • @minxiong4173
    @minxiong4173 3 роки тому

    This video is really helpful. But when I tried to import a 283*283 contiguity matrix from Geoda into Stata, Stata showed that my system has run out of application memory. Do you know how to fix it? Thank you.

  • @aakb1978
    @aakb1978 4 роки тому

    Thank you soo much, Diogo Tome, It is very helpful, please Do you have any idea of how to convert GeoDa.kwt ( kernel density file) to Stata.dta?

  • @adefitriansyah1186
    @adefitriansyah1186 5 років тому

    Hai Diogo, Thanks so much for your presentatiton and sharing this video. It's amazing. By the way, do you have tutorial about
    estimate spatial dependence destination-based model, for flow data like migration? can u share please...

  • @wylmorconstantinotivesdalf1146
    @wylmorconstantinotivesdalf1146 3 роки тому

    Diogo, bom dia. Tenho duas dúvidas que preciso tirar com você, pode me ajudar? estou acompanhando sua análise, porém fiquei perdido em entender, pois primeiro você renomeou as variáveis para m (até ai eu entendi), mas depois quando montou o painel, utilizou as variáveis v (quais seriam essas variáveis, não consegui entender de onde tirou essas variáveis, poderia esclarecer por favor?), obrigado, ótimo vídeo

    •  3 роки тому

      Olá :) mudei de v para m o nome das colunas da matriz espacial para que mais tarde, quando usei as variáveis para estimar os modelos espaciais, não houvesse conflito.
      Só tive de fazer isso porque escolhi chamar às variáveis v1, v2 e v3 (vê o ecrã no minuto 19:40)... mas se tivesse dado outro nome às variáveis, desde que depois fizessem match com o código (vê o ecra no minuto 35:20), não ia haver problema.
      Para estimar qualquer modelo econométrico, precisas de dados de variáveis (no exemplo sao as variáveis v1 v2 e v3). Adicionalmente, por aqui estarmos a estimar modelos espaciais, precisas também da matriz espacial (em que às colunas dei o nome m)
      Qualquer dúvida diz

  • @thiagoless
    @thiagoless 3 роки тому

    Thank you for sharing your knowledge. I would like to ask you a question if you don't mind.
    I tried to execute the spwmatrix command in order to export the weight file to txt. But, it didn't work. A message "J(): 3900 unable to allocate real [5300108,5300108] -- spwmatrix_CalcSPweightM(): - function returned error -- : - function returned error" just showed up...
    I have 5565 Brazilian municipalities in the sample.
    Can you help?

    • @thiagoless
      @thiagoless 3 роки тому +1

      I figured out the problem in my case. My ID variable started with large numbers, like 1100015. So, I changed the sequence, starting by 1, 2,..., 5565. It worked!

  • @alissonbarreto2841
    @alissonbarreto2841 4 роки тому

    When I ran the code, the following error happend with my own data " _xsmle_hausman_ml(): 3200 conformability error
    : - function returned error" . Do you know how can I peform the Hausman test in this case?

  • @japhet-calebkacou8624
    @japhet-calebkacou8624 3 роки тому +1

    Perfect

  • @michaelbacus5667
    @michaelbacus5667 6 років тому

    Hello. Thank you for the very informative video. I'm trying to use the codes to model viral circulation. I encountered an error stating "matrix not square". I think I followed your instructions on how to import the weights in stata. Can you perhaps suggest how to overcome this error? Thank you very much.

    •  6 років тому

      Michael Bacus hey thanks! Make sure the data you're using for the weights has no problems... If you're using a gal file for your weights, I'd take a look into that using notepad. Obviously matrixes need in a rectangular or square form...

    • @michaelbacus5667
      @michaelbacus5667 6 років тому

      Thank you. I've fixed my data already. Can I get your email if it's alright? I have a few more questions regarding spatial models. I'm still a newbie in modelling and I'd appreciate it if you can advise me on certain things. Thank you very much once again.

  • @anisaputrialiya2023
    @anisaputrialiya2023 2 роки тому

    hai sir, i want to ask, my file weight cant open in stata. this wrong 'file already exist' what should i do sir? pls help me 🥺🥺

    •  2 роки тому

      Type clear on the command window

  • @momo_persian
    @momo_persian 7 років тому

    So helpful. Thank you

  • @rifathossain6752
    @rifathossain6752 4 роки тому

    Can anyone please tell me how can I generate a lagged independent variable for spatial panel data in Stata.

  • @ILoveRoblox36623
    @ILoveRoblox36623 7 років тому

    It will be great if you did a video for Spatial unbalanced panel

    •  7 років тому

      I appreciate your suggestion. I should have said in the video that you cannot run the xsmle command with unbalanced panels.
      If you do, you get this message: Error - the panel data must be strongly balanced with no missing values.
      So, if you have missing values in your data (you can see if you do by typing "mdesc" in Stata), you have to deal with them.
      You can use the multiple imputation method (in Stata: mi impute regress) to fill in the missing values with "plausible" values.
      Here's a video showing how to do just that: ua-cam.com/video/i6SOlq0mjuc/v-deo.html
      Also check this link explaining how to run the xsmle command while using an mi estimate: www.econometrics.it/?p=383
      You can also see the paper I linked in the description of the video, it adresses unbalanced panels with an example.

    • @ILoveRoblox36623
      @ILoveRoblox36623 7 років тому

      THANKS

  • @EsinaViwn9
    @EsinaViwn9 6 років тому

    Thanks a lot, sir! Are there any subtleties when using matrix based on distances? Will we see extention of this video with weights matrix based on distances?

    •  6 років тому +1

      Hey thanks for your comment. About your first question. When you create a spatial weights matrix in Geoda based on contiguity, the matrix is saved as a .gal file. When you create one based on distance, it saves it as a .gwt file. That's the first subtlety. If you scroll down and read the other comments you will find one telling you how to import a .gwt file into Stata. If there are other subtleties, it will be on how to actually use the distance weights in Stata, after you have imported it. At that point if you struggle I say just search on google for the answers cos I honestly don't have them at the top of my head. Second question. Unlikely, maybe you can do it? :P

  • @jsjcptbtptp
    @jsjcptbtptp 5 років тому

    You are an awesome teacher .how to get your "code.do" I am in trouble

    •  5 років тому

      here:
      drive.google.com/file/d/0By5qMMVfcc4jRHJfNExjUV9pd2c

  • @fawzibanao2139
    @fawzibanao2139 4 роки тому

    Dear,
    Thank you for your presentation, can we receive stata command by email?

    •  4 роки тому +1

      Hi, links are in the video description

  • @aryajodi
    @aryajodi 6 років тому

    it's a great video bro !! however, is the spwmatrix command only works at Stata 12 above? I was following your guidance, yet i could not execute the spwmatrix import...sorry for my very basic question, I am a newbie here in stata...

    •  6 років тому

      Hey thanks! Send me the error message you got?

  • @borismu8268
    @borismu8268 5 років тому

    Hi! When I am importing the gal file the system saya
    : 3499 spwmatrix_CalcSPweightM() not found
    I have installed the spwmatrix but it still doesn't work.

    •  5 років тому

      sorry man I don't know how to trouble shoot that...

  • @raymondhuang4741
    @raymondhuang4741 5 років тому

    Hi! Thank you for your information! I used your methods and it kind of works, but the problem is my gal file contains 2235*2235 obs, which fail to generate a txt. file by running the spwmatrix and xport command. In this case what should I do? I appreciate your help!

    • @raymondhuang4741
      @raymondhuang4741 5 років тому

      PS: by running the command of spwmatrix in STATA, I got "too many variables specified
      error in line 2,235 of file r(103);"

    •  5 років тому

      @@raymondhuang4741
      Hey, your problem may have to do with limitations on the Stata you're using. You need to be running on Stata/MP for it to accept that matrix size. Quoting from the 2017 paper I link in the description (page 7):
      "It is worth noting that the maximum dimension of a single Stata matrix depends on Stata’s flavor: 40 × 40 (Small) 800 × 800 and 11,000 × 11,000 (SE or MP). In order to overcome this limitation, bigger matrices have to be specified as spmat objects."

  • @UmerShehzadmynameisumer
    @UmerShehzadmynameisumer 6 років тому

    Hello Sir, Can you guide how can i get weights for countries? i want to do spatial analysis for my thesis. total 40 countries and 4 regions. How can i make or get shape and weights?

    •  6 років тому

      Try here: www.diva-gis.org/gdata

  • @nasrinebrahimmi953
    @nasrinebrahimmi953 7 років тому

    thanks for useful video. I want to estimate spatial panel var model, but I can't find it's command. Can you help me?

    •  7 років тому

      Hey, thanks for your comment.
      You can use the pvar package to estimate panel VAR models in Stata. As for spatial panel VAR models, I'm afraid there isn't a simple command that will do the trick.
      Check out these 2 articles, maybe they can be of use to you:
      - "Ageing shocks and short-run regional labour market dynamics in a spatial panel VAR"
      - "Ripple effects of house prices: considering spatial correlations in geography and demography"
      Good luck!

  • @paularamos2612
    @paularamos2612 3 роки тому

    Caro Diogo, obrigado pelo vídeo. De grande valor para todos! Estou com um problema em relação à importação da matriz do GeoDa. Tentei esse código: spwmatrix import using "$data\Weight.gal", wname(Wcontig) xport(Wcontig, txt), mas tem dado erro (aparece a mensagem file Wcontig.txt could not be opened). Você tem alguma ideia do que possa estar acontecendo?

  • @abdelhadibenghalem1332
    @abdelhadibenghalem1332 5 років тому

    Hi sir, i Am a first year PhD sudent. I want to test the spatial effects of entrepreneurship on economic development for the middle East and North Africa region. Is that possible? If yes, I can't extract the shapefile for the whole region! Please I need your help

    •  5 років тому +1

      It is possible. First you have to define how you're going to measure "entrepreneurship", because that's going to be your dependent variable (and you probably will want to include "entrepreneurship in neighbouring spacial units" as an independent variable too). Your spatial units could be countries or --probably better-- cities. A distance matrix will work best in this case. It all depends on how you frame your goal. Good luck!

    • @abdelhadibenghalem1332
      @abdelhadibenghalem1332 5 років тому

      @ thank you sir. If you Are interested we can publish this article together. Just send me your e-mail. Otherwise I am very grateful for your help. Thank you again.

  • @izalukassra
    @izalukassra 5 років тому

    Hey Diogo. Great video
    I have successfully created the weight matrix for my country. Can even run the basic reg. command.
    However, whenever I try to use one of the spatial models (example), the following error occurs.
    Example: xsmle dun popdens month_6, wmat(W) model(sar) fe nolog

    My Panel is Strongly ballanced.
    *: 3200 conformability error
    _xsmle_est(): - function returned error
    : - function returned error
    My Stata is fully up to date and I literally have tried every single link on google.
    Would be thankful for any sort of advice as to what might be causing this issue.
    Lukas

    •  5 років тому

      did you set your data as panel data?

    • @lololofon
      @lololofon 5 років тому

      @
      Yes it is set as Panel Data. Every single step, until the actual spatial estimation ran smoothly and without any issues.

  • @kbrelm3000
    @kbrelm3000 7 років тому

    Hi: I have a problem again. I am very satisfied if you can help me. The weight matrix I use is the threshold matrix. I did not have any problem for the lower values, but when I made it for 400km it gave me an error.(Initial values not feasible R (1400))...I how to this problem..

    •  7 років тому +1

      Hi. I suggest you read what's been said in these 2 links:
      1.
      www.statalist.org/forums/forum/general-stata-discussion/general/1400685-problem-with-weights-matrix-in-spatial-panel-model-xsmle
      2.
      www.statalist.org/forums/forum/general-stata-discussion/general/1398048-xsmle-initial-values-not-feasible-numerical-overflow

  • @kbrelm3000
    @kbrelm3000 7 років тому

    Hi.. I want to guess with the gmm. Could you help in estimating the gmm for the spatial panel model in the stata program.

    •  7 років тому

      Hey Kübra, sorry for the late reply. The xsmle command uses the Quasi-Maximum Likelihood (QML) estimation method. Unfortunately, I'm not aware of any way to estimate spatial panel data models in Stata using Generalized Method of Moments (GMM) techniques... But using the QML method shouldn't be a problem: Soro, W. L.; Zhou, Y. and Wayoro, D. in “Crash Rates Analysis in China using a Spatial Panel Model” (2016, p.2) say that it's recognized that “the ML and QML methods are so far the most appropriate methods to fit spatial panels”.

    • @kbrelm3000
      @kbrelm3000 7 років тому

      thank you

    •  6 років тому

      www.statalist.org/forums/forum/general-stata-discussion/general/1349975-spregxt-new-stata-module-econometric-toolkit-to-estimate-spatial-panel-regression-models
      (SPGMM) Spatial Panel Autoregressive Generalized Method of Moments Model

  • @mingyangli7152
    @mingyangli7152 4 роки тому

    Hello Diogo, thank you so much for this informative tutorial! I have a question. Your data is perfectly balanced. Can your code/weights be applied to an unbalanced data set? Thank you again.

    •  4 роки тому +1

      Xsmle won't run if you have unbalanced panel data. If you search the comment section you will find some people raising this issue and hopefully some helpful replies. There are work arounds. You can transform the missing data using mi. The xsmle paper I link in the description has a section showing how to do it. That said, if I were you I'd make sure that data I was using was balanced.

    • @mingyangli7152
      @mingyangli7152 4 роки тому +1

      @ Cool! I appreciate your instant and helpful answer. Take care, sir.

  • @aurelieshapiro1520
    @aurelieshapiro1520 7 років тому

    so I get "initial values not feasible" in my SAR models...what does this mean and how can I fix it?

    •  7 років тому

      I suggest you do a google search like this: "Initial values not feasible" xsmle (with the " " so it searches exactly those terms). You can usually find the solution to any problem in forums.
      Check these 2 links:
      www.statalist.org/forums/forum/general-stata-discussion/general/1400685-problem-with-weights-matrix-in-spatial-panel-model-xsmle
      www.statalist.org/forums/forum/general-stata-discussion/general/1398048-xsmle-initial-values-not-feasible-numerical-overflow
      Good luck!

  • @dr.tunakanduran3378
    @dr.tunakanduran3378 Рік тому

    wonderful

  • @jianhuazhang1808
    @jianhuazhang1808 6 років тому

    Hi bro thanks for your useful video. But i have a problem when I ran mine. I ran step by step according to your commands with my data, my when I ran 'estimating fixed-effects model to perform Hausman test', it reminded me " _xsmle_hausman_ml(): 3200 conformability error". However, I used the same weight matrix for SDM and they were all okay. Can you please tell me what happened? Thanks

    •  6 років тому

      I did some google searching and your conformability error is probably because of the size of your spatial weights matrix.
      Maybe you can ask Federico Belotti (he wrote the xsmle command) to help you: federico.belotti@uniroma2.it

    • @sayedshad722
      @sayedshad722 6 років тому

      Hi Kong Zhang and Diogo, I found the same error, 3200. Could you please share with me the solution? Thanks! sayeduitm@gmail.com

  • @ridhotamadarsih9680
    @ridhotamadarsih9680 7 років тому

    Hi... could you help me with unbalanced data please? I tried to follow the instruction using Beloti and friends paper but I stacked because when I enter this syntax, mi impute regress x1 = z, add(50) rseed(12345), it said that variable z not found. Could you please to help me with this? Thank you.

    •  7 років тому

      Hi. First of all I would advise you to stay away from unbalanced panel data sets.
      You may be better off removing the variables which have missing values altogether.
      Having said that, you are stuck because you, unlike the authors in the example which you are following, did not define the variable "z".
      You don't have to define a "z" variable to proceed, though. You should use the variable that makes sense for your data.
      Type in Stata: help mi impute regress
      Also, check this video: ua-cam.com/video/i6SOlq0mjuc/v-deo.html
      I hope it helps!

    • @chavintra
      @chavintra 7 років тому

      ohh ok Nuno... the problem is most of main control variables have missing values, so it I have to deal with it. Btw, thank you for the link.

    •  7 років тому

      Maybe there are alternative control variables which can serve you just as well :p
      Notice that the multiple imputation method (mi impute regress) deals with unbalanced panels by filling in missing values with "plausible" values. That is to say, using the mi strategy you will end up with balanced data. You can only run the xsmle command with balanced data.
      It may help knowing that, when you are using a .dta file in Stata and you run the command "mdesc", Stata will present a table with the number of missing values for each variable in that .dta file.
      Thanks for your comment!

    • @chavintra
      @chavintra 7 років тому

      Thank youuuuuu so muchhh....

  • @cameronmartin3523
    @cameronmartin3523 6 років тому

    Hi, thanks for the video! I'm experiencing the error invalid 'GeoData' r(198); when I try to import the .gal file using this syntax.
    spwmatrix import using "/Users/cameronmartin/Desktop/UK GeoData/GeoDa/Test.gal", wname (SPW) xport(SPW, txt)
    Thanks

    •  6 років тому

      Did you find a way to make Stata find your .gal file? That's a basic syntax error. Sorry I took so long to reply friend. I didn't notice your comment til now

    • @cameronmartin3523
      @cameronmartin3523 6 років тому

      Hi, Diego thanks for your reply. No, I never found out how to get around this error on STATA. I ended up using a smaller dataset on R.
      Is it possible for you to help me work through this on STATA?
      Thanks

    •  6 років тому

      Try moving your Test.gal file to the desktop and run this command in Stata:
      spwmatrix import using C:\Users\cameronmartin\Desktop\Test.gal, wname(SPW) xport(SPW, txt)

    • @johnmacharia2971
      @johnmacharia2971 3 роки тому

      invert the slash

  • @khadijakhachia6289
    @khadijakhachia6289 7 років тому

    Please I Have a question ; how many observation we should have at least ?

    •  7 років тому +1

      I don't believe there is a minimum number of observations you should have.

    • @khadijakhachia6289
      @khadijakhachia6289 7 років тому

      Thank youu

  • @haifenglan4020
    @haifenglan4020 5 років тому

    Thanks you videio, I want to known where I can find the code.do file?

    • @haifenglan4020
      @haifenglan4020 5 років тому

      I have found just it blow the video. How stuipd am I ! hahaha , thanks a lot!

    •  5 років тому

      There's a link in the video description

  • @EsinaViwn9
    @EsinaViwn9 6 років тому

    How can we estimate direct, indirect and total effects in xsmle?

    •  6 років тому

      Hey. You just have to add the "effects" option to the command. Example:
      xsmle v1 v2 v3, wmat(W) model(sdm) re vce(cluster mun) effects nolog

  • @khadijakhachia6289
    @khadijakhachia6289 7 років тому

    please I need help ! for my work I have only one regressor so when I execute the code I obtain ;"to few variables ".. should I HAve 2 variables at least ?

    •  7 років тому

      To run a regression you need 1 dependent variable (in the video, v1) and 1 or more independent variables / regressors (in the video, v2 and v3).
      So, you only need 1 regressor, but you should have at least 2 variables (1 dependent variable and 1 regressor). Did you include the dependent variable?
      The purpose of any regression is to understand how much the dependent variable can be explained by the independent variable(s). It's an attempt to predict a value of your dependent variable based on values of your independent variable(s).
      Spatial regressions (xsmle) serve the same purpose, only you're also accounting for spatial dependency (based on the spatial weighs matrix).
      Notice people can refer to the independent variable as the eplanatory variable / regressor / predictor variable / controlled variable / manipulated variable / input variable.
      And to the dependent variable as the explained variable / response variable / predicted variable / measured variable / experimental variable / outcome variable / output variable.

    • @khadijakhachia6289
      @khadijakhachia6289 7 років тому

      yeees I have my dependant variable and my regressor and still have a problem

    •  7 років тому

      Can you type here the command line you're using? For example, "xsmle v1 v2, wmat(W) model(sdm) re"
      To see if I can detect what's wrong...

    • @khadijakhachia6289
      @khadijakhachia6289 7 років тому

      xsmle v1 v2, wmat(W) model(sdm) re vce(cluster mun) nolog

    • @khadijakhachia6289
      @khadijakhachia6289 7 років тому

      thank you :)

  • @jsjcptbtptp
    @jsjcptbtptp 5 років тому

    I dont know why my stata say"main diagonal must contain zero elements"when i print "spmat dta W m*,normalize (row)"

    •  5 років тому

      The diagonal elements of the weights matrix have to be equal to 0 to exclude self neighbors! If there are "1"s in your main diagonal, there's something wrong with the matrix.

    • @jsjcptbtptp
      @jsjcptbtptp 5 років тому

      Your video is the best I've ever seen !thank you very much indeed!!By the way ,can you send the”code.do” to 978202709@qq.com

    • @jsjcptbtptp
      @jsjcptbtptp 5 років тому

      ohhhh I see.
      my geoda maybe have some problems . my weights matrix is wrong

    •  5 років тому

      @@jsjcptbtptp well thanks :) I sent you the email. good luck!

  • @kbrelm3000
    @kbrelm3000 7 років тому

    Hİ! I want to apply lagrange multiplier test and robust lagrange multiplier test for spatial panel data analysis. Can ı do it with stata. Can you help me find CODs.I am very satisfied if you can help me.

    •  7 років тому

      You can't do the LM tests using xsmle. I don't think there is a command in Stata that allows you to do those tests for spatial panel models.
      You can do them in R though. If you are interested, google "splm: Spatial Panel Data Models in R"

    • @kbrelm3000
      @kbrelm3000 7 років тому

      ok! thank you very much.

    •  7 років тому +1

      Another option you have is to use the routines in Matlab to do those LM tests. Check the 2014 paper "Matlab Software for Spatial Panels"!

  • @sandinurmansyah6628
    @sandinurmansyah6628 4 роки тому

    Thank you

  • @ramaliyakikay7866
    @ramaliyakikay7866 7 років тому

    helloo. i want to estimate general nesting model (elhorst). can you help me to estimate gns model?

    •  7 років тому

      Hi. I don't know that specific literature so I can't really help you. Having said that, at a quick glance, as far as I can tell, there isn't a single "general nesting model". Some of the "nested models" used are models that can be estimated with the xsmle command in Stata (SARAR and SDM).
      Check this link: old.aecr.org/images/ImatgesArticles/2012/3/06_PETER.pdf

    • @ramaliyakikay7866
      @ramaliyakikay7866 7 років тому

      Thank you.

  • @kbrelm3000
    @kbrelm3000 7 років тому

    ıf my files .gwt how to read it to stata. .ı used '' spwmatrix import using d:/non.gwt,wname(non) xport(non,txt)'' but
    spwmatrix_CalcSPweightM(): 3200 conformability error

    •  7 років тому

      The spwmatrix command does not allow you to import spatial weights from a .gtw file...
      You can do it using the spmat command. Follow the instructions in this link:
      www.stata.com/statalist/archive/2011-10/msg01385.html

    • @kbrelm3000
      @kbrelm3000 7 років тому

      my file name is 'non'. and it is save D disk. ı used 'spmat import ' but STATA give error 'cannot open non.GWT'. Can you help me this subject? I think I wrote wrong.Can you write this command as an example.

    •  7 років тому

      Notice what I did in 11:40. Try changing your working directory to Desktop before running the command. Let me know if it fixed your problem.

    •  7 років тому

      After you change your Working Directory to desktop, you have to let Stata know where your non.gwt file is. If your non.gwt file is in the Desktop, you run this command:
      spmat import non using C:\Users\*YourUserName*\Desktop
      on.gwt, geoda

    • @kbrelm3000
      @kbrelm3000 7 років тому

      thank you very much....my problem is solved.

  • @personalgeria8433
    @personalgeria8433 6 років тому

    hello,,it was a great video and project,,,please can u give the site that you found thoses data of portugal.
    Thank you so much.

    •  6 років тому

      Hey, thanks for the nice comment! Try here: www.diva-gis.org/gdata

    • @personalgeria8433
      @personalgeria8433 6 років тому

      sorry,,,but i didn't found the shape_file with 278 municipalities!!
      can you help me please.
      thank you.

    •  6 років тому

      drive.google.com/file/d/0By5qMMVfcc4jRHJfNExjUV9pd2c/view

    • @personalgeria8433
      @personalgeria8433 6 років тому

      yes,,i have,,,when i dowloded the data from the site i get 4 shape_file,with 1,20,306,and 4260 municipalities,,,,my question was how did you get the shpa_file with 287 municipalities.
      thank you.

    •  6 років тому

      Just watch what I do on second 2:55 of this video. What I uploaded to google drive is exactly what I used in the video... So the municipalities.shp file only has 278 municipalities

  • @jordanasilva4305
    @jordanasilva4305 7 років тому

    Nuno Álvares Pereira, this video is very good! I wanted to take this opportunity to ask for your help.
    I have to deliver an article on the 06th, but I can not generate my weight matrix. I tried to follow your do-file, but I could not run the first command. Help me please!
    The error that appears is:
    spwmatrix import using C:\Users\Jordana\Desktop\Stata\BRMUE250GC_SIR.gal, wname(weights) xport(weights, txt)
    J(): 3900 unable to allocate real [5300108,5300108]
    spwmatrix_CalcSPweightM(): - function returned error
    : - function returned error
    But what is the necessary memory? My computer has 1T of storage in HD, 8G RAM, i3 processor.

  • @khadijakhachia6289
    @khadijakhachia6289 7 років тому

    could you help me to find the shapefile of morocco

    •  7 років тому

      Try here: www.diva-gis.org/gdata

    • @khadijakhachia6289
      @khadijakhachia6289 7 років тому

      THANK YOU

    • @khadijakhachia6289
      @khadijakhachia6289 7 років тому

      when I create the file weights-file.gal , I can't open it because it's not created as a notepad file ! please what can I do

    •  7 років тому

      7:39 right-click on the weights_file.gal and left-click where it says "Open with..." and then choose to open it with Notepad

  • @VectormanRxQueen
    @VectormanRxQueen 7 років тому

    cool vid

    •  7 років тому

      LEGO JOEY thanks bro

  • @jsjcptbtptp
    @jsjcptbtptp 5 років тому

    maybe my code is wrong