This website is a replication package for the paper “Exposure to Asylum Seekers and Changing Support for the Radical Right: A Natural Experiment in the Netherlands” by Tolsma, Laméris, and Savelkoul (n.d.). It contains all necessary R code and datasets to replicate all Tables in the manuscript.

Use the top menu to navigate to the section of interest. The section introduces the original survey data of 1VOP and the data of the Central Agency for the Reception of Asylum Seekers (COA).

To copy the code click the button in the upper right corner of the code-chunks.


Contact

Questions can be addressed to the first author of the corresponding article, Jochem Tolsma.


DATA 1VOP

The original datasets can be acquired by sending a request to 1VOP. The names of the used datasets were:

  • Wave 1: top1provincialestaten.sav
  • Wave 2: AZC TOLSMA 3_17.11.15_08.40.15.AM.sav

Below we show the variable names and an excerpt of the original datasets.

WAVE 1:

#>  [1] "Stemmen"                                                         
#>  [2] "NietStemmenReden_Ikkannietopdiedag"                              
#>  [3] "NietStemmenReden_Ikbenhetnieteensmetdekoersvanhetprovinciebestuu"
#>  [4] "NietStemmenReden_Ikweetnietwathetprovinciebestuurdoet"           
#>  [5] "NietStemmenReden_Ikhebgeenvertrouweninderegionalepolitiek"       
#>  [6] "NietStemmenReden_Ikhebgeenvertrouwenindepolitiekinhetalgemeen"   
#>  [7] "NietStemmenReden_Ikvindprovincialeverkiezingennietbelangrijk"    
#>  [8] "NietStemmenReden_Ikkendekandidatenenhunstandpuntenniet"          
#>  [9] "NietStemmenReden_Ikgaeigenlijknooitstemmen"                      
#> [10] "NietStemmenReden_Mijnstemmaaktgeenverschil"                      
#> [11] "NietStemmenReden_Andereredennamelijk"                            
#> [12] "NietStemmenReden_Weetnietgeenmening"                             
#> [13] "NietStemmenReden_11_other"                                       
#> [14] "stemvraagPS"                                                     
#> [15] "ZekerStemkeuze"                                                  
#> [16] "BelangLandProv"                                                  
#> [17] "StemmenAnders"                                                   
#> [18] "stemvraag"                                                       
#> [19] "Age_Rollup_Opinie"                                               
#> [20] "Education_Rollup_Opinie"                                         
#> [21] "Stem2012_Rollup_Opinie"                                          
#> [22] "Geslacht_Opinie"                                                 
#> [23] "Geboortedatum_Opinie"                                            
#> [24] "Burgerlijke_staat_Opinie"                                        
#> [25] "Situatie_huishouden_Opinie"                                      
#> [26] "Provincie_Opinie"                                                
#> [27] "Postcode_Opinie"                                                 
#> [28] "Opleiding_Opinie"                                                
#> [29] "Dagelijkse_activiteit_Opinie"                                    
#> [30] "Stemgedrag_TK_Opinie"                                            
#> [31] "Herkomst_familie_Opinie"                                         
#> [32] "PanelistIdQuestion"                                              
#> [33] "RB_1"                                                            
#> [34] "RB_2"                                                            
#> [35] "RB_3a"                                                           
#> [36] "RB_3b"
#>    Stemmen NietStemmenReden_Ikkannietopdiedag
#> 50       1                                 NA
#> 51       1                                 NA
#> 52       1                                 NA
#> 53       1                                 NA
#> 54       1                                 NA
#> 55       1                                 NA
#> 56       4                                 NA
#> 57       1                                 NA
#> 58       1                                 NA
#> 59       1                                 NA
#> 60       1                                 NA
#>    NietStemmenReden_Ikbenhetnieteensmetdekoersvanhetprovinciebestuu
#> 50                                                               NA
#> 51                                                               NA
#> 52                                                               NA
#> 53                                                               NA
#> 54                                                               NA
#> 55                                                               NA
#> 56                                                               NA
#> 57                                                               NA
#> 58                                                               NA
#> 59                                                               NA
#> 60                                                               NA
#>    NietStemmenReden_Ikweetnietwathetprovinciebestuurdoet
#> 50                                                    NA
#> 51                                                    NA
#> 52                                                    NA
#> 53                                                    NA
#> 54                                                    NA
#> 55                                                    NA
#> 56                                                    NA
#> 57                                                    NA
#> 58                                                    NA
#> 59                                                    NA
#> 60                                                    NA
#>    NietStemmenReden_Ikhebgeenvertrouweninderegionalepolitiek
#> 50                                                        NA
#> 51                                                        NA
#> 52                                                        NA
#> 53                                                        NA
#> 54                                                        NA
#> 55                                                        NA
#> 56                                                        NA
#> 57                                                        NA
#> 58                                                        NA
#> 59                                                        NA
#> 60                                                        NA
#>    NietStemmenReden_Ikhebgeenvertrouwenindepolitiekinhetalgemeen
#> 50                                                            NA
#> 51                                                            NA
#> 52                                                            NA
#> 53                                                            NA
#> 54                                                            NA
#> 55                                                            NA
#> 56                                                            NA
#> 57                                                            NA
#> 58                                                            NA
#> 59                                                            NA
#> 60                                                            NA
#>    NietStemmenReden_Ikvindprovincialeverkiezingennietbelangrijk
#> 50                                                           NA
#> 51                                                           NA
#> 52                                                           NA
#> 53                                                           NA
#> 54                                                           NA
#> 55                                                           NA
#> 56                                                           NA
#> 57                                                           NA
#> 58                                                           NA
#> 59                                                           NA
#> 60                                                           NA
#>    NietStemmenReden_Ikkendekandidatenenhunstandpuntenniet
#> 50                                                     NA
#> 51                                                     NA
#> 52                                                     NA
#> 53                                                     NA
#> 54                                                     NA
#> 55                                                     NA
#> 56                                                     NA
#> 57                                                     NA
#> 58                                                     NA
#> 59                                                     NA
#> 60                                                     NA
#>    NietStemmenReden_Ikgaeigenlijknooitstemmen NietStemmenReden_Mijnstemmaaktgeenverschil
#> 50                                         NA                                         NA
#> 51                                         NA                                         NA
#> 52                                         NA                                         NA
#> 53                                         NA                                         NA
#> 54                                         NA                                         NA
#> 55                                         NA                                         NA
#> 56                                         NA                                         NA
#> 57                                         NA                                         NA
#> 58                                         NA                                         NA
#> 59                                         NA                                         NA
#> 60                                         NA                                         NA
#>    NietStemmenReden_Andereredennamelijk NietStemmenReden_Weetnietgeenmening
#> 50                                   NA                                  NA
#> 51                                   NA                                  NA
#> 52                                   NA                                  NA
#> 53                                   NA                                  NA
#> 54                                   NA                                  NA
#> 55                                   NA                                  NA
#> 56                                   NA                                  NA
#> 57                                   NA                                  NA
#> 58                                   NA                                  NA
#> 59                                   NA                                  NA
#> 60                                   NA                                  NA
#>    NietStemmenReden_11_other stemvraagPS ZekerStemkeuze BelangLandProv StemmenAnders stemvraag
#> 50                                     6              1              2             1         6
#> 51                                    13             NA             NA             4         6
#> 52                                    13             NA             NA             4        13
#> 53                                     7              2              3             1         7
#> 54                                    13             NA             NA             2        13
#> 55                                     3              1              1             1         3
#> 56                                    NA             NA             NA             1         5
#> 57                                     4              1              1             1         4
#> 58                                     6              1              3             1         6
#> 59                                     1              1              3             1         1
#> 60                                     6              2              1             2         6
#>    Age_Rollup_Opinie Education_Rollup_Opinie Stem2012_Rollup_Opinie Geslacht_Opinie
#> 50                 1                       5                     10               2
#> 51                 1                       5                      2               1
#> 52                 1                       5                      1               1
#> 53                 1                       5                      2               1
#> 54                 1                       5                      3               1
#> 55                 1                       5                      1               1
#> 56                 1                       5                      4               2
#> 57                 1                       5                      5               1
#> 58                 1                       5                      6               2
#> 59                 1                       5                      1               1
#> 60                 1                       5                      1               1
#>    Geboortedatum_Opinie Burgerlijke_staat_Opinie Situatie_huishouden_Opinie Provincie_Opinie
#> 50           1991-10-13                        4                          1                9
#> 51           1992-02-18                        4                          4                9
#> 52           1990-08-26                        4                          7                9
#> 53           1991-07-08                        4                          1                5
#> 54           1992-05-06                        4                          1                1
#> 55           1991-10-31                        4                          1                9
#> 56           1991-09-11                        4                          1                5
#> 57           1992-04-24                        4                          4                4
#> 58           1991-04-14                        4                          2                9
#> 59           1990-08-05                        4                          1                8
#> 60           1991-06-12                        4                          2                6
#>    Postcode_Opinie Opleiding_Opinie Dagelijkse_activiteit_Opinie Stemgedrag_TK_Opinie
#> 50            2352                6                            5                   10
#> 51            3063                6                            5                    2
#> 52            2593                5                            5                    1
#> 53            8316                5                            5                    2
#> 54            9561                5                            5                    3
#> 55            2564                5                            5                    1
#> 56            1335                5                            3                    4
#> 57            8021                5                            5                    5
#> 58            3245                6                            5                    6
#> 59            1705                5                            5                    1
#> 60            6828                5                            5                    1
#>    Herkomst_familie_Opinie PanelistIdQuestion RB_1 RB_2 RB_3a RB_3b
#> 50                       1                510    4   60     7     3
#> 51                       1                513    4   10     7     7
#> 52                       1                521    2   10     2     6
#> 53                       1                522    5    5     4     3
#> 54                       1                530    4    1     8     8
#> 55                       1                541    1    3     7     8
#> 56                      14                548    5    2     1     1
#> 57                       1                557    3   10     7     7
#> 58                       1                582    5    1     3     3
#> 59                       1                589    2    8     2     2
#> 60                       1                593    2   25     2     5

WAVE 2:

