Bfonty
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Titel: Patriotism and Homebias in East Contries ``` library(stargazer) install.packages("stargazer") install.packages("haven") library(foreign) library(haven) library(ggplot2) database = read_sav("C:/Users/Beatrice Fontana/OneDrive/Desktop/UNI ZÜRICH/2° ANNO/Cultural Finance 2020/Research CLF 2020/main-data-2.4.sav") attach(database) View(dataset) ``` Now I create a new variable (Domestic-S&P500)/Summation in this case we will see from a scale from 0 to 1 the propensity to invest in the domestic stock market. 0 = not willing to invest in stocks; and 1 = indifferent between the two; [0-1] higher preference for Domestic stocks ``` homebias_ind = round((XFD8 - XFD9)/(XFD8 + XFD9), digits = 2) homebias_db_extra = cbind(country_code, XFD8, XFD9, homebias_ind) homebias_database = cbind(country_code, homebias_ind) View(homebias_db_extra) detach(database) ``` Creation of the dummy variables per country ``` taiwan = database[database[, "country_code"] == 3,] estonia = database[database[, "country_code"] == 1,] hongkong = database[database[, "country_code"] == 9,] germany = database[database[, "country_code"] == 8,] vietnam = database[database[, "country_code"] == 5,] china = database[database[, "country_code"] == 4,] japan = database[database[, "country_code"] == 10,] ``` Creation of variables of homebias divided per country code ``` tw_hb = data.frame(homebias_database[homebias_database[, "country_code"] == 3,1:2]) est_hb = data.frame(homebias_database[homebias_database[, "country_code"] == 1,1:2]) hg_hb = data.frame(homebias_database[homebias_database[, "country_code"] == 9,1:2]) ge_hb = data.frame(homebias_database[homebias_database[, "country_code"] == 8,1:2]) vit_hb = data.frame(homebias_database[homebias_database[, "country_code"] == 5,1:2]) ci_hb = data.frame(homebias_database[homebias_database[, "country_code"] == 4,1:2]) jp_hb = data.frame(homebias_database[homebias_database[, "country_code"] == 10,1:2]) ``` Many values are defined as Nan or Na, meaning that the respondent decided "not to invest in neither stock market".Shall we keeep them or ignore them? If we keep them, we should substitue the Nan/Na with a fictitious value. ``` ggplot(est_hb, aes(x = est_hb$homebias_ind))+ geom_histogram(fill = "blue", color="white") ``` ![](https://i.imgur.com/0HqSBh5.png) First Regression analysis (without "lit"). ``` m1 = lm(homebias_ind ~ female + age + XP1 + uni_degree +wstock+ patient + Taiwan_D +Germany_D + Estonia_D +Vietnam_D +China_D +Japan_D, data = database) stargazer(m1, type = "text") ``` ![](https://i.imgur.com/jCVrwX4.png) ``` m2 = lm(homebias_ind ~ female + age + XP1 + uni_degree +wstock+ patient + risk +USD_ppp_income + Taiwan_D +Germany_D + Estonia_D +Vietnam_D +China_D +Japan_D, data = database) ``` ![](https://i.imgur.com/AySIIH8.png) # New Codes and Regressions 13/09/2020: Setting up libraryies: ```{r message=FALSE, warning=FALSE} library(stargazer) library(foreign) library(haven) library(ggplot2) library(AER) library(rmarkdown) ``` Open the database: ```{r message=FALSE, warning=FALSE} database = read_sav("C:/Users/Beatrice Fontana/OneDrive/Desktop/UNI ZURICH/2 ANNO/Cultural Finance 2020/Research CLF 2020/data-patrick1.sav") attach(database) ``` Creation of transformed variables in the database, namely homebias at individual level, inversion of the patriotism variable, and financial literacy. ```{r} patriotism = database$XP1 patriotism_inv <- 5-patriotism homebias_ind = round((XFD8 - XFD9)/(XFD8 + XFD9), digits = 2) flr = cbind(database$XF1, database$XF2, database$XF3) finlit_score = c() for(i in 1:nrow(flr)){ finlit_score= c(finlit_score, (flr[i,1]==1)+(flr[i,2]==3)+(flr[i,3]==2)) } ``` **Regression Analysis for each easian Country** We try to regress patriottism and other relevant varibles for the model on homebias at individual level but for every single country. The HongKong database is too small to provide significant results, only 23 observations. The new databases are: ```{r} taiwan = database[database[, "country_code"] == 3,] estonia = database[database[, "country_code"] == 1,] germany = database[database[, "country_code"] == 8,] vietnam = database[database[, "country_code"] == 5,] china = database[database[, "country_code"] == 4,] japan = database[database[, "country_code"] == 10,] detach(database) ``` The new dependent variable per country is as follows (the NA values have been replaced with 0) ```{r} homebias_database = cbind(database$country_code, homebias_ind) colnames(homebias_database)[1] = "country_code" homebias_database[is.na(homebias_database)] = 0 homebias_database[is.nan(homebias_database)] = 0 tw_hb = as.matrix(data.frame(homebias_database[homebias_database[, "country_code"] == 3,2])) est_hb = as.matrix(data.frame(homebias_database[homebias_database[, "country_code"] == 1,2])) ge_hb = as.matrix(data.frame(homebias_database[homebias_database[, "country_code"] == 8,2])) vit_hb = as.matrix(data.frame(homebias_database[homebias_database[, "country_code"] == 5,2])) ci_hb = as.matrix(data.frame(homebias_database[homebias_database[, "country_code"] == 4,2])) jp_hb = as.matrix(data.frame(homebias_database[homebias_database[, "country_code"] == 10,2])) ``` The new variables finlit per country: ```{r} countries_finlit = cbind(finlit_score, database$country_code) colnames(countries_finlit)[2] = "country_code" countries_finlit[is.na(countries_finlit)] = 0 countries_finlit[is.nan(countries_finlit)] = 0 ci_fl = as.matrix(data.frame(countries_finlit[countries_finlit[, "country_code"] == 4,1])) vit_fl = as.matrix(data.frame(countries_finlit[countries_finlit[, "country_code"] == 5,1])) tw_fl =as.matrix(data.frame(countries_finlit[countries_finlit[, "country_code"] == 3,1])) jp_fl = as.matrix(data.frame(countries_finlit[countries_finlit[, "country_code"] == 10,1])) ge_fl = as.matrix(data.frame(countries_finlit[countries_finlit[, "country_code"] == 8,1])) est_fl =as.matrix(data.frame(countries_finlit[countries_finlit[, "country_code"] == 1,1])) ``` The new vriable patriotism_inv per country: ```{r} ptm = cbind(patriotism_inv,database$country_code) colnames(ptm)[2] = "country_code" ptm[is.na(ptm)] = 0 ptm[is.nan(ptm)] = 0 ci_ptm = as.matrix(data.frame(ptm[ptm[, "country_code"] == 4,1])) vit_ptm = as.matrix(data.frame(ptm[ptm[, "country_code"] == 5,1])) tw_ptm = as.matrix(data.frame(ptm[ptm[, "country_code"] == 3,1])) jp_ptm = as.matrix(data.frame(ptm[ptm[, "country_code"] == 10,1])) ge_ptm = as.matrix(data.frame(ptm[ptm[, "country_code"] == 8,1])) est_ptm = as.matrix(data.frame(ptm[ptm[, "country_code"] == 1,1])) ``` Other variables cleaning Marxism and income : ```{r} marx = cbind(database$Marxism, database$country_code) colnames(marx)[2] = "country_code" marx[is.na(marx)] = 0 marx[is.nan(marx)] = 0 ci_marx = as.matrix(data.frame(marx[marx[, "country_code"] == 4,1])) vit_marx = as.matrix(data.frame(marx[marx[, "country_code"] == 5,1])) tw_marx = as.matrix(data.frame(marx[marx[, "country_code"] == 3,1])) jp_marx = as.matrix(data.frame(marx[marx[, "country_code"] == 10,1])) ge_marx = as.matrix(data.frame(marx[marx[, "country_code"] == 8,1])) est_marx = as.matrix(data.frame(marx[marx[, "country_code"] == 1,1])) income = cbind(database$income_eu_capita, database$country_code) colnames(income)[2] = "country_code" income[is.na(income)] = 0 income[is.nan(income)] = 0 ci_income = as.matrix(data.frame(income[income[, "country_code"] == 4,1])) vit_income = as.matrix(data.frame(income[income[, "country_code"] == 5,1])) tw_income = as.matrix(data.frame(income[income[, "country_code"] == 3,1])) jp_income = as.matrix(data.frame(income[income[, "country_code"] == 10,1])) ge_income = as.matrix(data.frame(income[income[, "country_code"] == 8,1])) est_income = as.matrix(data.frame(income[income[, "country_code"] == 1,1])) ``` **Rapresentation of homebias** Looking at the graph we can deduct that the majoriity of respondents are indifferent between investing either in the domestic stock-market or in the internationa S&P 500. However, this value is influenced by the great number of non-respondedns that increases the density distribution in the plot. ```{r} china_hb_graph = data.frame(homebias_database[homebias_database[, "country_code"] == 4,1:2]) g = ggplot(china_hb_graph, aes(x=china_hb_graph$homebias_ind)) + geom_histogram(aes(y=..density..), fill = "white", color="black") h = g + ggtitle("Home Bias Distribution in China") + xlab("Home Bias") + ylab("Respondents") h + geom_density(alpha=.5, fill="#FF6666") ``` ![](https://i.imgur.com/vgUWNKB.png) #Regression on China The regression on china has provided significant results, patriotism positively affects homebias by 0.036 points and it is significant at 5% level. The positive relation is what expected, namely the more patriotic the respondent is, more is expected to have a greater home bias with respect to stock market. However, financial literacyhas a negative effect on the home bias suggesting that respondent who know more about finance tend to invest more in the international stock market. ```{r message=FALSE, warning=FALSE} attach(china) m1c = lm(ci_hb ~ ci_ptm + female + age + ci_fl + ci_marx , data = china) stargazer(m1c, type = "text", title = "Patriotism and Home Bias in China", dep.var.labels = "Home Bias", covariate.labels=c("Patriotism", "Gender", "Age", "Financial Literacy", "Marxism"), omit.stat=c("LL","ser","f"), no.space=TRUE) detach(china) ``` ![](https://i.imgur.com/XH7vzAL.png) #Regression Vietnam Contrary to expectations in this model the patriotism variable has a negative impact on home bias for Vietnamese respondends. On the other hand, the financial literacy variable is strongly significant at 1% level suggesting further a strong positive impact on homebias. This results suggest that vietnamese respondendts believe in the domestic market. ```{r} attach(vietnam) m1v = lm(vit_hb ~ vit_ptm + female +age +vit_fl +vit_marx , data = vietnam) stargazer(m1v, type = "text") stargazer(m1c, m1v, type = "text", title = "Patriotism and Home Bias in East Asia", dep.var.labels = c("OLS China", "OLS Vietnam"), omit.stat=c("LL","ser","f"),covariate.labels=c("Chinese Patriotism", "Vietnamese Patriotism", "Gender", "Age", "Financial Literacy CN", "Marxism in China", "Financial Literacy VT", "Marxism in Vietnam"), no.space=TRUE, align = TRUE) detach(vietnam) ``` ![](https://i.imgur.com/oJZnqBz.png) ```{r} vietnam_hb_graph = data.frame(homebias_database[homebias_database[, "country_code"] == 5,1:2]) v = ggplot(vietnam_hb_graph, aes(x=vietnam_hb_graph$homebias_ind)) + geom_histogram(aes(y=..density..), fill = "white", color="black") j = v + ggtitle("Home Bias Distribution in Vietnam") + xlab("Home Bias") + ylab("Respondents") j + geom_density(alpha=.5, fill="#FF6666") ``` ![](https://i.imgur.com/esXGfBf.png) #Regression Taiwan Patriotism and homebias in Taiwan have a positive relation, but it is not signficant. ```{r message=FALSE, warning=FALSE} attach(taiwan) m1t = lm(tw_hb ~tw_ptm + female +age +tw_fl +tw_marx , data = taiwan) stargazer(m1t, type = "text") stargazer(m1c, m1v,m1t, type = "text", title = "Patriotism and Home Bias in East Asia", dep.var.labels = c("OLS China", "OLS Vietnam", "OLS Taiwan"), omit.stat=c("LL","ser","f"),covariate.labels=c("Chinese Patriotism", "Vietnamese Patriotism","Taiwanese Patriotism", "Gender", "Age", "Financial Literacy CN", "Marxism in China", "Financial Literacy VT", "Marxism in Vietnam","Financial Literacy TW", "Marxism in TW"), no.space=TRUE, align = TRUE) detach(taiwan) ``` #Regression Japan ```{r message=FALSE, warning=FALSE} attach(japan) m1j = lm(jp_hb ~jp_ptm + female +age +jp_fl , data = japan) stargazer(m1j, type = "text") detach(japan) ``` #Regression Models together East Asia ```{r warning=FALSE} stargazer(m1c, m1v,m1t,m1j, type = "text", title = "Patriotism and Home Bias in East Asia", dep.var.labels = c("OLS China", "OLS Vietnam", "OLS Taiwan", "OLS Japan"), omit.stat=c("LL","ser","f"),covariate.labels=c("Chinese Patriotism", "Vietnamese Patriotism","Taiwanese Patriotism","Japanese Patriotism", "Gender", "Age", "Financial Literacy CN", "Marxism in China", "Financial Literacy VT", "Marxism in Vietnam","Financial Literacy TW", "Marxism in TW", "Financial Literacy JP"), no.space=TRUE, align = TRUE) ``` ![](https://i.imgur.com/xf4xGMM.png) #Regression model in East Asia (Japan+Taiwan+China+Vietnam) ```{r message=FALSE, warning=FALSE} attach(database) m1Asia = lm(homebias_ind ~ patriotism_inv + female + age + finlit_score + patient+ uni_degree+ Taiwan_D +Japan_D+Vietnam_D+ China_D, data = database) m3Asia = lm(homebias_ind ~ patriotism_inv + female + age + finlit_score + Marxism + wstock +Taiwan_D +Japan_D+Vietnam_D+ China_D, data = database) stargazer(m1Asia,m3Asia, type = "text") ``` #Regression model Europe and Asia The regression models per area reveals a particular significant positive relationship in the Europe area (Germany and Estonia) rather than in Asia between patriotism and homebias. This result is unexpected since in East Asia, socialism (Marxism) still influences the life of its citizens.However, the regression model run on chinese respondents has given strong significance levels on the relation betweeen patriotism and home bias, suggesting that Chinese respondents have stronger patriotic feelings and trust towards their own domestic stock market with respect to the other neighboor countries.The high significance level of patriotism for the Europe area suggests that overall Germany and Estonia tend to invest much more in the domestic stock market. In both macro Areas, we observe that female respondents are more home biased than other genders (males and transgender), and this variable is significant at 5% level representing a notable effect on home bias. This seems to bring a common cultural factor among the macro areas. German respondents believe much more in their stock market, with a significance level of 1%. This resuilt is counterbalanced with the negative relationship between Estonian respondents and home bias, germans respondents are more home biased with respect to estonians. ```{r} m1EU = lm(homebias_ind ~patriotism_inv + female + age + finlit_score + patient+ uni_degree+wstock+ Germany_D +Estonia_D, data = database) stargazer(m1Asia,m3Asia,m1EU, type = "text", title = "Comprehensive Regression models per Area", dep.var.labels = c("M1 Asia M2 Asia M1 Europe"),covariate.labels=c("Patriotism", "Gender", "Age", "Financial Literacy Score", "Patience", "University Degree", "Marxism", "Willingness to Invest in Stocks", "Taiwan","Japan","Vietnam","China","Germany","Estonia"), omit.stat=c("LL","ser","f"),no.space = TRUE, align = TRUE ) ``` ![](https://i.imgur.com/tlH5pgN.png) #Graphs Europe:Germany and Estonia ```{r} germany_hb_graph = data.frame(homebias_database[homebias_database[, "country_code"] == 8,1:2]) d = ggplot(germany_hb_graph, aes(x=germany_hb_graph$homebias_ind)) + geom_histogram(aes(y=..density..), fill = "white", color="black") e = d + ggtitle("Home Bias Distribution in Germany") + xlab("Home Bias") + ylab("Respondents") e + geom_density(alpha=.5, fill="#FF6666") ``` ![](https://i.imgur.com/HHoWh4Z.png)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully