Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: Binary Logistic Regression
Posted:
Apr 8, 2013 9:47 AM


The glmfit function wants to operate on columns. Make sure x1,x2,x3,y are all column vectors, and then xfull will be a threecolumn matrix.
The second argument to chi2cdf in this example is a 3 because there are three columns of the X matrix.
 Tom
"jacksparrow " <shobhitjain2166@gmail.com> wrote in message news:kjuc4u$n1b$1@newscl01ah.mathworks.com... > Hey Phoebe! > I am getting the same problem. Did you get the correct solution now? > Please share. > > > "Phoebe " <phoebe_62@hotmail.co.uk> wrote in message > <k1ij0v$5gt$1@newscl01ah.mathworks.com>... >> Trying to perform binary logistic regression with one y and 3 x's. Code >> is as follows so far; >> clear >> x1=[....]; >> x2=[....]; >> x3=[....]; >> xfull=[x1 x2 x3]; >> y=[0 1 0 ...etc]; >> [bfull,devfull]=glmfit(xfull,y,'binomial','link','logit'); >> n1=sum(y); >> n=size(y,1); >> n0=nn1; >> G=2*(n1*log(n1)+n0*log(n0)n*log(n)  dev); >> pval=1  chi2cdf(G,3) >> bfull >> devfull >> n1 >> n >> n0 >> G >> pval >> >> I have a few queries; >> 1. Matlab says my y must be a 2 column matrix or a vector which it is >> inputted as so i dont know why it doesnt recognise this? >> 2. Within the pval equation it refers to (G,3) although in some cases >> this number is a 1 not a 3?


Date

Subject

Author

4/8/13


Guest

4/8/13


Tom Lane