#>   [1] "PanelistIdQuestion"                                    
#>   [2] "Rutte_gedaan_hoe"                                      
#>   [3] "Open_hoe_Rutte_typeren"                                
#>   [4] "vertrouwen_mp_rutte"                                   
#>   [5] "rapportcijfer_mp_rutte"                                
#>   [6] "vertrouwen_kabinet_Rutte2"                             
#>   [7] "rapportcijfer_kabinet"                                 
#>   [8] "aanpak_kabinet"                                        
#>   [9] "leiderschap_Rutte"                                     
#>  [10] "Open_Rutte_leiderschap"                                
#>  [11] "Asielzoekers_oorlogsgebieden"                          
#>  [12] "vluchtelingen_opnemen_2"                               
#>  [13] "hoe_veel_dit_jaar_toelaten"                            
#>  [14] "hoe_veel_volgend_jaar_toelaten"                        
#>  [15] "Invloed_nederland"                                     
#>  [16] "Positief_negatief"                                     
#>  [17] "Invloed_nederland_open"                                
#>  [18] "Asielzoekers_buurt"                                    
#>  [19] "Ervaringen_opvang"                                     
#>  [20] "Overlast_vluchtelingen"                                
#>  [21] "Overlast_open"                                         
#>  [22] "Asielzoekers_gemeente"                                 
#>  [23] "Ervaring_opvang_gemeente"                              
#>  [24] "Overlast_opvang_gemeente"                              
#>  [25] "Overlast_gemeente_open"                                
#>  [26] "Buurt"                                                 
#>  [27] "komst_minderheden"                                     
#>  [28] "Niet_westers"                                          
#>  [29] "Oost_europees"                                         
#>  [30] "Niet_Westers_open"                                     
#>  [31] "Open_westers"                                          
#>  [32] "aankijken_tegen_moslims_37"                            
#>  [33] "verrijking_10"                                         
#>  [34] "bedreiging_11"                                         
#>  [35] "verrijking_bedreiging_8"                               
#>  [36] "lichttoe_verrijking_bedreiging_9"                      
#>  [37] "stemvraag"                                             
#>  [38] "stemvraag_18_other"                                    
#>  [39] "toelichting_stemvraag"                                 
#>  [40] "CompletedDate"                                         
#>  [41] "StartedDate"                                           
#>  [42] "InvitationDate"                                        
#>  [43] "CompletionTime"                                        
#>  [44] "ResponseStatus"                                        
#>  [45] "Version"                                               
#>  [46] "Sample"                                                
#>  [47] "Communication_InvitationSent"                          
#>  [48] "Communication_Reminder1Sent"                           
#>  [49] "Communication_Reminder2Sent"                           
#>  [50] "Communication_Reminder3Sent"                           
#>  [51] "PointsEarned"                                          
#>  [52] "BrowserData"                                           
#>  [53] "RespondentSource_SparqPortal"                          
#>  [54] "RespondentSource_FacebookPortal"                       
#>  [55] "OSType"                                                
#>  [56] "DeviceType"                                            
#>  [57] "BrowserType"                                           
#>  [58] "BrowserVersion"                                        
#>  [59] "PluginType_Flash"                                      
#>  [60] "PluginType_NoDetectablePlugin"                         
#>  [61] "PluginType_flash_other"                                
#>  [62] "BrowserExperience_VisualQuestionReady"                 
#>  [63] "BrowserExperience_JavascriptEnabled"                   
#>  [64] "BrowserExperience_UserAgent"                           
#>  [65] "BrowserExperience_ClientSideErrorEncountered"          
#>  [66] "BrowserExperience_ServerSideErrorEncountered"          
#>  [67] "BrowserExperience_useragent_other"                     
#>  [68] "RespondentExperience"                                  
#>  [69] "Age_Rollup_Jongeren"                                   
#>  [70] "Age_Years_Rollup_Jongeren"                             
#>  [71] "Age_Rollup_Opinie"                                     
#>  [72] "Age_Rollup_Jongeren_II"                                
#>  [73] "Age_Rollup_Jongeren_III"                               
#>  [74] "Education_Rollup_Opinie"                               
#>  [75] "Stem2012_Rollup_Opinie"                                
#>  [76] "Community_Segment"                                     
#>  [77] "Geboortedatum_Jongeren"                                
#>  [78] "Geslacht_Jongeren"                                     
#>  [79] "Provincie_Jongeren"                                    
#>  [80] "Postcode_Jongeren"                                     
#>  [81] "Situatie_Jongeren"                                     
#>  [82] "Opleiding_Jongeren"                                    
#>  [83] "Onderwijs_verdeling_Jongeren"                          
#>  [84] "Herkomst_familie_Jongeren"                             
#>  [85] "Herkomst_familie_Jongeren_17_other"                    
#>  [86] "Geslacht_Opinie"                                       
#>  [87] "Geboortedatum_Opinie"                                  
#>  [88] "Burgerlijke_staat_Opinie"                              
#>  [89] "Situatie_huishouden_Opinie"                            
#>  [90] "Leeftijd_kinderen_Opinie_03jaar"                       
#>  [91] "Leeftijd_kinderen_Opinie_412jaar"                      
#>  [92] "Leeftijd_kinderen_Opinie_1318jaar"                     
#>  [93] "Leeftijd_kinderen_Opinie_1924jaar"                     
#>  [94] "Leeftijd_kinderen_Opinie_25jaarenouder"                
#>  [95] "Leeftijd_kinderen_Opinie_Ikhebgeenthuiswonendekinderen"
#>  [96] "Provincie_Opinie"                                      
#>  [97] "Stad_Opinie"                                           
#>  [98] "Postcode_Opinie"                                       
#>  [99] "Huis_Opinie"                                           
#> [100] "Opleiding_Opinie"                                      
#> [101] "Dagelijkse_activiteit_Opinie"                          
#> [102] "Werk_sector_Opinie"                                    
#> [103] "Gezondheidszorg_Opinie"                                
#> [104] "Onderwijs_Opinie"                                      
#> [105] "Vervoer_Opinie"                                        
#> [106] "Inkomen_Opinie"                                        
#> [107] "Lidmaatschap_politieke_partij_Opinie"                  
#> [108] "Stemgedrag_TK_Opinie"                                  
#> [109] "Vakbond_Opinie"                                        
#> [110] "Herkomst_familie_Opinie"                               
#> [111] "Herkomst_familie_Opinie_22_other"                      
#> [112] "Religie_Opinie"                                        
#> [113] "Religie_Opinie_7_other"                                
#> [114] "ERR_MSG"                                               
#> [115] "Cohort_Jongeren"                                       
#> [116] "Cohort_Opinie"                                         
#> [117] "debug"                                                 
#> [118] "Post_Code_Rollup_Opinie"
#>    PanelistIdQuestion Rutte_gedaan_hoe Open_hoe_Rutte_typeren vertrouwen_mp_rutte
#> 70                681                4                Afwezig                   3
#> 71                684               NA                                         NA
#> 72                693               NA                                         NA
#> 73                694                3                                          3
#> 74                717               NA                                         NA
#> 75                719                3                                          3
#> 76                722                2                                          2
#> 77                724               NA                                         NA
#> 78                725                4                                          4
#> 79                730                3                                          3
#> 80                761                3                                          3
#>    rapportcijfer_mp_rutte vertrouwen_kabinet_Rutte2 rapportcijfer_kabinet aanpak_kabinet
#> 70                    3.0                         3                     5              4
#> 71                     NA                        NA                    NA              2
#> 72                     NA                        NA                    NA              3
#> 73                    6.0                         3                     4              4
#> 74                     NA                        NA                    NA              3
#> 75                    5.0                         2                     7              2
#> 76                    7.0                         2                    NA              3
#> 77                     NA                        NA                    NA              3
#> 78                    1.0                         4                     1              3
#> 79                    5.5                         4                     1              4
#> 80                    5.0                         3                     5              3
#>    leiderschap_Rutte
#> 70                 2
#> 71                 3
#> 72                 2
#> 73                 3
#> 74                 2
#> 75                 2
#> 76                 1
#> 77                 2
#> 78                 2
#> 79                 2
#> 80                 2
#>                                                                                                                                    Open_Rutte_leiderschap
#> 70                                                                                                                                                       
#> 71                                                                                                                                                       
#> 72                                                                                                                                                       
#> 73                                                                                                                                                       
#> 74                                                                                                                                                       
#> 75                                                                                                                                                       
#> 76                                                                                                                                                       
#> 77                                                                                                                                                       
#> 78                                                                                                                                                       
#> 79 Wat ik Rutte hoor zeggen is wat ik Brussel hoor zeggen. Geen idee wat Rutte zelf eigenlijk zou wilen, hij is in dezen gewoon een spreekbuis van de EU.
#> 80                                                                                                                                                       
#>    Asielzoekers_oorlogsgebieden vluchtelingen_opnemen_2 hoe_veel_dit_jaar_toelaten
#> 70                            1                       1                          7
#> 71                            2                       2                          3
#> 72                            2                       1                          7
#> 73                            4                       2                          1
#> 74                            2                       1                          8
#> 75                            1                       1                          8
#> 76                            2                       1                          6
#> 77                            3                       2                          2
#> 78                            3                       2                          1
#> 79                            3                       2                          1
#> 80                            2                       1                          5
#>    hoe_veel_volgend_jaar_toelaten Invloed_nederland Positief_negatief
#> 70                              6                 3                 1
#> 71                              1                 1                 3
#> 72                              7                 3                 2
#> 73                              1                 1                 3
#> 74                              8                 3                 2
#> 75                              8                 3                 3
#> 76                              6                 3                 2
#> 77                              2                 3                 3
#> 78                              3                 2                 3
#> 79                              1                 1                 3
#> 80                              5                 3                 2
#>                                                                                                                                                                                                                                                                                                                                                                                                                              Invloed_nederland_open
#> 70                                                                                                                                                                                                                                                                                                                                                                                                                                                 
#> 71                                                                                                                                                                                                                                                                                                                                                                                                                                                 
#> 72 Het zal positieve en negatieve invloed hebben. \r\nPostief: op de kortere termijn meer banen. Op de langere termijn steeds meer een multiculturele samenleving. \r\nNegatief: momenteel (te) hoge werkdruk voor werknemers die met vluchtelingen werken. De verschillen tussen culturen zullen gaan botsen, hier moeten we doorheen. Daarna zijn de verschillende culturen een positief punt, en kunnen we waarschijnlijk veel van elkaar leren.
#> 73                                                                                                                                                                                                                                                                                                                                                                                                                                                 
#> 74                                                                                                                                                                                                                                                                                                                                                                                                                                                 
#> 75                                                                                                                                                                                                                                                                                                                                                                                                                       Door de reactie van mensen
#> 76                                                                                                                                                                                                                                                                                                                                                                                                                                                 
#> 77                                                                                                                                                                                                                                                                                                                                                                                                                                                 
#> 78                                                                                                                                                                                                                                                                                                                                                                                                                                                 
#> 79                                                                                                                                                      Omdat het hier voornamelijk om islamitische vluchtelingen gaat, betekent dat hoogstwaarschijnlijk een zeer snelle islamisering van bijvoorbeeld schoolklassen en buurten. Dat betekent dat op scholen en in goedkope buurten het klimaat voor bijvoorbeeld homo's heel angstig gaat worden.
#> 80                                                                                                                                                                                                                                                                                                                                                                                                                                                 
#>    Asielzoekers_buurt Ervaringen_opvang Overlast_vluchtelingen Overlast_open Asielzoekers_gemeente
#> 70                  4                NA                     NA                                   4
#> 71                  4                NA                     NA                                   3
#> 72                  4                NA                     NA                                   2
#> 73                  4                NA                     NA                                   3
#> 74                  4                NA                     NA                                   5
#> 75                  4                NA                     NA                                   1
#> 76                  2                 4                      4                                  NA
#> 77                  4                NA                     NA                                   3
#> 78                  2                 3                      2                                  NA
#> 79                  4                NA                     NA                                   1
#> 80                  4                NA                     NA                                   1
#>    Ervaring_opvang_gemeente Overlast_opvang_gemeente Overlast_gemeente_open Buurt komst_minderheden
#> 70                       NA                       NA                            2                 5
#> 71                       NA                       NA                            1                 1
#> 72                        4                        4                            1                 5
#> 73                       NA                       NA                            1                 4
#> 74                       NA                       NA                            1                 4
#> 75                        4                        4                            3                 2
#> 76                       NA                       NA                            3                 2
#> 77                       NA                       NA                            1                 2
#> 78                       NA                       NA                            2                 1
#> 79                        4                        4                            1                 4
#> 80                        2                        4                            1                 5
#>    Niet_westers Oost_europees
#> 70            2             3
#> 71            8             8
#> 72            3             7
#> 73            7             7
#> 74            7             7
#> 75            5             7
#> 76            5             7
#> 77            7             7
#> 78            3             3
#> 79            6             6
#> 80            8             8
#>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           Niet_Westers_open
#> 70                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
#> 71                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
#> 72                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
#> 73                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
#> 74                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
#> 75                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Alleen de directe buurvrouw. Gaat alleen over praktische dingen, zoals ontvangen post.
#> 76                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
#> 77                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
#> 78                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
#> 79 Ik heb veel contact met allochtonen van niet-westerse afkomst, maar niet in mijn eigen buurt. (Zeg ik maar even omdat het in uw onderzoek tot nu toe om de eigen buurt ging.) \r\n\r\nIk kan het altijd goed vinden met moslims omdat ik lang temidden van hun (lichtelijk vernederlandste) cultuur heb doorgebracht, bijvoorbeel toen ik op de middelbare school en het hbo zat. Toch vind ik het onaangenaam om bij ze in de buurt te zijn. Met mij in het bijzonder praten ze er niet zo vaak over, maar onderling hebben ze het openlijk over het vermoorden van Joden en prijzen ze de holocaust. Het zit niet echt in de weg van mijn contact met hen, maar ik vind geïslamiseerde omgevingen wel degelijk akelig.
#> 80                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
#>                                                                                                                                                                                                                                            Open_westers
#> 70                                                                                                                                                                                                                                                     
#> 71                                                                                                                                                                                                                                                     
#> 72                                                                                                                                                                                                                                                     
#> 73                                                                                                                                                                                                                                                     
#> 74                                                                                                                                                                                                                                                     
#> 75                                                                                                                                                                                                                                                     
#> 76                                                                                                                                                                                                                                                     
#> 77                                                                                                                                                                                                                                                     
#> 78                                                                                                                                                                                                                                                     
#> 79 Af en toe komen hier Poolse klusjesmannen werken. Dat zijn toffe kerels, ookal is er meestal maar eentje bij die een beetje Nederlands kan spreken en dat maakt communiceren heel moeilijk. Dat is mijn enige bezwaar; verder vind ik het leuke lui.
#> 80                                                                                                                                                                                                                                                     
#>    aankijken_tegen_moslims_37 verrijking_10 bedreiging_11 verrijking_bedreiging_8
#> 70                          2             2             4                       1
#> 71                          4             4             1                       2
#> 72                          2             2             4                       1
#> 73                          5             4             1                       2
#> 74                          2             3             3                       3
#> 75                          3             5             5                       3
#> 76                          4             3             2                       3
#> 77                          3             4             2                       2
#> 78                          2             3             2                       4
#> 79                          5             4             1                       2
#> 80                          2             2             4                       1
#>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               lichttoe_verrijking_bedreiging_9
#> 70                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
#> 71                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
#> 72                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
#> 73                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
#> 74                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
#> 75                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
#> 76                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
#> 77                                                                                                                                                                            vind het niet juist dat de nederlandse samenleving zich vergaand moet aanpassen aan mensen met een geloof dat oorspronkelijk hier niet voor komt. Elk modern gebouw moet een gebedsruimte hebben, scholen moeten speciale wasruimten hebben, etc. Het slaat door, rekening houden oke, maar alles aanpassen voor mensen vanwege hun geloof vind ik niet nodig. Ze kunnen hun geloof op hun eigen manier belijden zoals ze willen maar daar hoeft niet de hele nederlandse samenleving voor worden aangepast. Ditzelfde geldt bijv in de zwarte-pieten discussie.
#> 78                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
#> 79 Het is niet makkelijk te merken in omgevingen waarin moslims nog steeds een minderheid zijn, maar schoolklassen waarin ik heb gezeten waarin moslims een ruime meerderheid waren waren heel akelig. Zoals in mijn eerdere antwoorden in dit onderzoek beschreven, kan ik het prima met jonge moslims vinden, maar weet ik dat zij onderling praten over het vermoorden van Joden en prijzen zij de holocaust. De reden dat ik de islam een bedreiging vind voor de Nederlandse cultuur is dat het onontkoombaar is dat er steeds meer omgevingen gaan komen waarin moslims de meerderheid zijn. Dat zorgt voor regelrecht gevaarlijke omgevingen voor homo's, vrouwen, Joden en op den duur ook voor christenen, atheïsten en islamcritici.
#> 80                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
#>    stemvraag stemvraag_18_other
#> 70         2                   
#> 71         2                   
#> 72         7                   
#> 73         1                   
#> 74         7                   
#> 75         6                   
#> 76         8                   
#> 77         4                   
#> 78         3                   
#> 79         3                   
#> 80        14                   
#>                                                                                                                                                                                                                                                                                                                                                                                                                                                                               toelichting_stemvraag
#> 70                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
#> 71                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
#> 72                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
#> 73                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
#> 74                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
#> 75                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
#> 76                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
#> 77                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  goede middenweg
#> 78                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
#> 79 Omdat de PVV de enige is die zijn handen vuil durft te maken aan kritiek op de islam, die niet beteugeld wordt door het enge "fatsoensdenken" waarin het onmogelijk is om nare punten van de islam te benoemen. Ik heb regelmatig akelige ervaringen met omgevingen waarin moslims de meerderheid zijn. Ik voel me daar naar bij en verlang terug naar de tijd dat iedereen in mijn omgeving ruimdenkend en tolerant was. Dat gaat niet gebeuren onder leiding van een andere partij dan de PVV.
#> 80                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
#>          CompletedDate         StartedDate      InvitationDate CompletionTime ResponseStatus
#> 70 2014-07-05 03:53:32 2014-07-05 03:51:01 2014-07-04 10:00:29           2.51              2
#> 71 2014-07-28 02:32:26 2014-07-28 02:28:46 2014-07-04 04:08:57           3.66              2
#> 72 2014-09-14 05:40:02 2014-09-14 05:22:13 2014-07-04 05:38:16          17.82              2
#> 73 2014-07-04 14:27:20 2014-07-04 14:23:16 2014-07-04 07:01:13           4.06              2
#> 74 2014-07-04 09:23:48 2014-07-04 09:18:51 2014-07-04 07:02:30           4.96              2
#> 75 2014-07-04 07:36:08 2014-07-04 07:32:25 2014-07-04 07:02:59           3.71              2
#> 76 2014-07-18 13:49:38 2014-07-18 13:47:27 2014-07-04 08:30:26           2.18              2
#> 77 2014-09-12 09:22:25 2014-09-12 09:16:50 2014-07-04 05:38:43           5.58              2
#> 78 2014-07-04 23:35:31 2014-07-04 23:32:32 2014-07-04 08:32:26           2.98              2
#> 79 2014-07-04 07:13:39 2014-07-04 07:11:21 2014-07-04 07:02:35           2.31              2
#> 80 2014-07-22 05:31:23 2014-07-22 05:28:57 2014-07-04 08:30:23           2.43              2
#>    Version Sample Communication_InvitationSent Communication_Reminder1Sent
#> 70     1.0      9                            1                           0
#> 71     1.2      9                            1                           1
#> 72     1.3      9                            1                           1
#> 73     1.0      9                            1                           0
#> 74     1.0      9                            1                           0
#> 75     1.0      9                            1                           0
#> 76     1.2      9                            1                           1
#> 77     1.3      9                            1                           1
#> 78     1.0      9                            1                           0
#> 79     1.0      9                            1                           0
#> 80     1.2      9                            1                           1
#>    Communication_Reminder2Sent Communication_Reminder3Sent PointsEarned
#> 70                           0                           0            0
#> 71                           0                           0            0
#> 72                           1                           1            0
#> 73                           0                           0            0
#> 74                           0                           0            0
#> 75                           0                           0            0
#> 76                           0                           0            0
#> 77                           1                           1            0
#> 78                           0                           0            0
#> 79                           0                           0            0
#> 80                           0                           0            0
#>                                                            BrowserData RespondentSource_SparqPortal
#> 70  b_Flash=14.0.0&b_IExternal=1&b_JavaScript=1&b_Resolution=1280x800&                            1
#> 71  b_Flash=14.0.0&b_IExternal=1&b_JavaScript=1&b_Resolution=1366x768&                            1
#> 72  b_Flash=14.0.0&b_IExternal=1&b_JavaScript=1&b_Resolution=1366x768&                            1
#> 73                                                                                                1
#> 74                                                                                                1
#> 75                                                                                                1
#> 76  b_Flash=14.0.0&b_IExternal=1&b_JavaScript=1&b_Resolution=1366x768&                            1
#> 77                                                                                                1
#> 78  b_Flash=14.0.0&b_IExternal=1&b_JavaScript=1&b_Resolution=1600x900&                            1
#> 79 b_Flash=14.0.0&b_IExternal=1&b_JavaScript=1&b_Resolution=1680x1050&                            1
#> 80                                                                                                1
#>    RespondentSource_FacebookPortal  OSType DeviceType BrowserType BrowserVersion PluginType_Flash
#> 70                               0     mac    desktop      chrome             35                1
#> 71                               0 windows    desktop      chrome             36                1
#> 72                               0 windows    desktop      chrome             37                1
#> 73                               0     ios     tablet                         NA                0
#> 74                               0 android      phone     android             NA                1
#> 75                               0 android      phone      chrome             25                0
#> 76                               0 windows    desktop      chrome             35                1
#> 77                               0 android      phone     android             NA                0
#> 78                               0 windows    desktop      chrome             35                1
#> 79                               0 windows    desktop     firefox            300                1
#> 80                               0 android      phone      chrome             25                0
#>    PluginType_NoDetectablePlugin PluginType_flash_other BrowserExperience_VisualQuestionReady
#> 70                             0                     14                                     1
#> 71                             0                     14                                     1
#> 72                             0                     14                                     1
#> 73                             1                                                            0
#> 74                             0                                                            0
#> 75                             1                                                            0
#> 76                             0                     14                                     1
#> 77                             1                                                            0
#> 78                             0                     14                                     1
#> 79                             0                     14                                     1
#> 80                             1                                                            0
#>    BrowserExperience_JavascriptEnabled BrowserExperience_UserAgent
#> 70                                   1                           1
#> 71                                   1                           1
#> 72                                   1                           1
#> 73                                   0                           1
#> 74                                   1                           1
#> 75                                   1                           1
#> 76                                   1                           1
#> 77                                   1                           1
#> 78                                   1                           1
#> 79                                   1                           1
#> 80                                   1                           1
#>    BrowserExperience_ClientSideErrorEncountered BrowserExperience_ServerSideErrorEncountered
#> 70                                            0                                            0
#> 71                                            0                                            0
#> 72                                            0                                            0
#> 73                                            0                                            0
#> 74                                            0                                            0
#> 75                                            0                                            0
#> 76                                            0                                            0
#> 77                                            0                                            0
#> 78                                            0                                            0
#> 79                                            0                                            0
#> 80                                            0                                            0
#>                                                                                                                 BrowserExperience_useragent_other
#> 70                       Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
#> 71                                  Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36
#> 72                                  Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36
#> 73        Mozilla/5.0 (iPad; CPU OS 7_1_2 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) CriOS/35.0.1916.41 Mobile/11D257 Safari/9537.53
#> 74      Mozilla/5.0 (Linux; U; Android 4.3; nl-nl; GT-I9300 Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
#> 75      Mozilla/5.0 (Linux; Android 4.1.2; LG-P880 Build/JZO54K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.141 Mobile Safari/537.36
#> 76                                  Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
#> 77 Mozilla/5.0 (Linux; U; Android 2.3.6; nl-nl; GT-I9070 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
#> 78                                  Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
#> 79                                                                              Mozilla/5.0 (Windows NT 6.1; rv:30.0) Gecko/20100101 Firefox/30.0
#> 80     Mozilla/5.0 (Linux; Android 4.4.2; SM-G900F Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.141 Mobile Safari/537.36
#>    RespondentExperience Age_Rollup_Jongeren Age_Years_Rollup_Jongeren Age_Rollup_Opinie
#> 70             visualvi                  NA                        NA                 2
#> 71             visualvi                  NA                        NA                 1
#> 72             visualvi                  NA                        NA                 1
#> 73             flatview                  NA                        NA                 1
#> 74             mobilevi                  NA                        NA                 1
#> 75             mobilevi                  NA                        NA                 1
#> 76             visualvi                  NA                        NA                 2
#> 77             mobilevi                  NA                        NA                 1
#> 78             visualvi                  NA                        NA                 1
#> 79             visualvi                  NA                        NA                 1
#> 80             mobilevi                  NA                        NA                 1
#>    Age_Rollup_Jongeren_II Age_Rollup_Jongeren_III Education_Rollup_Opinie Stem2012_Rollup_Opinie
#> 70                     NA                      NA                       5                      2
#> 71                     NA                      NA                       5                      0
#> 72                     NA                      NA                       5                      8
#> 73                     NA                      NA                       5                      1
#> 74                     NA                      NA                       5                      8
#> 75                     NA                      NA                       5                      6
#> 76                     NA                      NA                       5                      7
#> 77                     NA                      NA                       5                     13
#> 78                     NA                      NA                       5                      2
#> 79                     NA                      NA                       5                      1
#> 80                     NA                      NA                       5                      2
#>    Community_Segment Geboortedatum_Jongeren Geslacht_Jongeren Provincie_Jongeren Postcode_Jongeren
#> 70                 2                   <NA>                NA                 NA                  
#> 71                 2                   <NA>                NA                 NA                  
#> 72                 2                   <NA>                NA                 NA                  
#> 73                 2                   <NA>                NA                 NA                  
#> 74                 2                   <NA>                NA                 NA                  
#> 75                 2                   <NA>                NA                 NA                  
#> 76                 2                   <NA>                NA                 NA                  
#> 77                 2                   <NA>                NA                 NA                  
#> 78                 2                   <NA>                NA                 NA                  
#> 79                 2                   <NA>                NA                 NA                  
#> 80                 2                   <NA>                NA                 NA                  
#>    Situatie_Jongeren Opleiding_Jongeren Onderwijs_verdeling_Jongeren Herkomst_familie_Jongeren
#> 70                NA                 NA                           NA                        NA
#> 71                NA                 NA                           NA                        NA
#> 72                NA                 NA                           NA                        NA
#> 73                NA                 NA                           NA                        NA
#> 74                NA                 NA                           NA                        NA
#> 75                NA                 NA                           NA                        NA
#> 76                NA                 NA                           NA                        NA
#> 77                NA                 NA                           NA                        NA
#> 78                NA                 NA                           NA                        NA
#> 79                NA                 NA                           NA                        NA
#> 80                NA                 NA                           NA                        NA
#>    Herkomst_familie_Jongeren_17_other Geslacht_Opinie Geboortedatum_Opinie Burgerlijke_staat_Opinie
#> 70                                                  1           1990-07-19                        4
#> 71                                                  2           1991-04-06                        4
#> 72                                                  2           1991-01-25                        4
#> 73                                                  1           1991-01-12                        4
#> 74                                                  1           1991-03-31                        4
#> 75                                                  2           1991-04-17                        4
#> 76                                                  2           1990-10-04                        4
#> 77                                                  2           1991-03-17                        4
#> 78                                                  1           1990-12-27                        4
#> 79                                                  1           1991-03-02                        4
#> 80                                                  2           1991-04-03                        4
#>    Situatie_huishouden_Opinie Leeftijd_kinderen_Opinie_03jaar Leeftijd_kinderen_Opinie_412jaar
#> 70                          1                              NA                               NA
#> 71                          1                              NA                               NA
#> 72                          2                              NA                               NA
#> 73                          1                              NA                               NA
#> 74                          5                              NA                               NA
#> 75                          5                              NA                               NA
#> 76                          4                              NA                               NA
#> 77                          5                              NA                               NA
#> 78                          7                              NA                               NA
#> 79                          1                              NA                               NA
#> 80                          1                              NA                               NA
#>    Leeftijd_kinderen_Opinie_1318jaar Leeftijd_kinderen_Opinie_1924jaar
#> 70                                NA                                NA
#> 71                                NA                                NA
#> 72                                NA                                NA
#> 73                                NA                                NA
#> 74                                NA                                NA
#> 75                                NA                                NA
#> 76                                NA                                NA
#> 77                                NA                                NA
#> 78                                NA                                NA
#> 79                                NA                                NA
#> 80                                NA                                NA
#>    Leeftijd_kinderen_Opinie_25jaarenouder Leeftijd_kinderen_Opinie_Ikhebgeenthuiswonendekinderen
#> 70                                     NA                                                     NA
#> 71                                     NA                                                     NA
#> 72                                     NA                                                     NA
#> 73                                     NA                                                     NA
#> 74                                     NA                                                     NA
#> 75                                     NA                                                     NA
#> 76                                     NA                                                     NA
#> 77                                     NA                                                     NA
#> 78                                     NA                                                     NA
#> 79                                     NA                                                     NA
#> 80                                     NA                                                     NA
#>    Provincie_Opinie Stad_Opinie Postcode_Opinie Huis_Opinie Opleiding_Opinie
#> 70                8          22            1965           1                5
#> 71                8          21            1971           2                6
#> 72               11           7            5211           1                5
#> 73                3          22            9305           2                6
#> 74                1          10            9722           2                6
#> 75                5           1            1314           1                5
#> 76                9          21            2312           1                6
#> 77                1          21            9672           1                6
#> 78               10          21            4384           1                5
#> 79                9          17            3043           2                5
#> 80                8          21            1823           2                5
#>    Dagelijkse_activiteit_Opinie Werk_sector_Opinie Gezondheidszorg_Opinie Onderwijs_Opinie
#> 70                            5                 NA                     NA               NA
#> 71                            5                 NA                     NA               NA
#> 72                            5                 NA                     NA               NA
#> 73                            5                 NA                     NA               NA
#> 74                            1                 11                      6               NA
#> 75                            5                 NA                     NA               NA
#> 76                            5                 NA                     NA               NA
#> 77                            5                 NA                     NA               NA
#> 78                            5                 NA                     NA               NA
#> 79                            5                 NA                     NA               NA
#> 80                            5                 NA                     NA               NA
#>    Vervoer_Opinie Inkomen_Opinie Lidmaatschap_politieke_partij_Opinie Stemgedrag_TK_Opinie
#> 70             NA              1                                    1                    2
#> 71             NA              8                                    1                   16
#> 72             NA              1                                    1                    8
#> 73             NA              6                                    1                    1
#> 74             NA              3                                    9                    8
#> 75             NA              1                                    7                    6
#> 76             NA              1                                    8                    7
#> 77             NA              2                                    1                   14
#> 78             NA              3                                    1                    2
#> 79             NA              8                                    1                    1
#> 80             NA              1                                    1                    2
#>    Vakbond_Opinie Herkomst_familie_Opinie Herkomst_familie_Opinie_22_other Religie_Opinie
#> 70              1                      22                        Hong Kong              3
#> 71              1                       1                                               1
#> 72              1                       1                                               1
#> 73              1                       1                                               1
#> 74              1                       1                                               1
#> 75              2                       1                                               1
#> 76              1                       1                                               3
#> 77              1                       1                                               1
#> 78              1                       1                                               1
#> 79              1                       1                                               1
#> 80              1                       1                                               1
#>    Religie_Opinie_7_other ERR_MSG Cohort_Jongeren Cohort_Opinie debug Post_Code_Rollup_Opinie
#> 70                                             NA             8    NA                       3
#> 71                                             NA             2    NA                       3
#> 72                                             NA             9    NA                       3
#> 73                                             NA            10    NA                       3
#> 74                                             NA             6    NA                       3
#> 75                                             NA             5    NA                       3
#> 76                                             NA             3    NA                       2
#> 77                                             NA             7    NA                       3
#> 78                                             NA             4    NA                       3
#> 79                                             NA             8    NA                       1
#> 80                                             NA             8    NA                       3

