## Importing excel file

cd "C:/Users/Siam Kibria/OneDrive - Norwegian University of Life Sciences/Desktop/NMBU/Semester/Spring 2023/Thesis"

import excel "C:\Users\Siam Kibria\OneDrive - Norwegian University of Life Sciences\Desktop\NMBU\Semester\Spring 2023\Siam's Thesis 2023 (Land Valuation)\Stated_prefernce_europe.xlsx", sheet("Sheet1") firstrow case(lower)

## Converting variables from string to numeric

destring average_hh_inc_m average_indv_inc_y share_of_female_respondents average_age higher_educ average_household_size share_of_households_w_children type_of_farming slope scenario_large_change improvement avoid_degradation current_status_landscape protected_area payment_frequency tax_pv donation_pv other_pv sampling_technique, replace

## Inputing Dummy variables

label define study_type 1 "published in a referred journal" 2 "phd thesis" 3 "master thesis" 4 "report series from research institute/university" 5 "conference paper" 6 "consultancy report" 7 "other"

label values study_type study_type

label define payment_hh 1 "WTP per household" 0 "WTP per invidivual"

label values payment_per_household payment_hh

label define scenic_view 1 "valued" 0 "not valued"

label values scenic_view scenic_view

label define flora_fauna 1 "valued" 0 "not valued"

label values flora_and_fauna flora_fauna

label define farm_inf_service 1 "valued" 0 "not valued"

label values farm_infrastructure_services farm_inf_service

label define soil_fertility 1 "valued" 0 "not valued"

label values soil_fertility soil_fertility

label define speciality_prod 1 "valued" 0 "not valued"

label values speciality_products speciality_prod

label define cultural_cons 1 "valued" 0 "not valued"

label values cultural_heritage_conservation cultural_cons

label define cultural_imp 1 "valued" 0 "not valued"

label values cultural_heritage_improvement cultural_imp

label define provisioning 1 "valued" 0 "not valued"

label values provisioning_es provisioning

label define regulating 1 "valued" 0 "not valued"

label values regulating_es regulating

label define cultural 1 "valued" 0 "not valued"

label values cultural_es cultural

label define supporting 1 "valued" 0 "not valued"

label values supporting_es supporting

label define recreation 1 "valued" 0 "not valued"

label values recreation recreation

label define aesthetics 1 "valued" 0 "not valued"

label values aesthetics aesthetics

label define biodiversity 1 "valued" 0 "not valued"

label values biodiversity biodiversity

label define farming_type 0 "natural land" 1 "abandoned land" 2 "dry farmland" 3 "irrigated land"

label values type_of_farming farming_type

label define slope 0 "steep" 1 "intermediate" 2 "gentle"

label values slope slope

label define scenario_large 0 "small change" 1 "large change"

label values scenario_large_change scenario_large

label define scenario_improv 0 "No" 1 "Yes"

label values improvement scenario_improv

label define scenario_avoid_loss 0 "No" 1 "Yes"

label values avoid_degradation scenario_avoid_loss

label define feature_specific 1 "yes" 0 "no"

label values feature_specific feature_specific

label define multifunctionality 1 "yes" 0 "no"

label values multifunctionality multifunctionality

label define mountain 1 "yes" 0 "no"

label values feature_mountain mountain

label define lowland 1 "yes" 0 "no"

label values feature_lowland lowland

label define grassland_permcrop 1 "yes" 0 "no"

label values feature_grassland_or_permanent_c grassland_permcrop

label define current_status 0 "maintained" 1 "vulnerable" 2 "ruined"

label values current_status_landscape current_status

label define protected_area 1 "yes" 0 "no"

label values protected_area protected_area

label define payment_frequency 0 "one-time payment" 1 "monthly" 2 "yearly" 3 "others"

label values payment_frequency payment_frequency

label define tax 1 "yes" 0 "no"

label values tax_pv tax

label define donation 1 "yes" 0 "no"

label values donation_pv donation

label define other_pv 1 "yes" 0 "no"

label values other_pv other_pv

label define choice_exp 1 "yes" 0 "no"

label values ce choice_exp

label define cvm_dich 1 "yes" 0 "no"

label values cvm_dichotomous cvm_dich

