From: Lee Sander on 28 Jul 2010 11:27 Hi Peter, These represent 2 sides of an unbiased coin. if I get heads then i put a 0; 1 for tails then I flip for 20 times, and I count the number of each call so the expected number is .5*num_coin_flips, .5*num_coin_filps for each (and each has a binomial distribution) Can you please show me an example of using this as a 2x2 and also as a binofit thanks On Jul 28, 11:23 am, Peter Perkins <Peter.Perk...(a)MathRemoveThisWorks.com> wrote: > On 7/28/2010 8:47 AM, Lee Sander wrote: > > > I would like to get a p-value for the null that each of these come > > from a population with 0.5 frequency. > > Lee, I'm not sure what your populations or your ones/zeros represent. > You might use CHI2GOF and treat this as a 2x2 table. Or you could use > the confidence interval from BINOFIT. Or you could use CHI2GOF on the > vectors separately. > > Hope this helps.
From: Peter Perkins on 28 Jul 2010 11:38 On 7/28/2010 10:38 AM, Lee Sander wrote: > Actually I did do the chi square test but I got a NaN p-vals Lee, leave out the 'nparams' parameter. It is described as 'nparams' The number of estimated parameters; used to adjust the degrees of freedom to be NBINS-1-NPARAMS, where NBINS is the number of bins. but you have not estimated anything, you're _assuming_ p=0.5 for your null. >> [h,p,st]=chi2gof(bins,'ctrs',bins,'frequency',obsCounts,'expected',expectedCounts') h = 1 p = 0.0027 st = chi2stat: 9 df: 1 edges: [-0.5000 0.5000 1.5000] O: [5 20] E: [12.5000 12.5000]
From: Peter Perkins on 28 Jul 2010 11:42 On 7/28/2010 11:27 AM, Lee Sander wrote: > Can you please show me an example of using this as a 2x2 and also as a > binofit >> [pHat,pCI] = binofit(obsCounts(1),sum(obsCounts),.005) pHat = 0.2000 pCI = 0.0390 0.4934 So the CI says that H0:p=0.5 is rejected at the .5% level (which more or less agrees with the .0027 p-value shown in my other post).
From: dpb on 28 Jul 2010 12:45 dpb wrote: > Lee Sander wrote: >> Actually I did do the chi square test but I got a NaN p-vals >> >> In below assume I have 5 of '0's and 20 or '1', in this case the null >> should be rejected >> >>>> bins=[0 1]; obsCounts=[5 20]; >>>> expectedCounts=repmat(sum(obsCounts)/length(obsCounts),1,length(obsCounts)); >>>> >>>> [h,p,st]=chi2gof(bins,'ctrs',bins,'frequency',obsCounts,'expected',expectedCounts','nparams',1) >>>> >> h = >> 0 >> p = >> NaN >> st = >> chi2stat: 9 >> df: 0 >> edges: [-0.5000 0.5000 1.5000] >> O: [5 20] >> E: [12.5000 12.5000] >> >> >> can you tell me what I am doing wrong? > ... > > You have _0_ DOF... > > I'd approach it from computing confidence interval on the estimate of > x/n and see if upper bound of X% confidence crossed the 0.5 boundary or > not as one way. > > Don't recall if there's another specific test for binomial > acceptance/rejection or not otomh...it's been too long since I've been > actively engaged, sorry... I don't have the Stat Toolbox so don't have doc's so have to assume that the 'nparams' named argument is the number of estimated parameters which reduces DOF by that number hence leading to the zero DOF conundrum. --
From: dpb on 28 Jul 2010 12:47 dpb wrote: .... > I don't have the Stat Toolbox so don't have doc's so have to assume that > the 'nparams' named argument is the number of estimated parameters which > reduces DOF by that number hence leading to the zero DOF conundrum. Oh, _NOW_ I see Peter P had already addressed it; sorry for duplicating info... --
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Passing arguments to COM object Next: statistic : ANOVA 2 factors paired |