DATA COA

We made a request to COA for data on the number of Asylum Seekers COA housed. We received two pdf files which may be accessed below.

  • for data on regular and temporary ASCs see here
  • for data on crisis ASCs see here

Data preperation

To have peak at our data mangling. Please see below.

# rm (list = ls( )) Load required R packages
require(XML)
require(foreign)
require(sp)
require(maptools)
require(rgdal)
require(splancs)
require(spatstat)
require(RColorBrewer)
require(spdep)
require(raster)
require(reshape)
require(stringr)
require(psych)
require(lme4)
require(sjPlot)
require(plyr)
require(Hmisc)
require(rgeos)
require(anesrake)
require(weights)

# CONTENT 1. Data AZCS - pc4 en gc 2. Data other characteristics - pc4 and gc 3. EV data 4. merge EV
# data with other data 5. EV data - make indv level vars


# FOR READ in DATA setwd('C:/Users/U497130/AppData/Local/surfdrive_data/artikel azc/data/') thuis
# setwd('C:/Users/Joran/SURFdrive/artikel azc/data/')
setwd("U:/Surfdrive backup/artikel azc/data/")

# COMBINE REGULAR AND CRISIS CENTRE AZC DATA regulier en nood
regnood <- read.csv2(file = "Adressenlijst opvanglocaties jan 2015_16082016.csv")
head(regnood)
# Landal:https://www.landaleigenaren.nl/nl-nl/nieuws/landal-levert-bijdrage-aan-vluchtelingenopvang-14659

