HELP!!! Trying to apply glm to my imported data. Can anyone help? Don't be put off by the code it is a generated script.
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
[~, ~, raw, dates] = xlsread('REMOVED\mortgagedata.xls','DATA','A2:X400','',@convertSpreadsheetExcelDates); raw(cellfun(@(x) ~isempty(x) && isnumeric(x) && isnan(x),raw)) = {''}; cellVectors = raw(:,[2,3,5,7,14,16,17,18,19,20,21]); raw = raw(:,[1,4,6,8,9,12,13,15,22,23,24]); dates = dates(:,[10,11]);
R = cellfun(@(x) ~isnumeric(x) && ~islogical(x),raw); % Find non-numeric cells raw® = {NaN}; % Replace non-numeric cells R = cellfun(@(x) ~isnumeric(x) && ~islogical(x),dates); % Find non-numeric cells dates® = {NaN}; % Replace non-numeric Excel dates with NaN
data = reshape([raw{:}],size(raw));
x1 = data(:,1); x2 = cellVectors(:,1); x3 = cellVectors(:,2); x4 = data(:,2); x5 = cellVectors(:,3); x5= data(:,3); x6 = cellVectors(:,4); x7 = data(:,4); x8 = data(:,5); x9 = datetime([dates{:,1}].', 'ConvertFrom', 'Excel', 'Format', 'dd/MM/yyyy'); x10 = datetime([dates{:,2}].', 'ConvertFrom', 'Excel', 'Format', 'dd/MM/yyyy'); x11 = data(:,6); x12 = data(:,7); x13 = cellVectors(:,5); x14 = data(:,8); x15 = cellVectors(:,6); x16 = cellVectors(:,7); x17 = cellVectors(:,8); x18 = cellVectors(:,9); x19 = cellVectors(:,10); x20 = cellVectors(:,11); x21 = data(:,9); y1 = data(:,10); y2 = data(:,11);
clearvars data raw dates cellVectors R;
%%everything above this point is a generated script from imported data
modelspec= '(y1,y2)~x1*x2*x3 - x1:x2:x3';
mdl=fitglm(mortgagedata,modelspec,'Distribution','binomial')
(NOTE: the word 'REMOVED' was put in to replace confidential information.)
I am trying to find a model using glm to find out how the predictor variables x1 to x21 determine whether the predictor response has a 1 or a 0 in either y1 or y2. If there is a 1 in y1 then the y2 is a 0. I have turned this into a binary vector.
I would really appreciate any support and will provide best answer to anyone who can help me get this working.
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Large Files and Big Data finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!