Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Trouble with a system of equations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg77666] Re: [mg77596] Re: Trouble with a system of equations
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Thu, 14 Jun 2007 06:15:53 -0400 (EDT)
  • References: <f4lb44$fvv$1@smc.vnet.net> <200706131142.HAA07187@smc.vnet.net>

On 13 Jun 2007, at 20:42, Yaroslav Bulatov wrote:

> On Jun 11, 10:31 pm, Ray Koopman <koop... at sfu.ca> wrote:
>> On Mon, 11 Jun 2007 07:38:00 -0500 drmajor... at bigfoot.com wrote:
>>
>>> There's an unmatched bracket in
>>
>>>>    m = Inverse[ Subsets[Times@@#]& /@ Tuples[{0,1},k]] ].
>>
>>> and I haven't found a way (so far) to correct it so that the code  
>>> works.
>>
>>> Bobby
>>
>> Ah, the joys and perils of posting code without testing it first.
>> Maybe someday I'll get Mathematica for my machine at home.
>>
>> Aside from the extra ], that must must have been teleported from
>> LinearSolve[x,Log[p/(1-p)], where a ] is missing, the problem is
>> that I simply copied the form of an example in the Subsets online
>> documentation, with h changed to Times, not realizing that Times@@#
>> would be evaluated before Subsets got to it.
>>
>> Here are two ways to get x:
>>
>>    ReleaseHold@Subsets[Hold@Times@@#]& /@ Tuples[{0,1},k]
>>
>> or (preferably, I think)
>>
>>    Times@@@Subsets@#& /@ Tuples[{0,1},k].
>>
>> With[{k = 2}, Inverse[ Times@@@Subsets@#& /@ Tuples[{0,1},k] ]]
>>
>> {{ 1, 0, 0, 0},
>>  {-1, 0, 1, 0},
>>  {-1, 1, 0, 0},
>>  { 1,-1,-1, 1}}
>>
>> With[{k = 3}, Inverse[ Times@@@Subsets@#& /@ Tuples[{0,1},k] ]]
>>
>> {{ 1, 0, 0, 0, 0, 0, 0, 0},
>>  {-1, 0, 0, 0, 1, 0, 0, 0},
>>  {-1, 0, 1, 0, 0, 0, 0, 0},
>>  {-1, 1, 0, 0, 0, 0, 0, 0},
>>  { 1, 0,-1, 0,-1, 0, 1, 0},
>>  { 1,-1, 0, 0,-1, 1, 0, 0},
>>  { 1,-1,-1, 1, 0, 0, 0, 0},
>>  {-1, 1, 1,-1, 1,-1,-1, 1}}
>
> OK that works, thanks. One problem with the original system is that I
> set up the estimation equations in terms of E[x_i y] (assuming uniform
> distribution over x's), and not empirical odds ratios which apparently
> make it much harder to solve (Andrzei's solution works fine for 2
> variables, but takes too long for 3)
>
>


I think a variant of my method also works for three variables. I will  
soon sent you a notebook, after adding to it sme comments.

Andrzej Kozlowski


  • Prev by Date: newlines, newlines ...
  • Next by Date: Re: Overly complicated reductions?
  • Previous by thread: Re: Trouble with a system of equations
  • Next by thread: Re: Trouble with a system of equations