# crisis tussen 18/09 en 22/12
crisis <- read.csv2(file = "Adressen opvanglocatie CNO capaciteit_16082016.csv")
head(crisis)

# samenvoegen azcs
rbind.all.columns <- function(x, y) {
    
    x.diff <- setdiff(colnames(x), colnames(y))
    y.diff <- setdiff(colnames(y), colnames(x))
    
    x[, c(as.character(y.diff))] <- NA
    
    y[, c(as.character(x.diff))] <- NA
    
    return(rbind(x, y))
}

azc <- rbind.all.columns(regnood, crisis)
head(azc)

# KOPPEL GCODE AAN AZC.
pc4gc_2013 <- read.csv2(file = "pc4gc_2013.csv", row.names = "X")
head(pc4gc_2013)
azc <- merge(azc, pc4gc_2013, all.x = T, by.x = "PC4", by.y = "pc4", sort = F)
head(azc)

# make azc vars
azc$s1cap_pc4t1 <- ifelse(azc$Soort == 1, azc$Cap_01012015, 0)
azc$s1cap_pc4t2 <- ifelse(azc$Soort == 1, azc$Cap_15112015, 0)

azc$s2cap_pc4t1 <- ifelse(azc$Soort == 2, azc$Cap_01012015, 0)
azc$s2cap_pc4t2 <- ifelse(azc$Soort == 2, azc$Cap_15112015, 0)

azc$s3cap_pc4t1 <- 0
azc$s3cap_pc4t2 <- ifelse(azc$Soort == 3, azc$Cap_Gem, 0)

head(azc)

# Handle pc4 with 2 or more azc (beslisregels:Stappen AZC data 15032017.doc)
dups <- rbind(azc[duplicated(azc$PC4), ], azc[duplicated(azc$PC4, fromLast = TRUE), ])
dups <- dups[order(dups$PC4), ]
dups[, c(1, 2, 13:18)]
azc_sel <- azc[, c(1, 12, 13:18)]
azc_sel <- azc_sel[rownames(azc_sel) != "153", ]
azc_sel <- azc_sel[rownames(azc_sel) != "29", ]
azc_sel$s3cap_pc4t2[rownames(azc_sel) == "30"] <- azc_sel$s3cap_pc4t2[rownames(azc_sel) == "31"]
azc_sel <- azc_sel[rownames(azc_sel) != "31", ]
azc_sel$s3cap_pc4t2[rownames(azc_sel) == "171"] <- azc_sel$s3cap_pc4t2[rownames(azc_sel) == "171"] + 
    azc_sel$s3cap_pc4t2[rownames(azc_sel) == "172"]
azc_sel <- azc_sel[rownames(azc_sel) != "172", ]
azc_sel$s3cap_pc4t2[rownames(azc_sel) == "40"] <- azc_sel$s3cap_pc4t2[rownames(azc_sel) == "39"]
azc_sel <- azc_sel[rownames(azc_sel) != "39", ]
azc_sel$s1cap_pc4t2[rownames(azc_sel) == "47"] <- azc_sel$s1cap_pc4t2[rownames(azc_sel) == "47"] + azc_sel$s3cap_pc4t2[rownames(azc_sel) == 
    "48"]
azc_sel <- azc_sel[rownames(azc_sel) != "48", ]
azc_sel$s2cap_pc4t2[rownames(azc_sel) == "75"] <- azc_sel$s2cap_pc4t2[rownames(azc_sel) == "76"]
azc_sel <- azc_sel[rownames(azc_sel) != "76", ]
azc_sel <- azc_sel[rownames(azc_sel) != "80", ]
azc_sel$s1cap_pc4t1[rownames(azc_sel) == "87"] <- azc_sel$s1cap_pc4t1[rownames(azc_sel) == "87"] + azc_sel$s1cap_pc4t1[rownames(azc_sel) == 
    "88"]
azc_sel$s1cap_pc4t2[rownames(azc_sel) == "87"] <- azc_sel$s1cap_pc4t2[rownames(azc_sel) == "87"] + azc_sel$s1cap_pc4t2[rownames(azc_sel) == 
    "88"]
azc_sel <- azc_sel[rownames(azc_sel) != "88", ]
azc_sel$s1cap_pc4t2[rownames(azc_sel) == "92"] <- azc_sel$s1cap_pc4t2[rownames(azc_sel) == "92"] + azc_sel$s3cap_pc4t2[rownames(azc_sel) == 
    "93"]
azc_sel <- azc_sel[rownames(azc_sel) != "93", ]


# AGGREGEER NAAR GC.
azcgc <- aggregate(azc_sel[, c("s1cap_pc4t1", "s1cap_pc4t2", "s2cap_pc4t1", "s2cap_pc4t2", "s3cap_pc4t1", 
    "s3cap_pc4t2")], by = list(azc_sel$gc), FUN = sum)
names(azcgc) <- c("gc", "s1cap_gct1", "s1cap_gct2", "s2cap_gct1", "s2cap_gct2", "s3cap_gct1", "s3cap_gct2")
head(azcgc)


# MATCH AZC DATA aan PC4 FILE

# Load PC4 shape
shapepc4 <- readOGR("U:/PhD Documents/PC4Basic/shape", layer = "Nlp4_r14_basic")
# thuis shapepc4 <- readOGR('C:/Users/Joran/Documents/PhD Nijmegen/PC4Basic/shape',
# layer='Nlp4_r14_basic')
shapepc4 <- shapepc4[, c("PC4NR")]

pc4 <- merge(shapepc4, pc4gc_2013, all.x = T, by.x = "PC4NR", by.y = "pc4", sort = F)
pc4 <- merge(pc4, azc_sel, by.x = c("PC4NR", "gc"), by.y = c("PC4", "gc"), sort = F)
pc4 <- merge(pc4, azcgc, by.x = c("gc"), by.y = c("gc"), sort = F)

pc4@data[, c(3:14)][is.na(pc4@data[, c(3:14)])] <- 0


# AGGREGEER NAAR AANGR
pc4_nbq <- poly2nb(pc4, row.names = c(1:nrow(pc4)))

pc4$s3cap_aangrt2 <- pc4$s3cap_aangrt1 <- pc4$s2cap_aangrt2 <- pc4$s2cap_aangrt1 <- pc4$s1cap_aangrt2 <- pc4$s1cap_aangrt1 <- rep(NA, 
    nrow(pc4))

funs1t1 <- function(x) {
    sum(pc4$s1cap_pc4t1[x])
}
funs1t2 <- function(x) {
    sum(pc4$s1cap_pc4t2[x])
}
funs2t1 <- function(x) {
    sum(pc4$s2cap_pc4t1[x])
}
funs2t2 <- function(x) {
    sum(pc4$s2cap_pc4t2[x])
}
funs3t1 <- function(x) {
    sum(pc4$s3cap_pc4t1[x])
}
funs3t2 <- function(x) {
    sum(pc4$s3cap_pc4t2[x])
}

pc4$s1cap_aangrt1 <- sapply(pc4_nbq, funs1t1)
pc4$s1cap_aangrt2 <- sapply(pc4_nbq, funs1t2)
pc4$s2cap_aangrt1 <- sapply(pc4_nbq, funs2t1)
pc4$s2cap_aangrt2 <- sapply(pc4_nbq, funs2t2)
pc4$s3cap_aangrt1 <- sapply(pc4_nbq, funs3t1)
pc4$s3cap_aangrt2 <- sapply(pc4_nbq, funs3t2)

# plus eigen buurt er ook bij
pc4$s1cap_aangrt1 <- pc4$s1cap_aangrt1 + pc4$s1cap_pc4t1
pc4$s1cap_aangrt2 <- pc4$s1cap_aangrt2 + pc4$s1cap_pc4t2
pc4$s2cap_aangrt1 <- pc4$s2cap_aangrt1 + pc4$s2cap_pc4t1
pc4$s2cap_aangrt2 <- pc4$s2cap_aangrt2 + pc4$s2cap_pc4t2
pc4$s3cap_aangrt1 <- pc4$s3cap_aangrt1 + pc4$s3cap_pc4t1
pc4$s3cap_aangrt2 <- pc4$s3cap_aangrt2 + pc4$s3cap_pc4t2