label define cvm_payment_card 1 "yes" 0 "no"

label values cvm_payment_card cvm_payment_card

label define cvm_open_ended 1 "yes" 0 "no"

label values cvm_open_ended cvm_open_ended

label define sampling 1 "random sampling" 0 "otherwise"

label values sampling_technique sampling

label define mnl 1 "yes" 0 "no"

label values mnl mnl

label define lca 1 "yes" 0 "no"

label values lca lca

label define mixedlogit 1 "yes" 0 "no"

label values mixed_logit mixedlogit

label define f2f_interview 1 "yes" 0 "no"

label values f2f_interview f2f_interview

label define online_survey 1 "yes" 0 "no"

label values online_survey online_survey

label define mailed_survey 1 "yes" 0 "no"

label values mailed_survey mailed_survey

label define general_sample 1 "yes" 0 "no"

label values general_sample general_sample

label define visitor_sample 1 "yes" 0 "no"

label values visitor_sample visitor_sample

label define farmers_others_sample 1 "yes" 0 "no"

label values farmers_others_sample farmers_others_sample

label define local_sample 1 "yes" 0 "no"

label values local_sample local_sample

label define other_sample 1 "yes" 0 "no"

label values other_sample other_sample

## Labeling Variables

label variable id "ID"

label variable observation "Observation"

label variable study_id "Study ID"

label variable author "Author"

label variable publication_year "Publication Year"

label variable study_type "Study Type"

label variable country "Country"

label variable data_collection_year "Data Collection Year"

label variable estimation_model "Estimation Model"

label variable wtp_in_study "WTP in study"

label variable wtp_in_usd_ppp "WTP in USD(PPP)"

label variable wtp_usd_2023 "WTP"

label variable payment_per_household "Payment Per Household"

label variable average_hh_inc_m "Average Household Income Monthly"

label variable average_indv_inc_y "Average Individual Income Yearly"

label variable higher_educ "Higher Educ."

label variable scenic_view "Scenic View"

label variable flora_and_fauna "Flora & Fauna"

label variable farm_infrastructure_services "Farm Infrastructure & Services"

label variable soil_fertility "Soil Fertility"

label variable speciality_products "Specialty Products"

label variable cultural_heritage_conservation "Cultural Heritage Conservation"

label variable cultural_heritage_improvement "Cultural Heritage Improvement"

label variable provisioning_es "Provisioning ES"

label variable regulating_es "Regulating ES"

label variable cultural_es "Cultural ES"

label variable supporting_es "Supporting ES"

label variable recreation "Recreation"

label variable biodiversity "Biodiversity"

label variable scenario_large_change "Scenario Large Change"

label variable improvement "Scn. Improvement"
 
label variable avoid_degradation "Scn. Avoid Degradation" 

label variable feature_specific "Feature Specific"

label variable feature_mountain "Feature Mountain "

label variable feature_lowland "Feature Lowland "

label variable feature_grassland_or_permanent_c "Feature Grassland/Permanent Crop"

label variable current_status_landscape "Current Status Landscape"

label variable protected_area "Protected Area "

label variable area "Area"

label variable population_density "Population Density"

label variable uaa "Utilized Agricultural Area"

label variable gdp_per_capita "GDP Per Capita ($)"

label variable cpi "CPI"

label variable payment_frequency "Payment Frequency "

label variable tax_pv "Tax PV"

label variable donation_pv "Donation PV"

label variable other_pv "Other PV"

label variable ce "Choice Experiment"

label variable cvm_dichotomous "CVM Dichotomous"

label variable cvm_payment_card "CVM Payment Card"

label variable cvm_open_ended "CVM Open Ended"

label variable sampling_technique "Sampling Technique"

label variable f2f_interview "F2F Interview"

label variable online_survey "Online Survey"

label variable mailed_survey "Mailed Survey"

label variable general_sample "General Sample"

label variable visitor_sample "Visitor Sample"

label variable farmers_others_sample "Farmers & others Sample"

label variable local_sample "Local Sample"

label variable other_sample "Other Sample"

## summarizing dataset

sum wtp_in_study wtp_in_usd_ppp wtp_in_usd_ppp_round wtp_usd_adj_inflation wtp_usd_2023

