Question:

A medical research team wanted to evaluate a screening method proposed for 
Alzheimer's disease. The method was evaluated on 450 patients randomly selected 
patients with Alzheimers (in 436 cases, the screening was positive). Moreover,
the method was also done on 500 patients without the disease and returned 
positive for 5 out of the 500. 7.7% of all Canadians over the age of 65 have
Alzhiemers. Find the probability that a Canadian over the age of 65 has Alzhiemers
given the test was positive.




It seems that the test returns a 96.8% chance of success given that the patient has alzhiemers and a .01% chance of success given the patient DOESN'T have alzhiemers. 

So I used bayes theorem for this one, so that I would find

  A = Alzhiemers
  Positive = Positive test result given the patient actually had alzhiemers 
  Positive2 = Positive test result given the patient doesn't have alzhiemers


$$P(A | Positive) = \frac{P(Positive|A)(A)}{P(Positive|A)(A) + P(Positive2|A)(A)}$$

$$= \frac{(.968)(.077)}{(.968)(.077) + (.01)(.077)}$$

$$= approx. .98$$

Did i do this correctly? As in was i supposed to even use bayes theorem for this problem?



ahh seems like i multiplied the probability of positive test result given the person doesn't have alzhiemers with the probability of all canadians who do have alzheimers. Thanks guys.


Question: Trouble Binding Selected Items from ListBox
Answer: Weird, the following works perfectly fine for me.

Model:

public class SystemRoleList
{
    public IEnumerable&lt;SystemRole&gt; List { get; set; }
}

public class SystemRole
{
    public int Id { get; set; }
    public string Name { get; set; }
}


Controller:

[HandleError]
public class HomeController : Controller
{
    public ActionResult Index()
    {
        var model = new SystemRoleList
        {
            List = new[]
            {
                new SystemRole { Id = 1, Name = "role 1" },
                new SystemRole { Id = 2, Name = "role 2" },
                new SystemRole { Id = 3, Name = "role 3" },
            }
        };
        return View(model);
    }

    [HttpPost]
    public ActionResult Index(int[] roles)
    {
        return Content("thanks for submitting");
    }
}


View:

&lt;%@ Page 
    Language="C#" 
    MasterPageFile="~/Views/Shared/Site.Master" 
    Inherits="System.Web.Mvc.ViewPage&lt;MvcApplication1.Controllers.SystemRoleList&gt;" 
%&gt;

&lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"&gt;

    &lt;% using (Html.BeginForm()) { %&gt;
        &lt;%= Html.ListBox("Roles", new SelectList(Model.List, "Id", "Name")) %&gt;
        &lt;button type="submit"&gt;OK&lt;/button&gt;
    &lt;% } %&gt;

&lt;/asp:Content&gt;


This being said I would use the strongly typed version of the ListBox helper, like this:

Model:

public class SystemRoleList
{
    public int[] Roles { get; set; }
    public IEnumerable&lt;SystemRole&gt; List { get; set; }
}


Controller:

[HandleError]
public class HomeController : Controller
{
    public ActionResult Index()
    {
        var model = new SystemRoleList
        {
            List = new[]
            {
                new SystemRole { Id = 1, Name = "role 1" },
                new SystemRole { Id = 2, Name = "role 2" },
                new SystemRole { Id = 3, Name = "role 3" },
            }
        };
        return View(model);
    }

    [HttpPost]
    public ActionResult Index(SystemRoleList model)
    {
        return Content("thanks for submitting");
    }
}


View:

&lt;%@ Page 
    Language="C#" 
    MasterPageFile="~/Views/Shared/Site.Master" 
    Inherits="System.Web.Mvc.ViewPage&lt;MvcApplication1.Controllers.SystemRoleList&gt;" 
%&gt;

&lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"&gt;

    &lt;% using (Html.BeginForm()) { %&gt;
        &lt;%= Html.ListBoxFor(x =&gt; x., new SelectList(Model.List, "Id", "Name")) %&gt;
        &lt;button type="submit"&gt;OK&lt;/button&gt;
    &lt;% } %&gt;

&lt;/asp:Content&gt;