Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to estimate parameters which minimize cost function?

    I need to categories a variable into three categories and I have associated cost for each wrong decision.
    Suppose I have a continuous variable X (which need to be categorized as 1, 2 and 3) and categorical variable Y (with true disease categories 1, 2 and 3) and for each wrong decision there is a cost. I want to estimate a and b which minimize overall cost.
    To be specific
    recode X min/a=1 a/b=2 b/max=3
    gen cost=0 if X-Y=0
    replace cost=1 if X-Y=1
    replace cost=2 if X-Y=-1
    replace cost=20 if abs(X-Y)=2

    egen total_cost=sum(cost)

    I want to estimate values of a and b which can minimize the total cost.
    Please help me.

  • #2
    Welcome to Statalist.

    You have accidentally posted your topic in Statalist's Mata Forum, which is used for discussions of Stata's Mata language, which is different than Stata's command language, and different than Stata's matrix commands. Your question will see a more appropriate and much larger audience if you post it in Statalist's General Forum.

    Also, if you have not already done so, take a look at the Statalist FAQ linked to at the top of this page for posting guidelines and suggestions.

    Comment


    • #3
      Thank you for clarifying

      Comment

      Working...
      X