MathGroup Archive 2011

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

Search the Archive

Re: Ignore missing data

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119012] Re: Ignore missing data
  • From: Tomas Garza <tgarza10 at msn.com>
  • Date: Thu, 19 May 2011 07:45:09 -0400 (EDT)

Is this what you want?
In[1]:= his=Cases[{1,2,3,4,5,6,7,,9},x_/;NumberQ[x]];simcs1=RandomReal[10,Length[his]];simcs2=RandomReal[10,Length[his]];
simcsi=a1*simcs1+a2*simcs2;
er=Plus@@(his-simcsi)^2;Minimize[{er,0<=a1<=1&&0<=a2<=1&&a1+a2==1},{a1,a2}]
Out[1]= {0., {a1 -> 0.337758, a2 -> 0.662242}}
-Tomas
> Date: Wed, 18 May 2011 07:15:23 -0400
> From: dimemples at gmail.com
> Subject: [mg118966] Ignore missing data
> To: mathgroup at smc.vnet.net
>
> Hello everybody!
>
> I would like to know how to ignore missing data and to be more specific I'll give an example.
>
> his = {1,2,3,4,5,6,7,,9};
> simcs1 = RandomReal[10, 9];
> simcs2 = RandomReal[10, 9];
>
> simcsi = a1*simcs1 + a2*simcs2;
> (his - simcsi)^2;
> er = Plus @@ %
> Minimize[{er, 0 <= a1 <= 1 && 0 <= a2 <= 1  && a1 + a2== 1}, {a1, a2}]
>
>
> It doesn't work, since the 8th value of "his" is missing. Do you know how i could make Mathematica ignore also the corresponding values of simcs1 and simcs2? Namely, in my example how to ignore the 8th value of simcs1 and simcs2.
>
> Please note that i don't want to delete the missing data, neither to make them equal to 0.
>
> Thank you in advance!
>
>


  • Prev by Date: Re: unable to import csv-Data
  • Next by Date: Re: Count Ouccrence of words in a long text
  • Previous by thread: Re: Ignore missing data
  • Next by thread: Re: Ignore missing data