# ADD OTHER NBHOOD CHARACTERISTICS

# LOAD %NONWEST, WOZ, INW alternatief via spTransform
rd2wgs84 <- function(X, Y) {
    # http://www.dekoepel.nl/pdf/Transformatieformules.pdf basispunten definieren
    X0 <- 155000
    Y0 <- 463000
    j0 <- 52.1551744
    l0 <- 5.38720621
    # coefficienten definieren
    K01 <- 3235.65389
    K20 <- -32.58297
    K02 <- -0.2475
    K21 <- -0.84978
    K03 <- -0.0655
    K22 <- -0.01709
    K10 <- -0.00738
    K40 <- 0.0053
    K23 <- -0.00039
    K41 <- 0.00033
    K11 <- -0.00012
    
    L10 <- 5260.52916
    L11 <- 105.94684
    L12 <- 2.45656
    L30 <- -0.81885
    L13 <- 0.05594
    L31 <- -0.05607
    L01 <- 0.01199
    L32 <- -0.00256
    L14 <- 0.00128
    L02 <- 0.00022
    L20 <- -0.00022
    L50 <- 0.00026
    
    dX <- (X - X0) * 10^-5
    dY <- (Y - Y0) * 10^-5
    {
        j <- j0 + (K01 * dX^0 * dY^1 + K02 * dX^0 * dY^2 + K03 * dX^0 * dY^3 + K10 * dX^1 * dY^0 + K20 * 
            dX^2 * dY^0 + K21 * dX^2 * dY^1 + K22 * dX^2 * dY^2 + K23 * dX^1 * dY^3 + K40 * dX^2 * dY^0 + 
            K41 * dX^2 * dY^1)/3600
    }
    
    {
        l <- l0 + (L10 * dX^1 * dY^0 + L11 * dX^1 * dY^1 + L12 * dX^1 * dY^2 + L30 * dX^3 * dY^0 + L13 * 
            dX^1 * dY^3 + L31 * dX^3 * dY^1 + L01 * dX^0 * dY^1 + L32 * dX^3 * dY^2 + L14 * dX^1 * dY^4 + 
            L02 * dX^0 * dY^2 + L20 * dX^2 * dY^0 + L50 * dX^5 * dY^0)/3600
    }
    wgs84 <- cbind(j, l)
    return(wgs84)
}

# load cbs100
setwd("U:/PhD Documents/CBS vierkant 2014/")
# Thuis setwd('C:/Users/Joran/Documents/PhD Nijmegen/CBS vierkant 2014/')

cbs100 <- read.spss(file = "CBSvierkant100m201410.sav", use.value.labels = FALSE, to.data.frame = T)
names(cbs100)
length(cbs100[, 1])

cbs100$E <- as.numeric(substr(cbs100$c28992r100, 2, 5))
cbs100$N <- as.numeric(substr(cbs100$c28992r100, 7, length(cbs100$c28992r100)))
cbs100$east <- (cbs100$E * 100) + 50
cbs100$north <- (cbs100$N * 100) + 50
cbs100 <- cbind(cbs100, rd2wgs84(cbs100$east, cbs100$north))
cbs100$ncel <- 1
cbs100$celid <- 1:length(cbs100$ncel)
head(cbs100)

# RECODE CBS100 OP BASIS VAN DISTRIBUTIE IN BUURTEN. 2014
nedb <- readOGR("U:/PhD Documents/CBS shapefiles/shape 2014", layer = "buurt_2014")
# thuis nedb <- readOGR('C:/Users/Joran/Documents/PhD Nijmegen/CBS shapefiles/shape 2014',
# layer='buurt_2014')

nedb <- nedb[nedb$WATER == "NEE", ]
names(nedb)

# alleen land delen.
nedb2 <- nedb[nedb$WATER == "NEE", ]
nedb2$P_N_W_AL <- ifelse(nedb2$P_N_W_AL == -99999997, 0, nedb2$P_N_W_AL)
nedb2$P_WEST_AL <- ifelse(nedb2$P_WEST_AL == -99999997, 0, nedb2$P_WEST_AL)
nedb2$P_AUT <- 100 - nedb2$P_N_W_AL - nedb2$P_WEST_AL

# volgens cbs handleiding 5: geen autochtonen 4: 90 procent of meer autochtonen 3: 75 tot 90 procent
# autochtonen 2: 60 tot 75 procent autochtonen 1: 40 tot 60 procent autochtonen 7: minder dan 40
# procent autochtonen

# 5: geen westerse allochtonen 3: 45 procent of meer westerse allochtonen 2: 25 tot 45 procent
# westerse allochtonen 1: 15 tot 25 procent westerse allochtonen 4: 8 tot 15 procent westerse
# allochtonen 7: minder dan 8 procent westerse allochtonen

# 5: geen niet-westerse allochtonen 4: 67 procent of meer niet-westerse allochtonen 3: 45 tot 67
# procent niet-westerse allochtonen 2: 25 tot 45 procent niet-westerse allochtonen 1: 10 tot 25
# procent niet-westerse allochtonen 7: minder dan 10 procent niet-westerse allochtonen

# 2014
nedb2$P_AUT2[nedb2$P_AUT == 0] <- 0
nedb2$P_AUT2[nedb2$P_AUT >= 90] <- 1
nedb2$P_AUT2[nedb2$P_AUT >= 75 & nedb2$P_AUT < 90] <- 2
nedb2$P_AUT2[nedb2$P_AUT >= 60 & nedb2$P_AUT < 75] <- 3
nedb2$P_AUT2[nedb2$P_AUT >= 40 & nedb2$P_AUT < 65] <- 4
nedb2$P_AUT2[nedb2$P_AUT > 0 & nedb2$P_AUT < 40] <- 5

des <- describeBy(nedb2$P_AUT, nedb2$P_AUT2)
pautrecode <- matrix(as.numeric(unclass(unlist(des))), nrow = dim(des), byrow = T)
pautrecode <- data.frame(pautrecode)
colnames(pautrecode) <- names(des[[1]])
pautrecode$mean
# [1] 0.00000 97.37508 82.06138 69.92389 50.40706 23.88861

nedb2$P_WEST_AL2[nedb2$P_WEST_AL == 0] <- 0
nedb2$P_WEST_AL2[nedb2$P_WEST_AL >= 45] <- 1
nedb2$P_WEST_AL2[nedb2$P_WEST_AL >= 25 & nedb2$P_WEST_AL < 45] <- 2
nedb2$P_WEST_AL2[nedb2$P_WEST_AL >= 15 & nedb2$P_WEST_AL < 25] <- 3
nedb2$P_WEST_AL2[nedb2$P_WEST_AL >= 8 & nedb2$P_WEST_AL < 15] <- 4
nedb2$P_WEST_AL2[nedb2$P_WEST_AL > 0 & nedb2$P_WEST_AL < 8] <- 5

des <- describeBy(nedb2$P_WEST_AL, nedb2$P_WEST_AL2)
pwalrecode <- matrix(as.numeric(unclass(unlist(des))), nrow = dim(des), byrow = T)
pwalrecode <- data.frame(pwalrecode)
colnames(pwalrecode) <- names(des[[1]])
pwalrecode$mean
# [1] 0.000000 51.931746 31.865649 16.231917 10.027004 5.405292

nedb2$P_N_W_AL2[nedb2$P_N_W_AL == 0] <- 0
nedb2$P_N_W_AL2[nedb2$P_N_W_AL >= 67] <- 1
nedb2$P_N_W_AL2[nedb2$P_N_W_AL >= 45 & nedb2$P_N_W_AL < 67] <- 2
nedb2$P_N_W_AL2[nedb2$P_N_W_AL >= 25 & nedb2$P_N_W_AL < 45] <- 3
nedb2$P_N_W_AL2[nedb2$P_N_W_AL >= 10 & nedb2$P_N_W_AL < 25] <- 4
nedb2$P_N_W_AL2[nedb2$P_N_W_AL > 0 & nedb2$P_N_W_AL < 10] <- 5

des <- describeBy(nedb2$P_N_W_AL, nedb2$P_N_W_AL2)
pnwalrecode <- matrix(as.numeric(unclass(unlist(des))), nrow = dim(des), byrow = T)
pnwalrecode <- data.frame(pnwalrecode)
colnames(pnwalrecode) <- names(des[[1]])
pnwalrecode$mean
# [1] 0.000000 75.998914 53.030019 30.792600 15.197071 4.109998

# make numeric first
cbs100$p_auto2014 <- as.numeric(cbs100$p_auto2014)
cbs100$p_wal2014 <- as.numeric(cbs100$p_wal2014)
cbs100$p_nwal2014 <- as.numeric(cbs100$p_nwal2014)

# recategorize auto
cbs100$pauto2014[cbs100$p_auto2014 == 5] <- 0
cbs100$pauto2014[cbs100$p_auto2014 == 4] <- pautrecode$mean[1]
cbs100$pauto2014[cbs100$p_auto2014 == 3] <- pautrecode$mean[2]
cbs100$pauto2014[cbs100$p_auto2014 == 2] <- pautrecode$mean[3]
cbs100$pauto2014[cbs100$p_auto2014 == 1] <- pautrecode$mean[4]
cbs100$pauto2014[cbs100$p_auto2014 == 7] <- pautrecode$mean[5]
cbs100$nauto2014 <- cbs100$inw2014 * (cbs100$pauto2014/100)
cbs100$nauto2014[cbs100$inw2014 == 0] <- 0
cbs100$nauto2014b <- cbs100$nauto2014
cbs100$nauto2014b[is.na(cbs100$nauto2014b)] <- 2
cbs100$nauto2014mis <- ifelse(is.na(cbs100$nauto2014), 1, 0)
cbs100$nauto2014[is.na(cbs100$nauto2014)] <- 0
sum(cbs100$nauto2014, na.rm = T)

# recategorize wal
cbs100$pwal2014[cbs100$p_wal2014 == 5] <- pwalrecode$mean[1]
cbs100$pwal2014[cbs100$p_wal2014 == 3] <- pwalrecode$mean[2]
cbs100$pwal2014[cbs100$p_wal2014 == 2] <- pwalrecode$mean[3]
cbs100$pwal2014[cbs100$p_wal2014 == 1] <- pwalrecode$mean[4]
cbs100$pwal2014[cbs100$p_wal2014 == 4] <- pwalrecode$mean[5]
cbs100$pwal2014[cbs100$p_wal2014 == 7] <- pwalrecode$mean[6]
cbs100$nwal2014 <- cbs100$inw2014 * (cbs100$pwal2014/100)
cbs100$nwal2014[cbs100$inw2014 == 0] <- 0
cbs100$nwal2014b <- cbs100$nwal2014
cbs100$nwal2014b[is.na(cbs100$nwal2014b)] <- 2
cbs100$nwal2014mis <- ifelse(is.na(cbs100$nwal2014), 1, 0)
cbs100$nwal2014[is.na(cbs100$nwal2014)] <- 0
sum(cbs100$nwal2014, na.rm = T)

# recategorize nwal
cbs100$pnwal2014[cbs100$p_nwal2014 == 5] <- pnwalrecode$mean[1]
cbs100$pnwal2014[cbs100$p_nwal2014 == 4] <- pnwalrecode$mean[2]
cbs100$pnwal2014[cbs100$p_nwal2014 == 3] <- pnwalrecode$mean[3]
cbs100$pnwal2014[cbs100$p_nwal2014 == 2] <- pnwalrecode$mean[4]
cbs100$pnwal2014[cbs100$p_nwal2014 == 1] <- pnwalrecode$mean[5]
cbs100$pnwal2014[cbs100$p_nwal2014 == 7] <- pnwalrecode$mean[6]
cbs100$nnwal2014 <- cbs100$inw2014 * (cbs100$pnwal2014/100)
cbs100$nnwal2014[cbs100$inw2014 == 0] <- 0
cbs100$nnwal2014b <- cbs100$nnwal2014
cbs100$nnwal2014b[is.na(cbs100$nnwal2014b)] <- 2
cbs100$nnwal2014mis <- ifelse(is.na(cbs100$nnwal2014), 1, 0)
cbs100$nnwal2014[is.na(cbs100$nnwal2014)] <- 0
sum(cbs100$nnwal2014, na.rm = T)

# bevolking
ntotaal <- sum(cbs100$nauto2014, na.rm = T) + sum(cbs100$nwal2014, na.rm = T) + sum(cbs100$nnwal2014, 
    na.rm = T)
ntotaalb <- sum(cbs100$nauto2014b, na.rm = T) + sum(cbs100$nwal2014b, na.rm = T) + sum(cbs100$nnwal2014b, 
    na.rm = T)
sum(cbs100$nwal2014, na.rm = T)/ntotaal

########################### 

