# Define the data for Strategy 1
strategy1_selection <- data.frame(
  Asset = c("T", "PFE", "XAU", "GOOGL", "USDINR"),
  Median_Return = c(0.009617963, 0.002619454, 0.001102195, -0.002813010, -0.003632318),
  Standard_Deviation = c(0.04303437, 0.01576457, 0.03418468, 0.04782845, 0.04273717)
)

# Calculate reward-to-risk ratios for Strategy 1
strategy1_selection$Reward_to_Risk <- strategy1_selection$Median_Return / strategy1_selection$Standard_Deviation

# Define the data for Strategy 2
strategy2_selection <- data.frame(
  Asset = c("EURUSD", "NG", "PFE", "GOOGL", "T"),
  Median_Return = c(-0.006003852, -0.005380718, 0.002619454, -0.002813010, 0.009617963),
  Standard_Deviation = c(0.03204665, 0.04763956, 0.01576457, 0.04782845, 0.04303437),
  Reward_to_Risk = c(-0.18734726, -0.11294642, 0.16616080, -0.05881458, 0.22349493)
)

# Calculate reward-to-risk ratios for Strategy 2
strategy2_selection$Reward_to_Risk <- strategy2_selection$Median_Return / strategy2_selection$Standard_Deviation

# Total reward-to-risk ratio for each strategy
total_ratio_strategy1 <- sum(strategy1_selection$Reward_to_Risk)
total_ratio_strategy2 <- sum(strategy2_selection$Reward_to_Risk)

# Calculate weights for each strategy
weights_strategy1 <- (strategy1_selection$Reward_to_Risk / total_ratio_strategy1) * 100
weights_strategy2 <- (strategy2_selection$Reward_to_Risk / total_ratio_strategy2) * 100

# Print weights for Strategy 1
cat("Weights for Strategy 1:\n")
for (i in 1:nrow(strategy1_selection)) {
  cat(strategy1_selection$Asset[i], ":", round(weights_strategy1[i], 2), "%\n")
}
cat("\n")

# Print weights for Strategy 2
cat("Weights for Strategy 2:\n")
for (i in 1:nrow(strategy2_selection)) {
  cat(strategy2_selection$Asset[i], ":", round(weights_strategy2[i], 2), "%\n")
}

# Global Minimum Variance Portfolio - without short selling
# For GMVP, the weights are calculated based on minimizing portfolio variance
# The weights are inversely proportional to the asset's risk (standard deviation)
gmvp_weights <- 1 / strategy1_selection$Standard_Deviation
gmvp_weights <- gmvp_weights / sum(gmvp_weights) * 100

cat("\nGlobal Minimum Variance Portfolio Weights (without short selling):\n")
for (i in 1:nrow(strategy1_selection)) {
  cat(strategy1_selection$Asset[i], ":", round(gmvp_weights[i], 2), "%\n")
}

# GMVP without short selling for Strategy 2
gmvp_weights_strategy2 <- 1 / strategy2_selection$Standard_Deviation
gmvp_weights_strategy2 <- gmvp_weights_strategy2 / sum(gmvp_weights_strategy2) * 100

cat("\nGlobal Minimum Variance Portfolio Weights (without short selling) for Strategy 2:\n")
for (i in 1:nrow(strategy2_selection)) {
  cat(strategy2_selection$Asset[i], ":", round(gmvp_weights_strategy2[i], 2), "%\n")
}

# Tangency Portfolio - with short selling
# For the Tangency Portfolio, weights are calculated based on maximizing the Sharpe ratio
# This involves short selling to achieve the optimal risk-return trade-off

# Tangency Portfolio for Strategy 1
strategy1_tangency_weights <- strategy1_selection$Reward_to_Risk
strategy1_tangency_weights <- strategy1_tangency_weights / sum(strategy1_tangency_weights) * 100

cat("\nTangency Portfolio Weights (with short selling) for Strategy 1:\n")
for (i in 1:nrow(strategy1_selection)) {
  cat(strategy1_selection$Asset[i], ":", round(strategy1_tangency_weights[i], 2), "%\n")
}

