%---------------------------------------MFILE KYPHOSIS-------------------------------------------
clear all
close all
 disp('Logistic Regression: Kyphosis')
 lw = 2; 
 set(0, 'DefaultAxesFontSize', 16);
 fs = 15;
 msize = 10;
 %-------------------------------------------------------------------------
load 'C:\BESTAT\Logistic\Logisticdat\kyphosis.dat'
% kyph, age, start, number
age = kyphosis(:,1);            start=kyphosis(:,2);
number = kyphosis(:,3);     kyph = kyphosis(:,4);
X = [age start number];
[b, dev, stats] = glmfit(X, kyph, 'binomial', 'link','logit')
lin = [ones(size(kyph))    X]* b;
plot(lin, kyph,'ro')
hold on
xx = -6:0.1:4
plot(xx, exp(xx)./(1+exp(xx)), 'r-')

% 25  3  4
xind =[1 25 3 4]
score = xind * b
pro= exp(score)/(1 + exp(score))