# oppervlakte
oppv <- as.numeric(gArea(shapepc4, byid = T)/1000^2)  #nu in vierkante km
# 134km^2 voor postcode 8252 klopt
oppv <- as.data.frame(cbind(oppv, shapepc4$PC4NR))
oppv <- rename(oppv, c(V2 = "PC4NR"))

pc4 <- merge(pc4, oppv, by = "PC4NR")

# coordinaatstelsel omzetten pc4
shapepc4 <- spTransform(shapepc4, CRS("+proj=longlat +ellps=WGS84"))
proj4string(shapepc4)

# gridcells voor elke PC4 selecteren
coordinates(cbs100) = c("l", "j")
llCRS <- CRS("+proj=longlat +ellps=WGS84")
loc_g <- SpatialPoints(cbs100, proj4string = llCRS)
proj4string(loc_g) <- proj4string(shapepc4)
locg <- over(shapepc4, loc_g, returnList = T)

# 2014 select necessary data
popcounts <- cbs100[c("nauto2014", "nwal2014", "nnwal2014", "inw2014")]
popcounts$inw2014[popcounts$inw2014 < 0] <- NA

# calculate proportions for every pc4.
prop <- function(x) {
    ifelse(cbind(length(x) != 0, length(x) != 0, length(x) != 0), colSums(as.data.frame(popcounts@data[x, 
        1:3]))/sum(colSums(as.data.frame(popcounts@data[x, 1:3]))), c(NA, NA, NA))
}
prop2 <- lapply(locg, prop)
PC4prop <- data.frame(matrix(unlist(prop2), nrow = length(locg), ncol = 3, byrow = T))
colnames(PC4prop) <- c("pauto2014", "pwal2014", "pnwal2014")

pc4prop <- cbind(PC4prop, shapepc4$PC4NR)
pc4prop <- rename(pc4prop, c(`shapepc4$PC4NR` = "PC4NR"))
head(pc4prop)

pc4 <- merge(pc4, pc4prop, by = "PC4NR")

# calculate aantinw
inw <- function(x) {
    ifelse(length(x) != 0, sum(as.data.frame(popcounts@data[x, 4]), na.rm = TRUE), c(NA))
}
inw2 <- lapply(locg, inw)
PC4inw <- data.frame(matrix(unlist(inw2), nrow = length(locg), ncol = 1, byrow = T))
colnames(PC4inw) <- c("inw2014")

pc4inw <- cbind(PC4inw, shapepc4$PC4NR)
pc4inw <- rename(pc4inw, c(`shapepc4$PC4NR` = "PC4NR"))
head(pc4inw)

pc4 <- merge(pc4, pc4inw, by = "PC4NR")

# calculate weightedwoz
wozcounts <- cbs100[c("wozwon2012", "won2012")]
wozcounts$wozwon2012[wozcounts$wozwon2012 < 0] <- NA
wozcounts$won2012[wozcounts$won2012 < 0] <- NA

woz <- function(x) {
    ifelse(length(x) != 0, sum(as.data.frame(wozcounts@data[x, 1]) * as.data.frame(wozcounts@data[x, 
        2]), na.rm = T)/sum(as.data.frame(wozcounts@data[x, 2]), na.rm = T), c(NA))
}
woz2 <- lapply(locg, woz)
PC4woz <- data.frame(matrix(unlist(woz2), nrow = length(locg), ncol = 1, byrow = T))
colnames(PC4woz) <- c("woz2012")

pc4woz <- cbind(PC4woz, shapepc4$PC4NR)
pc4woz <- rename(pc4woz, c(`shapepc4$PC4NR` = "PC4NR"))
head(pc4woz)

pc4 <- merge(pc4, pc4woz, by = "PC4NR")

# add coordinates centroids pc4
pc4$l <- coordinates(shapepc4)[, 1]
pc4$j <- coordinates(shapepc4)[, 2]

head(pc4)

pc4$nnwal <- pc4$pnwal2014 * pc4$inw2014


# AANGRENZENDE context data
names(pc4@data)[21:28] <- paste(names(pc4@data[, c(21:28)]), "pc4", sep = "_")

pc4$woz2012_aangr <- pc4$inw2014_aangr <- pc4$pnwal2014_aangr <- rep(NA, nrow(pc4))

funinw <- function(x) {
    sum(pc4$inw2014_pc4[x], na.rm = T)
}
funpnw <- function(x) {
    sum(pc4$pnwal2014_pc4[x] * pc4$inw2014_pc4[x], na.rm = T)/sum(pc4$inw2014_pc4[x], na.rm = T)
}
funwoz <- function(x) {
    sum(pc4$woz2012_pc4[x], na.rm = T)/length(pc4$woz2012_pc4[x])
}
funlen <- function(x) {
    length(pc4$woz2012_pc4[x])
}

pc4$inw2014_aangr <- sapply(pc4_nbq, funinw)
pc4$pnwal2014_aangr <- sapply(pc4_nbq, funpnw)
pc4$woz2012_aangr <- sapply(pc4_nbq, funwoz)
pc4$wozlength <- sapply(pc4_nbq, funlen)

# plus eigen buurt erbij
pc4$inw2014_aangr <- pc4$inw2014_aangr + pc4$inw2014_pc4
pc4$pnwal2014_aangr <- (pc4$pnwal2014_aangr * pc4$inw2014_aangr + pc4$pnwal2014_pc4 * pc4$inw2014_pc4)/(pc4$inw2014_aangr + 
    pc4$inw2014_pc4)
pc4$woz2012_aangr <- ((pc4$woz2012_aangr * pc4$wozlength) + pc4$woz2012_pc4)/(pc4$wozlength + 1)

pc4 <- pc4[, c(1:ncol(pc4) - 1)]

# GEMEENTES context data
nedg <- readOGR("U:/PhD Documents/CBS shapefiles/shape 2014", layer = "gem_2014")
# thuis nedg <- readOGR('C:/Users/Joran/Documents/PhD Nijmegen/CBS shapefiles/shape 2014',
# layer='gem_2014')

nedg <- nedg[nedg$WATER == "NEE", ]
gemeente <- as.character(nedg@data$GM_CODE)
gemeente <- substr(gemeente, 3, length(gemeente))
nedg$gcode <- as.numeric(gemeente)

# oppervlakte
oppv <- as.numeric(gArea(nedg, byid = T)/1000^2)  #nu in vierkante km
# 134km^2 voor postcode 8252 klopt
oppv <- as.data.frame(cbind(oppv, nedg$gcode))
oppv <- rename(oppv, c(V2 = "gcode"))

# Transform into spatial data
nedg <- spTransform(nedg, CRS("+proj=longlat +ellps=WGS84"))
# gridcells voor elke gemeente selecteren
llCRS <- CRS("+proj=longlat +ellps=WGS84")
loc_g <- SpatialPoints(cbs100, proj4string = llCRS)
proj4string(loc_g) <- proj4string(nedg)
locg <- over(nedg, loc_g, returnList = T)

# select necessary data
popcounts <- cbs100[c("nauto2014", "nwal2014", "nnwal2014", "inw2014")]
popcounts$inw2014[popcounts$inw2014 < 0] <- NA

# calculate proportions for every gem.
prop <- function(x) {
    ifelse(cbind(length(x) != 0, length(x) != 0, length(x) != 0), colSums(as.data.frame(popcounts@data[x, 
        1:3]))/sum(colSums(as.data.frame(popcounts@data[x, 1:3]))), c(NA, NA, NA))
}
prop2 <- lapply(locg, prop)
gemprop <- data.frame(matrix(unlist(prop2), nrow = length(locg), ncol = 3, byrow = T))
colnames(gemprop) <- c("pauto2014", "pwal2014", "pnwal2014")

gemprop <- cbind(gemprop, nedg$gcode)
gem <- rename(gemprop, c(`nedg$gcode` = "gcode"))
head(gem)

# calculate aantinw
inw <- function(x) {
    ifelse(length(x) != 0, sum(as.data.frame(popcounts@data[x, 4]), na.rm = TRUE), c(NA))
}
inw2 <- lapply(locg, inw)
geminw <- data.frame(matrix(unlist(inw2), nrow = length(locg), ncol = 1, byrow = T))
colnames(geminw) <- c("inw2014")

geminw <- cbind(geminw, nedg$gcode)
geminw <- rename(geminw, c(`nedg$gcode` = "gcode"))
head(geminw)

gem <- merge(gem, geminw, by = "gcode")

# calculate weightedwoz
wozcounts <- cbs100[c("wozwon2012", "won2012")]
wozcounts$wozwon2012[wozcounts$wozwon2012 < 0] <- NA
wozcounts$won2012[wozcounts$won2012 < 0] <- NA

woz <- function(x) {
    ifelse(length(x) != 0, sum(as.data.frame(wozcounts@data[x, 1]) * as.data.frame(wozcounts@data[x, 
        2]), na.rm = T)/sum(as.data.frame(wozcounts@data[x, 2]), na.rm = T), c(NA))
}
woz2 <- lapply(locg, woz)
gemwoz <- data.frame(matrix(unlist(woz2), nrow = length(locg), ncol = 1, byrow = T))
colnames(gemwoz) <- c("woz2012")

gemwoz <- cbind(gemwoz, nedg$gcode)
gemwoz <- rename(gemwoz, c(`nedg$gcode` = "gcode"))
head(gemwoz)

gem <- merge(gem, gemwoz, by = "gcode")

# add oppv
gem <- merge(gem, oppv, by = "gocde")

# add centroid coordinates for gem
head(coordinates(nedg))
gem$l <- coordinates(nedg)[, 1]
gem$j <- coordinates(nedg)[, 2]

# _gc to datanames
colnames(gem)[2:8] <- paste(colnames(gem[2:8]), "gc", sep = "_")

# READ IN 1VOP DATA setwd('C:/Users/U497130/AppData/Local/surfdrive_data/artikel azc/data/') thuis
# setwd('C:/Users/Joran/SURFdrive/artikel azc/data/')
setwd("U:/Surfdrive backup/Artikel azc/data")

# Data Beide Waves data W2 1vandaag
ev_t2 <- read.spss(file = "AZC TOLSMA 3_17.11.15_08.40.15.AM.sav", use.value.labels = FALSE, to.data.frame = T)

# pc4 var aanmaken
names(ev_t2)
ev_t2 <- rename(ev_t2, c(Postcode_Opinie = "pc4"))
ev_t2$pc4 <- str_trim(ev_t2$pc4)
ev_t2$pc4 <- as.numeric(ev_t2$pc4)  #666 zonder geldige pc4

# select necessary vars
ev_t2 <- ev_t2[, c(1, 29:35, 45:47, 58:60, 71:74, 95:99, 109, 173:176, 183:197, 199)]
names(ev_t2)

# #Recode vars met _t2 erbij except id and pc4 colnames(ev_t2) <- paste(colnames(ev_t2),'t2', sep =
# '_') ev_t2 <- rename(ev_t2, c(PanelistIdQuestion_t2='PanelistIdQuestion')) ev_t2 <- rename(ev_t2,
# c(pc4_t2='pc4'))

# data W1 1vandaag
ev_t1 <- read.spss(file = "top1provincialestaten.sav", use.value.labels = FALSE, to.data.frame = T)

# pc4 var aanmaken
names(ev_t1)
ev_t1 <- rename(ev_t1, c(Postcode_Opinie = "pc4"))
ev_t1$pc4 <- str_trim(ev_t1$pc4)
ev_t1$pc4[11317] <- substr(ev_t1$pc4[11317], 1, 4)
ev_t1$pc4 <- as.numeric(ev_t1$pc4)  #473 zonder geldige pc4

# select necessary vars
ev_t1 <- ev_t1[, c(1, 15, 19:37)]
names(ev_t1)

# #Recode vars met _t1 erbij except id and pc4 colnames(ev_t1) <- paste(colnames(ev_t1),'t1', sep =
# '_') ev_t1 <- rename(ev_t1, c(PanelistIdQuestion_t1='PanelistIdQuestion')) ev_t1 <- rename(ev_t1,
# c(pc4_t1='pc4'))

# merge waves - COLUMN-WISE evpanel <- merge(ev_t2, ev_t1, by.x='PanelistIdQuestion',
# by.y='PanelistIdQuestion', sort=F) #20844 resps evpanel$pc4 <- ifelse(is.na(evpanel$pc4_t1),
# evpanel$pc4_t2, evpanel$pc4_t2) #same pc4s missings beide waves

# merge waves - ROW-WISE ID var for wave
ev_t1$tijd <- 1
ev_t2$tijd <- 2
head(ev_t1$PanelistIdQuestion)
head(ev_t2$PanelistIdQuestion)
# Rowbind and order two dataframes
evpanel <- rbind.fill(ev_t1, ev_t2)
evpanel <- evpanel[order(evpanel[, "PanelistIdQuestion"], evpanel[, "tijd"]), ]
head(evpanel)
names(evpanel)

# merge 1vandaag aan gc codes
head(pc4gc_2013)
evpanel <- merge(evpanel, pc4gc_2013, all.x = T, by = "pc4", sort = F)