sum payment_per_household payment_frequency tax_pv donation_pv other_pv ce cvm_dichotomous cvm_payment_card cvm_open_ended sampling_technique f2f_interview online_survey mailed_survey general_sample visitor_sample farmers_others_sample local_sample other_sample

sum higher_educ average_age share_of_female_respondents share_of_households_w_children average_household_size average_hh_inc_m average_indv_inc_y

sum gdp_per_capita cpi area population_density uaa

sum scenic_view flora_and_fauna farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement provisioning_es regulating_es cultural_es supporting_es recreation aesthetics biodiversity scenario_large_change improvement avoid_degradation feature_specific multifunctionality feature_mountain feature_lowland feature_grassland_or_permanent_c protected_area current_status_landscape type_of_farming slope

sum mnl lca mixed_logit

sum no_of_observations no_of_respondents

## Frequency Table

tab payment_per_household

tab type_of_farming

tab slope

tab scenario_large_change

tab current_status_landscape

tab payment_frequency

## Check multicollinearity
	# Correlation threshhold 0.35 or less
	
pwcorr cultural_es supporting_es biodiversity

pwcorr gdp_per_capita average_hh_inc_m average_indv_inc_y

pwcorr scenario_large_change improvement avoid_degradation

## VIF
	# Always run VIF after performing a regression
	# VIF equal to 1 = variables are not correlated
	# VIF between 1 and 5 = variables are moderately correlated 
	# VIF greater than 5 = variables are highly correlated
	# VIF of three or below is not a cause for concern

## Regression tests with ce

	#Without scenario_large_change
	
reg wtp_usd_2023 flora_and_fauna scenic_view farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement gdp_per_capita ce current_status_landscape

est sto model1

reg wtp_usd_2023 flora_and_fauna scenic_view farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement ce uaa

est sto model2

reg wtp_usd_2023 provisioning_es regulating_es cultural_es gdp_per_capita ce current_status_landscape

est sto model3

reg wtp_usd_2023 provisioning_es regulating_es cultural_es uaa ce

est sto model4

	#With scenario_large_change, taking small change as reference
	
reg wtp_usd_2023 flora_and_fauna scenic_view farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement gdp_per_capita ce current_status_landscape scenario_large_change avoid_degradation

est sto model5
	
reg wtp_usd_2023 flora_and_fauna scenic_view farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement ce uaa scenario_large_change avoid_degradation

est sto model6
	
reg wtp_usd_2023 provisioning_es regulating_es cultural_es gdp_per_capita ce current_status_landscape scenario_large_change avoid_degradation

est sto model7

reg wtp_usd_2023 provisioning_es regulating_es cultural_es uaa ce scenario_large_change avoid_degradation

est sto model8

## Generating regression model

esttab model1 model2 model3 model4 model5 model6 model7 model8 using models.rtf, replace label mtitle("Model 1" "Model 2" "Model 3" "Model 4" "Model 5" "Model 6" "Model 7" "Model 8") star(+ 0.15 * 0.10 ** 0.05 *** 0.01) se stats(r2_a aic bic N)


## Regression tests with ce & recreation (Will not use scenic_view aesthetics cultural due to correlation)

	#Without scenario_large_change
	
reg wtp_usd_2023 flora_and_fauna farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement recreation gdp_per_capita ce current_status_landscape

est sto model9 

reg wtp_usd_2023 flora_and_fauna farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement recreation ce uaa

est sto model10

reg wtp_usd_2023 provisioning_es regulating_es recreation gdp_per_capita ce current_status_landscape

est sto model11

reg wtp_usd_2023 provisioning_es regulating_es recreation uaa ce

est sto model12

	#With scenario_large_change, taking small change as reference
	
reg wtp_usd_2023 flora_and_fauna farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement recreation gdp_per_capita ce current_status_landscape scenario_large_change avoid_degradation

est sto model13
	
reg wtp_usd_2023 flora_and_fauna farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement recreation ce uaa scenario_large_change avoid_degradation

est sto model14
	
reg wtp_usd_2023 provisioning_es regulating_es recreation gdp_per_capita ce current_status_landscape scenario_large_change avoid_degradation