# Tangency Portfolio for Strategy 2
strategy2_tangency_weights <- strategy2_selection$Reward_to_Risk
strategy2_tangency_weights <- strategy2_tangency_weights / sum(strategy2_tangency_weights) * 100

cat("\nTangency Portfolio Weights (with short selling) for Strategy 2:\n")
for (i in 1:nrow(strategy2_selection)) {
  cat(strategy2_selection$Asset[i], ":", round(strategy2_tangency_weights[i], 2), "%\n")
}

# Portfolio Return and Risk Measures
# Portfolio Return is the weighted sum of individual asset returns
portfolio_return_strategy1 <- sum(weights_strategy1 * strategy1_selection$Median_Return)
portfolio_return_strategy2 <- sum(weights_strategy2 * strategy2_selection$Median_Return)

# Portfolio Risk is calculated using the weighted standard deviation of assets
portfolio_risk_strategy1 <- sqrt(sum((weights_strategy1/100)^2 * strategy1_selection$Standard_Deviation^2))
portfolio_risk_strategy2 <- sqrt(sum((weights_strategy2/100)^2 * strategy2_selection$Standard_Deviation^2))

cat("\nPortfolio Return and Risk Measures:\n")
cat("Strategy 1 Portfolio Return: ", round(portfolio_return_strategy1, 6), "\n")
cat("Strategy 1 Portfolio Risk: ", round(portfolio_risk_strategy1, 6), "\n")
cat("Strategy 2 Portfolio Return: ", round(portfolio_return_strategy2, 6), "\n")
cat("Strategy 2 Portfolio Risk: ", round(portfolio_risk_strategy2, 6), "\n")

# Portfolio Return and Risk Measures for GMVP
gmvp_portfolio_return <- sum(gmvp_weights * strategy1_selection$Median_Return)
gmvp_portfolio_risk <- sqrt(sum((gmvp_weights/100)^2 * strategy1_selection$Standard_Deviation^2))

cat("GMVP Portfolio Return: ", round(gmvp_portfolio_return, 6), "\n")
cat("GMVP Portfolio Risk: ", round(gmvp_portfolio_risk, 6), "\n")

gmvp_portfolio_return_strategy2 <- sum(gmvp_weights_strategy2 * strategy2_selection$Median_Return)
gmvp_portfolio_risk_strategy2 <- sqrt(sum((gmvp_weights_strategy2/100)^2 * strategy2_selection$Standard_Deviation^2))

cat("Strategy 2 Portfolio Return: ", round(gmvp_portfolio_return_strategy2, 6), "\n")
cat("Strategy 2 Portfolio Risk: ", round(gmvp_portfolio_risk_strategy2, 6), "\n")

# Portfolio Return and Risk Measures for Tangency Portfolio
tangency_portfolio_return_strategy1 <- sum(strategy1_tangency_weights * strategy1_selection$Median_Return)
tangency_portfolio_risk_strategy1 <- sqrt(sum((strategy1_tangency_weights/100)^2 * strategy1_selection$Standard_Deviation^2))

cat("Tangency Portfolio Return (Strategy 1): ", round(tangency_portfolio_return_strategy1, 6), "\n")
cat("Tangency Portfolio Risk (Strategy 1): ", round(tangency_portfolio_risk_strategy1, 6), "\n")

tangency_portfolio_return_strategy2 <- sum(strategy2_tangency_weights * strategy2_selection$Median_Return)
tangency_portfolio_risk_strategy2 <- sqrt(sum((strategy2_tangency_weights/100)^2 * strategy2_selection$Standard_Deviation^2))

cat("Tangency Portfolio Return (Strategy 2): ", round(tangency_portfolio_return_strategy2, 6), "\n")
cat("Tangency Portfolio Risk (Strategy 2): ", round(tangency_portfolio_risk_strategy2, 6), "\n")
The above is the final code i used ....now can you please give me code for For the constituted portfolio's compare and contrast the estimates of Value at Risk in "Euro" using parametric method, historical method and Monte Carlo simulation method.

Insert the code chunk below.