# GCCODES 2013 OMZETTEN NAAR GCODES 2014, ZOVER ALS MOGELIJK
unique(evpanel$gc[!(evpanel$gc %in% nedg$gcode)])  # 499   82   55   51 1672  653 

# gcodes 2013 shape laden
nedg2 <- readOGR("U:/PhD Documents/CBS shapefiles/shape 2013", layer = "gem_2013_v1")
nedg2 <- nedg2[nedg2$WATER == "NEE", ]
gemeente <- as.character(nedg2@data$GM_CODE)
gemeente <- substr(gemeente, 3, length(gemeente))
nedg2$gcode <- as.numeric(gemeente)

nedg2$GM_NAAM[nedg2$gcode == 499]  # boskoop wordt alhpen aan de rijn
nedg2$GM_NAAM[nedg2$gcode == 1672]  #rijnwoude wordt alhpen aan de rijn
nedg2$GM_NAAM[nedg2$gcode == 82]  #lemsterland wordt de friese meren
nedg2$GM_NAAM[nedg2$gcode == 55]  #Boarnsterhim wordt de friese meren
nedg2$GM_NAAM[nedg2$gcode == 51]  #Skarsterlân wordt de friese meren
nedg2$GM_NAAM[nedg2$gcode == 653]  #Gaasterlân-Sleat wordt de friese meren

nedg$gcode[nedg$GM_NAAM == "Alphen aan den Rijn"]  #484
nedg$gcode[nedg$GM_NAAM == "De Friese Meren"]  #1921

evpanel$gc[evpanel$gc == 499] <- 484
evpanel$gc[evpanel$gc == 1672] <- 484
evpanel$gc[evpanel$gc == 82] <- 1921
evpanel$gc[evpanel$gc == 51] <- 1921
evpanel$gc[evpanel$gc == 55] <- 1921
evpanel$gc[evpanel$gc == 653] <- 1921


# ONE PERSON IN NEW AREA, SHOULD HAVE A GCODE
pc4$PC4NR[is.na(pc4$gc)]  # (1114) 1706 (5057)
evpanel$pc4[evpanel$pc4 == 1114 | evpanel$pc4 == 1706 | evpanel$pc4 == 5057]  #one respondent in 1706
# 1706 is heerhugowaard
names(nedg)
nedg[nedg$GM_NAAM == "Heerhugowaard", ]  # gc = 398
evpanel$gc[!is.na(evpanel$pc4) & evpanel$pc4 == 1706] <- 398

# pc4s that are not in pc4 shape
evpanel$pc4[!(evpanel$pc4 %in% pc4$PC4NR)]

# [1] 1000 1001 1020 1050 1070 1090 1100 1130 1200 1224 1234 1250 1270 1300 1500 1533 1550 [19] 1612
# 1672 1800 1917 1922 1940 1986 2000 2030 2100 2130 2300 2310 2399 2400 2482 2500 2501 [37] 2569 2588
# 2600 2695 2700 2800 2900 3000 3127 3160 3200 3283 3300 3350 3377 3391 3407 3440 [55] 3450 3500 3519
# 3535 3600 3620 3647 3700 3745 3760 3800 3810 3854 3900 3964 3977 4200 4330 [73] 4490 4500 4517 4530
# 4600 4750 4777 4800 4831 4857 4900 4919 4940 5000 5110 5120 5183 5200 [91] 5210 5300 5350 5360 5500
# 5520 5565 5572 5596 5600 5650 5700 5743 5800 5900 5945 5967 5983 [109] 6000 6040 6100 6130 6200
# 6203 6293 6400 6434 6500 6501 6552 6614 6800 6872 6906 6970 7000 [127] 7153 7175 7200 7219 7240
# 7248 7270 7300 7320 7360 7400 7500 7550 7600 7650 7698 7743 7770 [145] 7800 7900 7976 8000 8100
# 8180 8200 8234 8352 8440 8470 8500 8520 8543 8692 8705 8795 8847 [163] 8860 8900 9400 9480 9500
# 9504 9506 9540 9600 9700 9704 9800 9818 9930

# other pc4 that should have gc codes
nedg[nedg$GM_NAAM == "Blaricum", ]  # gc = 376
evpanel$gc[!is.na(evpanel$pc4) & evpanel$pc4 == 1262] <- 376

# pc4s on NA die niet bestaan, on the basis of pc4 shape, postbussen etc
evpanel$pc4[!(evpanel$pc4 %in% pc4$PC4NR)] <- NA


# MATCH EV DATA TO AZCS & OTHER DATA
pc4_sel <- pc4[, c(1, 3:25, 28:31)]
evpanel <- merge(evpanel, pc4_sel, all.x = T, by.x = "pc4", by.y = "PC4NR", sort = F)

gem_sel <- gem[, c(1:6)]
evpanel <- merge(evpanel, gem_sel, all.x = T, by.x = "gc", by.y = "gcode", sort = F)


# AZC SIZE AS number of seekers per 1000inhab OF PC4/PC4aangr/GC
azcproppc4 <- evpanel[, c(56:61)]/(evpanel[, c(77)]/1000)
summary(evpanel[is.na(evpanel$inw2014_pc4), c(1, 2, 56:61)])
# azcproppc4[is.na(azcproppc4) & !is.na(evpanel$pc4)] <- 0 #allemaal 0, dus NA kan op 0
colnames(azcproppc4) <- paste(colnames(azcproppc4), "rel", sep = "")
evpanel <- cbind(evpanel, azcproppc4)

azcpropaangr <- evpanel[, c(68:73)]/(evpanel[, c(81)]/1000)
summary(evpanel[is.na(evpanel$inw2014_pc4), c(1, 2, 68:73)])
# azcpropaangr[is.na(azcpropaangr)] <- 0 #allemaal 0, dus NA kan op 0
colnames(azcpropaangr) <- paste(colnames(azcpropaangr), "rel", sep = "")
evpanel <- cbind(evpanel, azcpropaangr)

azcpropgc <- evpanel[, c(62:67)]/(evpanel[, c(86)]/1000)
summary(evpanel[is.na(evpanel$inw2014_gc), c(1, 2, 62:67)])
# azcpropgc[is.na(azcpropgc)] <- 0 #allemaal 0, dus NA kan op 0
colnames(azcpropgc) <- paste(colnames(azcpropgc), "rel", sep = "")
evpanel <- cbind(evpanel, azcpropgc)
evpanel[!is.na(evpanel$gc) & is.na(evpanel$s1cap_gct1rel), c(100:105)] <- 0
names(evpanel)

# AZC SIZE AS number of seekers per nb non west OF PC4
azcnwpc4 <- evpanel[, c(56:61)]/(evpanel[, c(79)])
summary(evpanel[is.na(evpanel$inw2014_pc4), c(1, 2, 56:61)])
# azcproppc4[is.na(azcproppc4) & !is.na(evpanel$pc4)] <- 0 #allemaal 0, dus NA kan op 0
colnames(azcnwpc4) <- paste(colnames(azcnwpc4), "nw", sep = "")
evpanel <- cbind(evpanel, azcnwpc4)

####################################### CReate individual VARIABLES

# Select only native Dutch respondents
table(evpanel$Herkomst_familie_Opinie, useNA = "always")
evpanel <- evpanel[evpanel$Herkomst_familie_Opinie == 1 & !is.na(evpanel$Herkomst_familie_Opinie), ]  # minus (849) respondents 
table(evpanel$Herkomst_familie_Opinie, useNA = "always")


# DEPENDENT VARIABLES

# Voting intentions - W1
table(evpanel$stemvraag, useNA = "always")
evpanel$vote <- evpanel$stemvraag
# t1: '1'='vvd', '2'='pvda', '3'='pvv', '4'='cda', '5'='sp', '6'='d66', '7'='gl', '8'='cu',
# '9'='sgp', '10'='dier', '11'='50plus', '12'='blanco', '13'='dontknow', '14'='novote','15'=not
# allowed','16'='no answer', '17'='other' t2: '1'='vvd', '2'='pvda', '3'='pvv', '4'='cda', '5'='sp',
# '6'='d66', '7'='gl', '8'='cu', '9'='sgp', '10'='dier', '11'='50plus', '12'='vnl','13'='blanco',
# '14'='dontknow', '15'='novote', '16'=not allowed','17'='no answer', '18'='other'))
evpanel$vote[evpanel$tijd == 1 & evpanel$vote == 17] <- 18
evpanel$vote[evpanel$tijd == 1 & evpanel$vote == 16] <- 17
evpanel$vote[evpanel$tijd == 1 & evpanel$vote == 15] <- 16
evpanel$vote[evpanel$tijd == 1 & evpanel$vote == 14] <- 15
evpanel$vote[evpanel$tijd == 1 & evpanel$vote == 13] <- 14
evpanel$vote[evpanel$tijd == 1 & evpanel$vote == 12] <- 13

# evpanel$vote <- ifelse(evpanel$vote==13,NA,evpanel$vote) evpanel$vote <-
# ifelse(evpanel$vote==15,NA,evpanel$vote) evpanel$vote <- ifelse(evpanel$vote==16,NA,evpanel$vote)
# evpanel$vote <- ifelse(evpanel$vote==17,NA,evpanel$vote)
table(evpanel$vote, useNA = "always")

# PVV vote 12=Blanco (0.6%), 13=Weet ik nog niet (11,4%), 14=Wel gerechtigd, ga niet (1,1%), 15=niet
# stemgerectigd (0.004%), 16=geen opgave (0.5%),17=andere partij
evpanel$PVV <- ifelse(evpanel$vote == 3, 1, 0)
table(evpanel$PVV, useNA = "always")

# Vote GL
evpanel$GL <- ifelse(evpanel$vote == 7, 1, 0)
table(evpanel$GL, useNA = "always")


# threat for threatDV as DV dont know with
evpanel$threat <- NA
evpanel$threat[evpanel$RB_1 == 1] <- 4
evpanel$threat[evpanel$RB_1 == 2] <- 3
evpanel$threat[evpanel$RB_1 == 3] <- 2
evpanel$threat[evpanel$RB_1 == 4] <- 1
evpanel$threat[evpanel$RB_1 == 5] <- 0
evpanel$threat[evpanel$RB_1 == 6] <- 2  #dont know cat.
table(evpanel$threat, useNA = "always")


evpanel$threat[evpanel$komst_minderheden == 1] <- 4
evpanel$threat[evpanel$komst_minderheden == 2] <- 3
evpanel$threat[evpanel$komst_minderheden == 3] <- 2
evpanel$threat[evpanel$komst_minderheden == 4] <- 1
evpanel$threat[evpanel$komst_minderheden == 5] <- 0
evpanel$threat[evpanel$komst_minderheden == 6] <- 2  #dont know cat.
table(evpanel$threat, useNA = "always")


# contact Contact (Hoe vaak heeft u in uw buurt persoonlijk contact met iemand van niet-westerse
# herkomst/oost europees) 1=bijna elke dag, 7=nooit, 8=nvt
evpanel$contactnw <- NA
evpanel$contactnw[evpanel$RB_3a == 1] <- 6
evpanel$contactnw[evpanel$RB_3a == 2] <- 5
evpanel$contactnw[evpanel$RB_3a == 3] <- 4
evpanel$contactnw[evpanel$RB_3a == 4] <- 3
evpanel$contactnw[evpanel$RB_3a == 5] <- 2
evpanel$contactnw[evpanel$RB_3a == 6] <- 1
evpanel$contactnw[evpanel$RB_3a == 7] <- 0  #NOOIT
evpanel$contactnw[evpanel$RB_3a == 8] <- 0  #NVT
table(evpanel$contactnw, useNA = "always")

table(evpanel$Niet_westers)
evpanel$contactnw[evpanel$Niet_westers == 1] <- 6
evpanel$contactnw[evpanel$Niet_westers == 2] <- 5
evpanel$contactnw[evpanel$Niet_westers == 3] <- 4
evpanel$contactnw[evpanel$Niet_westers == 4] <- 3
evpanel$contactnw[evpanel$Niet_westers == 5] <- 2
evpanel$contactnw[evpanel$Niet_westers == 6] <- 1
evpanel$contactnw[evpanel$Niet_westers == 7] <- 0
evpanel$contactnw[evpanel$Niet_westers == 8] <- 0
table(evpanel$contactnw, useNA = "always")


# azc vars

# perceptie azc in de buurt? Worden er in uw buurt vluchtelingen opgevangen of zijn daar plannen
# voor? 1.Ja, in mijn buurt staat een azc 2.Ja, in mijn buurt is er een tijdelijke opvang voor
# vluchtelingen 3.Nee, maar daar zijn wel plannen voor 4.Nee, in mijn buurt worden geen vluchtelingen
# opgevangen 5.Weet niet / geen mening table(evpanel$Opvang_buurt, useNA='always') evpanel$percpc4azc
# <- ifelse(evpanel$Opvang_buurt==1 | evpanel$Opvang_buurt==2, 1, 0) table(evpanel$percpc4azc,
# useNA='always') #dummy version evpanel$percpc4azc_dum <- as.factor(evpanel$Opvang_buurt)
# levels(evpanel$percpc4azc_dum ) <- c('ja, azc','ja, tijdelijk','wel plannen', 'nee', 'weet niet')