est sto model15

reg wtp_usd_2023 provisioning_es regulating_es recreation uaa ce scenario_large_change avoid_degradation

est sto model16


## Generating regression model

esttab model9 model10 model11 model12 model13 model14 model15 model16 using models.rtf, replace label mtitle("Model 9" "Model 10" "Model 11" "Model 12" "Model 13" "Model 14" "Model 15" "Model 16") star(+ 0.15 * 0.10 ** 0.05 *** 0.01) se stats(r2_a aic bic N)


=============================================================================

#Extra

## Making Scenario Large Change into seperate dummies

tabulate scenario_large_change, generate(scenario_dummy)

tab scenario_dummy1

tab scenario_dummy2

tab scenario_dummy3

## Relabeling the variables

label variable scenario_dummy1 "Scenario Small Change"

label variable scenario_dummy2 "Scenario Moderate Change"

label variable scenario_dummy3 "Scenario Large Change"


### Other method for making seperate dummies 
	# adding i.(variable name) in a regression. It takes out the first one and makes it reference level.

reg wtp_usd_2023 i.scenario_large_change provisioning_es regulating_es cultural_es gdp_per_capita


	
## Regression Models

reg wtp_usd_2023 flora_and_fauna scenic_view farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement gdp_per_capita ce current_status_landscape

est sto model1

reg wtp_usd_2023 flora_and_fauna scenic_view farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement ce uaa

est sto model2

reg wtp_usd_2023 provisioning_es regulating_es cultural_es gdp_per_capita ce current_status_landscape

est sto model3

reg wtp_usd_2023 provisioning_es regulating_es cultural_es uaa ce

est sto model4


## Results

esttab model1 model2 model3 model4 using models.rtf, replace label mtitle("Model 1" "Model 2" "Model 3" "Model 4") star(+ 0.15 * 0.10 ** 0.05 *** 0.01) se stats(r2_a aic bic N)


## tablulate some variables

tab average_hh_inc_m

tab average_indv_inc_y

tab scenario_large_change

tab current_status_landscape

tab type_of_farming

tab slope

## Regressions with and without scenario_large_change

reg wtp_usd_2023 flora_and_fauna scenic_view farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement gdp_per_capita ce current_status_landscape 
reg wtp_usd_2023 flora_and_fauna scenic_view farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement gdp_per_capita ce current_status_landscape scenario_large_change

reg wtp_usd_2023 flora_and_fauna scenic_view farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement gdp_per_capita ce current_status_landscape
reg wtp_usd_2023 flora_and_fauna scenic_view farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement gdp_per_capita ce current_status_landscape scenario_large_change

reg wtp_usd_2023 flora_and_fauna scenic_view farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement ce uaa
reg wtp_usd_2023 flora_and_fauna scenic_view farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement ce uaa scenario_large_change

reg wtp_usd_2023 provisioning_es regulating_es cultural_es gdp_per_capita ce current_status_landscape
reg wtp_usd_2023 provisioning_es regulating_es cultural_es gdp_per_capita ce current_status_landscape scenario_large_change

reg wtp_usd_2023 provisioning_es regulating_es cultural_es uaa ce
reg wtp_usd_2023 provisioning_es regulating_es cultural_es uaa ce scenario_large_change

	## Checked with VIF, No Issue with Multicollinearity

## Demo regression

reg wtp_usd_2023 higher_educ scenic_view flora_and_fauna speciality_products provisioning_es regulating_es cultural_es scenario_large_change gdp_per_capita

reg wtp_usd_2023 scenic_view flora_and_fauna soil_fertility farm_infrastructure_services cultural_heritage_conservation cultural_heritage_improvement recreation aesthetics gdp_per_capita uaa payment_frequency

reg wtp_usd_2023 provisioning_es regulating_es cultural_es supporting_es average_age average_indv_inc_y

reg wtp_usd_2023 flora_and_fauna scenic_view farm_infrastructure_services soil_fertility speciality_products cultural_heritage_conservation cultural_heritage_improvement gdp_per_capita ce uaa

reg wtp_usd_2023 flora_and_fauna scenic_view farm_infrastructure_services soil_fertility speciality_products ce uaa