# Covariates

# Gender
table(evpanel$Geslacht_Opinie, useNA = "always")
evpanel$gender <- ifelse(evpanel$Geslacht_Opinie == 1, 1, 0)  # 1= male
table(evpanel$gender, useNA = "always")

# Age table(evpanel$Geboortedatum_Opinie)
evpanel$gebdat <- as.POSIXlt(evpanel$Geboortedatum_Opinie, origin = "1582/10/14")
evpanel$ages <- as.character(evpanel$gebdat)
evpanel$age <- substr(evpanel$ages, 1, 4)
evpanel$age <- as.numeric(evpanel$age)
evpanel$age <- 2015 - evpanel$age
table(evpanel$age, useNA = "always")
# Select on Age higher than 18
evpanel <- evpanel[evpanel$age >= 18, ]

# Education (years of education that constitute the shortest route to obtain a university degreeAfter
# this coding, all values are subtracted from the maximum years of schooling necessary to obtain a
# university grade)) (1) 5 lagere school not finished (4yrs) /lagere school (6yrs) (2) 7 lbo,
# vmbo-kb/bbl (6,5yrs) /mavo, vmbo-tl (8yrs) (3) 11 havo (10yrs) / vwo/gymnasium (12yrs) (4) 9,5
# mbo-kort (kmbo) (8,5yrs) /mbo-tussen/lang (mbo) (10,5yrs) (5) 14 hbo (14yrs) (6) 16,5 universiteit
# (bachelormaster, doctoraal)(16,5)

table(evpanel$Opleiding_Opinie, useNA = "always")
evpanel$educ <- NA
evpanel$educ[evpanel$Opleiding_Opinie == 1] <- 5
evpanel$educ[evpanel$Opleiding_Opinie == 2] <- 7
evpanel$educ[evpanel$Opleiding_Opinie == 3] <- 11
evpanel$educ[evpanel$Opleiding_Opinie == 4] <- 9.5
evpanel$educ[evpanel$Opleiding_Opinie == 5] <- 14
evpanel$educ[evpanel$Opleiding_Opinie == 6] <- 16.5
table(evpanel$educ, useNA = "always")

# Civil status 1=gehuwd/gereg partner, 2=gescheiden,3=weduwe,4=ongehuwd
table(evpanel$Burgerlijke_staat_Opinie, useNA = "always")
evpanel$civilstatus <- evpanel$Burgerlijke_staat_Opinie
table(evpanel$civilstatus, useNA = "always")

# Household comp 1=inw bij ouders,2=single no kids, 3=single kids, 4=student/community,5=married no
# kids, 6=married kids, 7=other
table(evpanel$Situatie_huishouden_Opinie, useNA = "always")
evpanel$household <- NA
evpanel$household[evpanel$Situatie_huishouden_Opinie == 2] <- 1
evpanel$household[evpanel$Situatie_huishouden_Opinie == 3] <- 2
evpanel$household[evpanel$Situatie_huishouden_Opinie == 5] <- 3
evpanel$household[evpanel$Situatie_huishouden_Opinie == 6] <- 4
evpanel$household[evpanel$Situatie_huishouden_Opinie == 1] <- 5
evpanel$household[evpanel$Situatie_huishouden_Opinie == 4] <- 5
evpanel$household[evpanel$Situatie_huishouden_Opinie == 7] <- 5
table(evpanel$household, useNA = "always")
# 1=single no kids, 2=single kids, 3=married no kids, 4=married kids, 5=other

# Daily activity 1=betaald werk,
# 2=zelfstandig,3=werkzoekend,4=arbeidsong,5=student,6=huisvrouw,7=pensoen,8=other
table(evpanel$Dagelijkse_activiteit_Opinie, useNA = "always")
evpanel$dailyact <- NA
evpanel$dailyact[evpanel$Dagelijkse_activiteit_Opinie == 1] <- 1
evpanel$dailyact[evpanel$Dagelijkse_activiteit_Opinie == 2] <- 1
evpanel$dailyact[evpanel$Dagelijkse_activiteit_Opinie == 3] <- 2
evpanel$dailyact[evpanel$Dagelijkse_activiteit_Opinie == 4] <- 3
evpanel$dailyact[evpanel$Dagelijkse_activiteit_Opinie == 5] <- 4
evpanel$dailyact[evpanel$Dagelijkse_activiteit_Opinie == 6] <- 5
evpanel$dailyact[evpanel$Dagelijkse_activiteit_Opinie == 7] <- 6
evpanel$dailyact[evpanel$Dagelijkse_activiteit_Opinie == 8] <- 7
# 1=betaald werk/zelfstandig,2=werkzoekend,3=arbeidsong,4=student,5=huisvrouw,6=pensoen,7=other
table(evpanel$dailyact, useNA = "always")


# only keep relevant vars
evpanel_sel <- evpanel[, c(1, 2, 18, 23, 56:113, 115:117, 120:124)]

names(evpanel)

# SELECTION ON PANEL resps
evpanel_sel <- evpanel_sel[evpanel_sel$PanelistIdQuestion %in% evpanel_sel$PanelistIdQuestion[duplicated(evpanel_sel$PanelistIdQuestion)], 
    ]


# ADD WEIGHTS TO Data

# make caseidn
evpanel_sel$caseidn <- 1:length(evpanel_sel[, 1])

# MAKE TARGET VALUES Geslacht
gender_w <- c(0.503, 0.497)  # vrouw - man
sum(gender_w)

# Age: 3cats
age_w <- c(0.238, 0.344, 0.418)  #18-35,35-55,55+
names(age_w) <- c("age1", "age2", "age3")
sum(age_w)

# Opl: 3cats
educ_w <- c(0.323, 0.393, 0.284)  #basis/vmbo/mbo1,mbo2-4/HV/VWO,HBO/WO 
names(educ_w) <- c("opl1", "opl2", "opl3")
sum(educ_w)

targets <- list(gender_w, age_w, educ_w)
names(targets) <- c("gender_w", "age_w", "educ_w")

# check variables in data
table(evpanel_sel$gender, useNA = "always")  #man=1
evpanel_sel$gender_w <- as.logical(evpanel_sel$gender)
table(evpanel_sel$gender_w, useNA = "always")

# age: 3cats
table(evpanel_sel$age, useNA = "always")  #18-35,35-55,55+
evpanel_sel$age_w <- NA
evpanel_sel$age_w[evpanel_sel$age <= 35] <- 1
evpanel_sel$age_w[evpanel_sel$age > 35 & evpanel_sel$age <= 55] <- 2
evpanel_sel$age_w[evpanel_sel$age > 55] <- 3
evpanel_sel$age_w <- as.factor(evpanel_sel$age_w)
levels(evpanel_sel$age_w) <- c("age1", "age2", "age3")
table(evpanel_sel$age_w, useNA = "always")

# Opl: 3cats
table(evpanel_sel$educ, useNA = "always")
evpanel_sel$educ_w <- NA
evpanel_sel$educ_w[evpanel_sel$educ <= 8] <- 1
evpanel_sel$educ_w[evpanel_sel$educ > 8 & evpanel_sel$educ <= 12] <- 2
evpanel_sel$educ_w[evpanel_sel$educ > 12] <- 3
evpanel_sel$educ_w <- as.factor(evpanel_sel$educ_w)
levels(evpanel_sel$educ_w) <- c("opl1", "opl2", "opl3")
table(evpanel_sel$educ_w, useNA = "always")

# make weights (for 3cats cap is 6cap)
weighted <- anesrake(inputter = targets, dataframe = evpanel_sel, choosemethod = "max", caseid = evpanel_sel$caseidn, 
    cap = 5)
test <- weightassess(targets, evpanel_sel, weighted$weightvec)

oplp <- test$educ_w[c(1:3), 1] * 39976
oplw <- test$educ_w[c(1:3), 4]
test2 <- matrix(c(oplp, oplw), byrow = T, nrow = 2)
dimnames(test2) <- list(weightype = c("p", "w"), opl = c("1", "2", "3"))
chisq.test(test2)

agep <- test$age_w[c(1:3), 1] * 39976
agew <- test$age_w[c(1:3), 4]
test2 <- matrix(c(agep, agew), byrow = T, nrow = 2)
dimnames(test2) <- list(weightype = c("p", "w"), age = c("1", "2", "3"))
chisq.test(test2)

geslp <- test$gender_w[c(1:2), 1] * 39976
geslw <- test$gender_w[c(1:2), 4]
test2 <- matrix(c(geslp, geslw), byrow = T, nrow = 2)
dimnames(test2) <- list(weightype = c("p", "w"), age = c("v", "m"))
chisq.test(test2)

evpanel_sel <- cbind(evpanel_sel, weighted$weightvec)
evpanel_sel <- rename(evpanel_sel, c(`weighted$weightvec` = "weightvec"))


# scale weights to cluster (https://www.statmodel.com/download/Scaling3.pdf)

# PC4
nresppc4 <- aggregate(evpanel_sel$weightvec, by = list(evpanel_sel$pc4), FUN = length)
weightpc4 <- aggregate(evpanel_sel$weightvec, by = list(evpanel_sel$pc4), FUN = sum)
evpanel_sel$weightvec_pc4 <- evpanel_sel$weightvec * ((nresppc4$x[match(evpanel_sel$pc4, nresppc4$Group.1)])/(weightpc4$x[match(evpanel_sel$pc4, 
    weightpc4$Group.1)]))

# PC4
nrespgc <- aggregate(evpanel_sel$weightvec, by = list(evpanel_sel$gc), FUN = length)
weightgc <- aggregate(evpanel_sel$weightvec, by = list(evpanel_sel$gc), FUN = sum)
evpanel_sel$weightvec_gc <- evpanel_sel$weightvec * ((nrespgc$x[match(evpanel_sel$gc, nrespgc$Group.1)])/(weightgc$x[match(evpanel_sel$gc, 
    weightgc$Group.1)]))


evpanel_sel <- evpanel_sel[, c(1:70, 75:77)]

# data wegscrhrijven write.table(evpanel_sel,
# file='C:/Users/U497130/AppData/Local/surfdrive_data/Artikel azc/data/evazc v15032017.csv') thuis
# write.table(evpanel_sel, file='C:/Users/Joran/SURFdrive/Artikel azc/data/evazc v22122017.csv')

# data to stata write.dta(evpanel_sel, 'C:/Users/u497130/AppData/Local/Surfdrive_data/Artikel
# azc/data/evazc v22122017.dta') thuis
write.dta(evpanel_sel, file = "U:/Surfdrive backup/Artikel azc/data/evazc v22122017II.dta")

Tolsma, Jochem, Joran Laméris, and Michael Savelkoul. n.d. “Exposure to Asylum Seekers and Changing Support for the Radical Right: A Natural Experiment in the Netherlands.” PLOS ONE - (-): –. https://journals.plos.org/plosone/.

LS0tDQp0aXRsZTogIkV4cG9zdXJlIHRvIEFzeWx1bSBTZWVrZXJzIg0KYXV0aG9yOiAnW0pvY2hlbSBUb2xzbWFdKGh0dHBzOi8vd3d3LmpvY2hlbXRvbHNtYS5ubCkgLSBSYWRib3VkIFVuaXZlcnNpdHksIHRoZSBOZXRoZXJsYW5kcycNCmJpYmxpb2dyYXBoeTogcmVmZXJlbmNlcy5iaWINCmRhdGU6ICJMYXN0IGNvbXBpbGVkIG9uIGByIGZvcm1hdChTeXMudGltZSgpLCAnJUIsICVZJylgIg0Kb3V0cHV0OiANCiAgaHRtbF9kb2N1bWVudDoNCiAgICB0b2M6ICB0cnVlDQogICAgdG9jX2Zsb2F0OiB0cnVlDQogICAgbnVtYmVyX3NlY3Rpb25zOiBmYWxzZQ0KICAgIGNvZGVfZm9sZGluZzogc2hvdw0KICAgIGNvZGVfZG93bmxvYWQ6IHllcw0KLS0tDQoNCmBgYHtyLCBnbG9iYWxzZXR0aW5ncywgZWNobz1GQUxTRSwgd2FybmluZz1GQUxTRX0NCmxpYnJhcnkoa25pdHIpDQpvcHRzX2NodW5rJHNldCh0aWR5Lm9wdHM9bGlzdCh3aWR0aC5jdXRvZmY9MTAwKSx0aWR5PVRSVUUsIHdhcm5pbmcgPSBGQUxTRSwgbWVzc2FnZSA9IEZBTFNFLGNvbW1lbnQgPSAiIz4iLCBjYWNoZT1UUlVFLA0KY2xhc3Muc291cmNlPWMoInRlc3QiKSwgY2xhc3Mub3V0cHV0PWMoInRlc3QyIikpDQpvcHRpb25zKHdpZHRoID0gMTA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