What VIF value limit (like 4,5,6,7,....) should I select for Linear Regression model which has 30 discrete variables and 4 continuous variables? - linear-regression

What should be the VIF value limit (like 4,5,6,7,....) for Linear Regression model which has 30 discrete, 4 continuous input variables and 1 continuous variable?
It's confusing to see that different researcher recommend different VIF values to use.
I have tried it in SPSS and by creating dummy variables for discrete variables. Here is the result
Coefficients
Model Unstandardized Coefficients Standardized Coefficients t Sig. Collinearity Statistics
B Std. Error Beta Tolerance VIF
(Constant) .076 1.262 .060 .952
absences .014 .012 .020 1.170 .243 .776 1.289
G1 .129 .039 .109 3.326 .001 .214 4.665
G2 .857 .036 .773 23.541 .000 .215 4.645
age .027 .050 .010 .548 .584 .649 1.540
school_new -.170 .135 -.025 -1.265 .206 .588 1.702
sex_new .150 .121 .023 1.239 .216 .680 1.471
address_new -.119 .127 -.017 -.937 .349 .712 1.405
famsize_new .038 .118 .005 .320 .749 .830 1.205
pstatus_new .004 .169 .000 .025 .980 .786 1.272
schoolsup_new .197 .178 .019 1.105 .269 .811 1.234
famsup_new -.070 .110 -.011 -.632 .528 .836 1.197
paid_new .147 .222 .011 .659 .510 .865 1.156
activities_new -.009 .108 -.001 -.087 .931 .830 1.204
nursery_new .070 .132 .009 .531 .596 .879 1.137
higher_new -.124 .189 -.012 -.655 .513 .712 1.404
internet_new -.115 .134 -.015 -.858 .391 .755 1.324
romantic_new .022 .112 .003 .200 .842 .832 1.202
M_prim_edu -.046 .556 -.006 -.083 .934 .046 21.942
M_5th_TO_9th -.114 .560 -.016 -.203 .839 .038 26.474
M_secon_edu -.143 .566 -.018 -.253 .801 .045 22.328
M_higher_edu -.309 .583 -.042 -.529 .597 .036 27.719
F_prim_edu -.454 .518 -.062 -.875 .382 .046 21.795
F_5th_TO_9th -.318 .522 -.046 -.608 .543 .041 24.624
F_secon_edu -.300 .532 -.037 -.563 .574 .053 18.873
F_higher_edu -.269 .547 -.033 -.492 .623 .051 19.613
M_health_job -.195 .253 -.025 -.770 .441 .229 4.373
M_other_job .050 .256 .004 .197 .844 .541 1.849
M_services_job -.273 .225 -.041 -1.211 .226 .199 5.016
M_teacher_job -.013 .226 -.002 -.055 .956 .286 3.496
F_health_job .470 .335 .036 1.400 .162 .355 2.814
F_other_job .003 .362 .000 .008 .993 .539 1.854
F_services_job .151 .269 .023 .563 .574 .136 7.336
F_teacher_job .015 .275 .002 .054 .957 .159 6.293
reason_school_repu .239 .194 .031 1.235 .217 .364 2.746
reason_course_pref .176 .202 .023 .873 .383 .347 2.886
reason_other .364 .175 .056 2.074 .039 .320 3.129
guard_mother -.030 .129 -.004 -.234 .815 .699 1.431
guard_other .311 .259 .023 1.204 .229 .612 1.635
tra_time_15_TO_30min .043 .120 .006 .356 .722 .764 1.309
tra_time_30_TO_60min .274 .206 .023 1.327 .185 .745 1.342
tra_time_GT_60min .791 .351 .038 2.254 .025 .816 1.225
study_2_TO_5hrs_time .171 .129 .026 1.325 .186 .584 1.713
study_5_TO_10hrs_time .151 .177 .017 .853 .394 .605 1.654
study_GT_10hrs_time .073 .253 .005 .290 .772 .743 1.347
failure_1_time -.532 .189 -.051 -2.814 .005 .704 1.421
failure_2_time -.691 .362 -.033 -1.906 .057 .766 1.305
failure_3_time -.428 .375 -.019 -1.140 .255 .813 1.230
family_rela_bad -.002 .381 .000 -.004 .997 .391 2.558
family_rela_avg .012 .322 .001 .038 .970 .177 5.642
family_rela_good .011 .303 .002 .037 .971 .106 9.470
family_rela_excel -.101 .308 -.014 -.329 .743 .127 7.885
freetime_low .105 .236 .012 .447 .655 .315 3.172
freetime_avg -.038 .217 -.006 -.174 .862 .217 4.600
freetime_high -.026 .231 -.004 -.111 .911 .228 4.384
freetime_very_high -.153 .266 -.014 -.572 .567 .363 2.753
go_out_low .095 .223 .012 .424 .672 .280 3.576
go_out_avg .135 .218 .019 .619 .536 .236 4.244
go_out_high .186 .232 .024 .801 .423 .264 3.781
go_out_very_high -.132 .246 -.015 -.537 .591 .284 3.521
Dalc_low -.157 .156 -.019 -1.006 .315 .655 1.527
Dalc_avg .274 .250 .021 1.097 .273 .628 1.592
Dalc_high -.877 .352 -.043 -2.488 .013 .763 1.310
Dalc_very_high .102 .407 .005 .250 .802 .571 1.751
Walc_low .031 .144 .004 .213 .831 .656 1.526
Walc_avg -.148 .164 -.018 -.901 .368 .594 1.683
Walc_high .000 .205 .000 .002 .998 .495 2.020
Walc_very_high -.059 .309 -.005 -.190 .849 .393 2.542
health_low -.065 .205 -.006 -.314 .754 .542 1.845
health_avg -.125 .185 -.015 -.677 .499 .459 2.179
health_high -.088 .190 -.010 -.465 .642 .482 2.075
health_very_high -.234 .169 -.035 -1.381 .168 .357 2.801
a. Dependent Variable: G3

Related

Having trouble in using nlinfit function in MATLAB

Kindly please help me with the problem as I need to use nlinfit function for fitting unknown parameters but it is showing some error. Although yesterday I was getting some values for parameters to be fitted but now if I am running it is having some issue for the function output to be used in fitted with NaN answer for last iteration only. X data is a concatenated matrix of three columns as independent variable and yk is dependent variable, taua is a matrix of initial guesses of number of parameters to be fitted.
function [yk]=activity_coefficientE(taua,x)
T=523;
alpha12=0.3; alpha13=0.3; alpha21=0.3; alpha23=0.3; alpha31=0.3; alpha32=0.3;
alpha18=0.2; alpha81=0.2; alpha28=0.2; alpha82=0.2; alpha38=0.2; alpha83=0.3;
alpha19=0.2; alpha91=0.2; alpha29=0.2; alpha92=0.2; alpha39=0.2; alpha93=0.2;
alpha110=0.2;alpha101=0.2;alpha210=0.2;alpha102=0.2;alpha310=0.2;alpha103=0.2;
alpha113=0.2;alpha131=0.2;alpha213=0.2;alpha132=0.2;alpha313=0.2;alpha133=0.2;
alpha114=0.2;alpha141=0.2;alpha214=0.2;alpha142=0.2;alpha314=0.2;alpha143=0.2;
alpha115=0.2;alpha151=0.2;alpha215=0.2;alpha152=0.2;alpha315=0.2;alpha153=0.2;
alpha117=0.2;alpha171=0.2;alpha217=0.2;alpha172=0.2;alpha317=0.2;alpha173=0.2;
alpha118=0.2;alpha181=0.2;alpha218=0.2;alpha182=0.2;alpha318=0.2;alpha183=0.2;
alpha810=0.2;alpha915=0.2;alpha1314=0.2;alpha108=0.2;alpha159=0.2;alpha1413=0.2;
alpha1718=0.2;alpha1817=0.2;
tau12=0; tau13=0; tau21=0; tau23=0; tau31=0; tau32=0;
%taua=randi([-5,5],1,112)
tau18=taua(1)+taua(57)/T;
tau81=taua(2)+taua(58)/T;
tau28=taua(3)+taua(59)/T;
tau82=taua(4)+taua(60)/T;
tau38=taua(5)+taua(61)/T;
tau83=taua(6)+taua(62)/T;
tau19=taua(7)+taua(63)/T;
tau91=taua(8)+taua(64)/T;
tau29=taua(9)+taua(65)/T;
tau92=taua(10)+taua(66)/T;
tau39=taua(11)+taua(67)/T;
tau93=taua(12)+taua(68)/T;
tau110=taua(13)+taua(69)/T;
tau101=taua(14)+taua(70)/T;
tau210=taua(15)+taua(71)/T;
tau102=taua(16)+taua(72)/T;
tau310=taua(17)+taua(73)/T;
tau103=taua(18)+taua(74)/T;
tau113=taua(19)+taua(75)/T;
tau131=taua(20)+taua(76)/T;
tau213=taua(21)+taua(77)/T;
tau132=taua(22)+taua(78)/T;
tau313=taua(23)+taua(79)/T;
tau133=taua(24)+taua(80)/T;
tau114=taua(25)+taua(81)/T;
tau141=taua(26)+taua(82)/T;
tau214=taua(27)+taua(83)/T;
tau142=taua(28)+taua(84)/T;
tau314=taua(29)+taua(85)/T;
tau143=taua(30)+taua(86)/T;
tau115=taua(31)+taua(87)/T;
tau151=taua(32)+taua(88)/T;
tau215=taua(33)+taua(89)/T;
tau152=taua(34)+taua(90)/T;
tau315=taua(35)+taua(91)/T;
tau153=taua(36)+taua(92)/T;
tau117=taua(37)+taua(93)/T;
tau171=taua(38)+taua(94)/T;
tau217=taua(39)+taua(95)/T;
tau172=taua(40)+taua(96)/T;
tau317=taua(41)+taua(97)/T;
tau173=taua(42)+taua(98)/T;
tau118=taua(43)+taua(99)/T;
tau181=taua(44)+taua(100)/T;
tau218=taua(45)+taua(101)/T;
tau182=taua(46)+taua(102)/T;
tau318=taua(47)+taua(103)/T;
tau183=taua(48)+taua(104)/T;
tau810=taua(49)+taua(105)/T;
tau108=taua(50)+taua(106)/T;
tau915=taua(51)+taua(107)/T;
tau159=taua(52)+taua(108)/T;
tau1314=taua(53)+taua(109)/T;
tau1413=taua(54)+taua(110)/T;
tau1718=taua(55)+taua(111)/T;
tau1817=taua(56)+taua(112)/T;
G12=exp(-(tau12*alpha12));
G21=exp(-(tau21*alpha21));
G13=exp(-(tau13*alpha13));
G31=exp(-(tau31*alpha31));
G23=exp(-(tau23*alpha23));
G32=exp(-(tau32*alpha32));
G18=exp(-(tau18*alpha18));
G81=exp(-(tau81*alpha81));
G28=exp(-(tau28*alpha28));
G82=exp(-(tau82*alpha82));
G38=exp(-(tau38*alpha83));
G83=exp(-(tau83*alpha83));
G19=exp(-(tau19*alpha19));
G91=exp(-(tau91*alpha91));
G29=exp(-(tau29*alpha29));
G92=exp(-(tau92*alpha92));
G39=exp(-(tau39*alpha39));
G93=exp(-(tau93*alpha93));
G110=exp(-(tau110*alpha110));
G101=exp(-(tau101*alpha101));
G210=exp(-(tau210*alpha210));
G102=exp(-(tau102*alpha102));
G310=exp(-(tau310*alpha310));
G103=exp(-(tau103*alpha103));
G113=exp(-(tau113*alpha113));
G131=exp(-(tau131*alpha131));
G213=exp(-(tau213*alpha213));
G132=exp(-(tau132*alpha132));
G313=exp(-(tau313*alpha313));
G133=exp(-(tau133*alpha133));
G114=exp(-(tau114*alpha114));
G141=exp(-(tau141*alpha141));
G214=exp(-(tau214*alpha214));
G142=exp(-(tau142*alpha142));
G314=exp(-(tau314*alpha314));
G143=exp(-(tau143*alpha143));
G115=exp(-(tau115*alpha115));
G151=exp(-(tau151*alpha151));
G215=exp(-(tau215*alpha215));
G152=exp(-(tau152*alpha152));
G315=exp(-(tau315*alpha315));
G153=exp(-(tau153*alpha153));
G117=exp(-(tau117*alpha117));
G171=exp(-(tau171*alpha171));
G217=exp(-(tau217*alpha217));
G172=exp(-(tau172*alpha172));
G317=exp(-(tau317*alpha317));
G173=exp(-(tau173*alpha173));
G118=exp(-(tau118*alpha118));
G181=exp(-(tau181*alpha181));
G218=exp(-(tau218*alpha218));
G182=exp(-(tau182*alpha182));
G318=exp(-(tau318*alpha318));
G183=exp(-(tau183*alpha183));
G810=exp(-(tau810*alpha810));
G108=exp(-(tau108*alpha108));
G915=exp(-(tau915*alpha915));
G159=exp(-(tau159*alpha159));
G1314=exp(-(tau1314*alpha1314));
G1413=exp(-(tau1413*alpha1413));
G1718=exp(-(tau1718*alpha1718));
G1817=exp(-(tau1817*alpha1817));
%calculating mole fractions of ionic species
x1=x(:,1);
x2=x(:,2);
x3=x(:,3);
%x1=[0.1577 0.1492 0.1462 0.1366 0.1299 0.1180 0.0863 0.0761 0.0550 ];
%x2=[0.8278 0.7945 0.7678 0.7450 0.6979 0.6309 0.4611 0.4114 0.2952 ];
%x3=[0.0145 0.0563 0.0860 0.1184 0.1722 0.2511 0.4526 0.5125 0.6498 ];
A=[0.0674243 0.0773881 0.0843400 0.0865343 0.0899223 0.0882858 0.0715087 0.0643867 0.0483658];
B=[0.0141081 0.0479814 0.0643151 0.0737477 0.0820756 0.0838701 0.0701576 0.0634457 0.0479639];
C=[0.0565665 0.0450072 0.0387724 0.0313828 0.02506094 0.0186280 0.0092734 0.0073438 0.0041595 ];
D=[0.0336447 0.0267694 0.0230611 0.0186659 0.0149058 0.0110795 0.0055157 0.0043679 0.0024739 ];
E=[0.0008148 0.0008756 0.00087131 0.0008794 0.0008711 0.0008441 0.0007384 0.0006997 0.0005980 ];
N=length(A);
x1n=zeros(N,1);x2n=zeros(N,1);x3n=zeros(N,1);
X1=zeros(N,1);X2=zeros(N,1);X3=zeros(N,1);X4=zeros(N,1);X5=zeros(N,1);X6=zeros(N,1);X7=zeros(N,1);
X12=zeros(N,1);X16=zeros(N,1);
for i=1:N
x1n(i)=(x1(i)-A(i)-D(i)-2*E(i)-C(i)+3*B(i))
x2n(i)=(x2(i)-A(i)-C(i)-D(i))
x3n(i)=(x3(i)-B(i))
X1(i)=(x1n(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)))
X2(i)=(x2n(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)))
X3(i)=(x3n(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)))
X4(i)=(A(i)+D(i)+E(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)))
X5(i)=(C(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)))
X6(i)=(A(i)-B(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)))
X7(i)=(B(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)))
X12(i)=(E(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)))
X16(i)=(C(i)+D(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)))
end
yc4=X4./(X4+X5);
yc5=X5./(X4+X5);
yc6=X6./(X6+X7+X12+X16);
yc7=X7./(X6+X7+X12+X16);
yc12=X12./(X6+X7+X12+X16);
yc16=X16./(X6+X7+X12+X16);
alpha14=yc6.*alpha18+yc7.*alpha19+yc12.*alpha113+yc16.*alpha117;
%alpha41=alpha14;
alpha24=yc6.*alpha28+yc7.*alpha29+yc12.*alpha213+yc16.*alpha217;
%alpha42=alpha24;
alpha34=yc6.*alpha38+yc7.*alpha39+yc12.*alpha313+yc16.*alpha317;
%alpha43=alpha34;
alpha15=yc6.*alpha110+yc7.*alpha115+yc12.*alpha114+yc16.*alpha118;
%alpha51=alpha15;
alpha25=yc6.*alpha210+yc7.*alpha215+yc12.*alpha214+yc16.*alpha218;
%alpha52=alpha25;
alpha35=yc6.*alpha310+yc7.*alpha315+yc12.*alpha314+yc16.*alpha318;
%alpha53=alpha35;
alpha16=yc4.*alpha81+yc5.*alpha101;
%alpha61=alpha16;
alpha26=yc4.*alpha82+yc5.*alpha102;
%alpha62=alpha26;
alpha36=yc4.*alpha83+yc5.*alpha103;
%alpha63=alpha36;
alpha17=yc4.*alpha91+yc5.*alpha151;
%alpha71=alpha17;
alpha27=yc4.*alpha92+yc5.*alpha152;
%alpha72=alpha27;
alpha37=yc4.*alpha93+yc5.*alpha153;
%alpha73=alpha37;
alpha112=yc4.*alpha131+yc5.*alpha141;
%alpha121=alpha112;
alpha212=yc4.*alpha132+yc5.*alpha142;
%alpha122=alpha212;
alpha312=yc4.*alpha133+yc5.*alpha143;
%alpha123=alpha312;
alpha116=yc4.*alpha171+yc5.*alpha181;
%alpha161=alpha116;
alpha216=yc4.*alpha172+yc5.*alpha182;
%alpha162=alpha216;
alpha316=yc4.*alpha173+yc5.*alpha183;
%alpha163=alpha316;
alpha46=yc5.*alpha810;
%alpha64=alpha46;
alpha47=yc5.*alpha915;
%alpha74=alpha47;
alpha412=yc5.*alpha1314;
%alpha124=alpha412;
alpha416=yc5.*alpha1718;
%alpha164=alpha416;
alpha56=yc4.*alpha108;
%alpha65=alpha56;
alpha57=yc4.*alpha159;
%alpha75=alpha57;
alpha512=yc4.*alpha1413;
%alpha125=alpha512;
alpha516=yc4.*alpha1817;
%alpha165=alpha516;
G14=yc6.*G18+yc7.*G19+yc12.*G113+yc16.*G117;
%G41=G14;
G24=yc6.*G28+yc7.*G29+yc12.*G213+yc16.*G217;
%G42=G24;
G34=yc6.*G38+yc7.*G39+yc12.*G313+yc16.*G317;
%G43=G34;
G15=yc6.*G110+yc7.*G115+yc12.*G114+yc16.*G118;
%G51=G15;
G25=yc6.*G210+yc7.*G215+yc12.*G214+yc16.*G218;
%G52=G25;
G35=yc6.*G310+yc7.*G315+yc12.*G314+yc16.*G318;
%G53=G35;
G16=yc4.*G81+yc5.*G101;
%G61=G16;
G26=yc4.*G82+yc5.*G102;
%G62=G26;
G36=yc4.*G83+yc5.*G103;
%G63=G36;
G17=yc4.*G91+yc5.*G151;
%G71=G17;
G27=yc4.*G92+yc5.*G152;
%G72=G27;
G37=yc4.*G93+yc5.*G153;
%G73=G37;
G112=yc4.*G131+yc5.*G141;
%G121=G112;
G212=yc4.*G132+yc5.*G142;
%G122=G212;
G312=yc4.*G133+yc5.*G143;
%G123=G312;
G116=yc4.*G171+yc5.*G181;
%G161=G116;
G216=yc4.*G172+yc5.*G182;
%G162=G216;
G316=yc4.*G173+yc5.*G183;
%G163=G316;
G46=yc5.*G810;
%G64=G46;
G47=yc5.*G915;
%G74=G47;
G412=yc5.*G1314;
%G124=G412;
G416=yc5.*G1718;
%G164=G416;
G56=yc4.*G108;
%G65=G56;
G57=yc4.*G159;
%G75=G57;
G512=yc4.*G1413;
%G125=G512;
G516=yc4.*G1817;
%G165=G516;
tau14=-log(G14)./alpha14;
%tau41=tau14;
tau24=-log(G24)./alpha24;
%tau42=tau24;
tau34=-log(G34)./alpha34;
%tau43=tau34;
tau15=-log(G15)./alpha15;
%tau51=tau15;
tau25=-log(G25)./alpha25;
%tau52=tau25;
tau35=-log(G35)./alpha35;
%tau53=tau35;
tau16=-log(G16)./alpha16;
%tau61=tau16;
tau26=-log(G26)./alpha26;
%tau62=tau26;
tau36=-log(G36)./alpha36;
%tau63=tau36;
tau17=-log(G17)./alpha17;
%tau71=tau17;
tau27=-log(G27)./alpha27;
%tau72=tau27;
tau37=-log(G37)./alpha37;
%tau73=tau37;
tau112=-log(G112)./alpha112;
%tau121=tau112;
tau212=-log(G212)./alpha212;
%tau122=tau212;
tau312=-log(G312)./alpha312;
%tau123=tau312;
tau116=-log(G116)./alpha116;
%tau161=tau116;
tau216=-log(G216)./alpha216;
%tau162=tau216;
tau316=-log(G316)./alpha316;
%tau163=tau316;
tau46=-log(G46)./alpha46;
%tau64=tau46;
tau47=-log(G47)./alpha47;
%tau74=tau47;
tau412=-log(G412)./alpha412;
%tau124=tau412;
tau416=-log(G416)./alpha416;
%tau164=tau416;
tau56=-log(G56)./alpha56;
%tau65=tau56;
tau57=-log(G57)./alpha57;
%tau75=tau57;
tau512=-log(G512)./alpha512;
%tau125=tau512;
tau516=-log(G516)./alpha516;
%tau165=tau516;
ln_y1_1=G12.*X2.*tau12+ G31.*X3.*tau13+ G14.*X4.*tau14+G15.*X5.*tau15+G16.*X6.*tau16+G17.*X7.*tau17+G112.*X12.*tau112+G116.*X16.*tau116;
ln_y1_2=G12.*X2+ G13.*X3+ G14.*X4+G15.*X5+G16.*X6+G17.*X7+G112.*X12+G116.*X16;
ln_y2_1=G21.*X1.*tau12+ G32.*X3.*tau32+ G24.*X4.*tau24+G25.*X5.*tau25+G26.*X6.*tau26+G27.*X7.*tau27+G212.*X12.*tau212+G216.*X16.*tau216;
ln_y2_2=G12.*X1+ G23.*X3+G24.*X4+G25.*X5+G26.*X6+G27.*X7+G212.*X12+G216.*X16;
ln_y3_1=G13.*X1.*tau13+ G23.*X3.*tau23+ G34.*X4.*tau34+G35.*X5.*tau35+G36.*X6.*tau36+G37.*X7.*tau37+G312.*X12.*tau312+G316.*X16.*tau316;
ln_y3_2=G13.*X1+ G23.*X3+ G34.*X4+G35.*X5+G36.*X6+G37.*X7+G312.*X12+G316.*X16;
ln_y4_1=G14.*X1.*tau14+G24.*X2.*tau24+G34.*X3.*tau34+G46.*X6.*tau46+G47.*X7.*tau47+G412.*X12.*tau412+G416.*X16.*tau416;
ln_y4_2=G14.*X1+G24.*X2+G34.*X3+G46.*X6+G47.*X7+G412.*X12+G416.*X16;
ln_y5_1=G15.*X1.*tau15+G25.*X2.*tau25+G35.*X3.*tau35+G56.*X6.*tau56+G57.*X7.*tau57+G512.*X12.*tau512+G516.*X16.*tau516;
ln_y5_2=G15.*X1+G25.*X2+G35.*X3+G56.*X6+G57.*X7+G512.*X12+G516.*X16;
ln_y6_1=G16.*X1.*tau16+G26.*X2.*tau26+G36.*X3.*tau36+G46.*X4.*tau46+G56.*X5.*tau56;
ln_y6_2=G16.*X1+G26.*X2+G36.*X3+G46.*X4+G56.*X5;
ln_y7_1=G17.*X1.*tau17+G27.*X2.*tau27+G37.*X3.*tau37+G47.*X4.*tau47+G57.*X5.*tau57;
ln_y7_2=G17.*X1+G27.*X2+G37.*X3+G47.*X4+G57.*X5;
ln_y12_1=G112.*X1.*tau112+G212.*X2.*tau212+G312.*X3.*tau312+G412.*X4.*tau412+G512.*X5.*tau512;
ln_y12_2=G112.*X1+G212.*X2+G312.*X3+G412.*X4+G512.*X5;
ln_y16_1=G116.*X1.*tau116+G216.*X2.*tau216+G316.*X3.*tau316+G416.*X4.*tau416+G516.*X5.*tau516;
ln_y16_2=G116.*X1+G216.*X2+G316.*X3+G416.*X4+G516.*X5;
ln_y1_3=(((X2.*G12)./ln_y2_2).*(tau12-(ln_y2_1)./(ln_y2_2)))+(((X3.*G13)./ln_y3_2).*(tau13-(ln_y3_1)./(ln_y3_2)));
ln_y1_4=(((X6.*G16)./ln_y6_2).*(tau16- (ln_y6_1./ln_y6_2))) + (((X7.*G17)./ln_y7_2).*(tau17- (ln_y7_1./ln_y7_2)))+(((X12.*G12)./ln_y12_2).*(tau112- (ln_y12_1./ln_y12_2)))+(((X16.*G16)./ln_y16_2).*(tau116- (ln_y16_1./ln_y16_2)));
ln_y1_5=(((X4.*G14)./ln_y4_2).*(tau14- (ln_y4_1./ln_y4_2))) + (((X5.*G15)./ln_y5_2).*(tau15- (ln_y5_1./ln_y5_2)));
yk=exp((ln_y1_1./ln_y1_2) + ln_y1_3 + ln_y1_4+ ln_y1_5) % activity coefficient for H2O
end
........................................
Another function where above function to be called.....
% calling the function act_coeff to estimate the binary interaction parameters
for i=1:112
filename = 'EagelsDATA.xlsx'; %reading VLE data from excel file
Data = xlsread(filename);
x(:,1) = Data([10:15 17:19],16);
x(:,2) = Data([10:15 17:19],1);
x(:,3)= Data([10:15 17:19],2);
taua=(randi([-5,5],1,112));
yk=[0.0606 (values calculated from above function and will be used for fitting)
0.4327
0.6545
0.9417
1.2570
1.6881
1.9108
1.7777
1.3821]
% taua =[ -2 3 4 -3 -4 1 4 -2 4 -4 -1 4 5 -3 3 2 -5 3 -4
% 1 4 1 5 -1 -1 -3 2 -3 4 3 4 2 5 4 -2 4 3 -1
% 1 0 -5 -5 -5 -3 4 2 1 4 0 2 -3 -4 5 0 -3 2 5
% 1 0 5 1 -3 5 4 1 5 2 3 2 0 -5 -4 -2 1 -2 5
%-5 5 -2 -2 4 1 -1 3 -1 1 5 -1 0 -1 4 5 5 1 4
% 1 0 4 -4 4 0 -1 -2 -5 -3 -4 -5
% -5 0 -2 0 -5] (random values for which yk was calculted from the command
taua= randi([-5,5],1,112))
try % try-catch used to continue the loop without stopping on encountering an error
[taua1]= nlinfit(x,yk,#activity_coefficientE,taua)
catch exception
continue
end
end
I am not able to attach excel sheet here so data from excel sheet is as:
x =[0.1577 0.1492 0.1462 0.1366 0.1299 0.1180 0.0863 0.0761 0.0550; column 1
0.8278 0.7945 0.7678 0.7450 0.6979 0.6309 0.4611 0.4114 0.2952 ; column 2
0.0145 0.0563 0.0860 0.1184 0.1722 0.2511 0.4526 0.5125 0.6498 ]; column 3
I found 3 major problems with what you did.
Problem #1 - errors
The reason you get the error is because your function "activity_coefficientE" can sometimes return NaN or inf values. My suggestion is to look for these values and set the value of "yk" to a large value so that the optimizer in "nlinfit" will stay away from coefficients that produce infinite or NaN values. This is the code at the bottom of the function so that you avoid crashes:
if any(~isfinite(yk))
yk = 10 * ones(size(yk));
end
Problem #2 - random initial guesses
The trouble with using random numbers for your initial conditions is that every time you run it you get a different answer, so sometimes it works and sometimes it doesn't. If you set the random number generator seed, you can get the same random numbers each time you run the script. If you change you seed, you can get a different set of random numbers. I shortened your main script to this, where I try 100 different random seeds (and store the results of each attempt) to see what answers result:
for i=1:100
rng(i)
taua = randi([-5,5],1,112);
taua1(i, :) = nlinfit(x,yk,#activity_coefficientE,taua);
end
Each row of "taua1" is a set of 111 coefficients.
Problem #3 - Trying to fit 9 points with 112 coefficients
Every time nlinfit is called, you get this warning:
Warning: Rank deficient
because you have more coefficients (112) that you are asking nlinfit to find than data points you are fitting (9). It's like trying to find the 2nd order equation that best fits 2 points, there are an infinite number of solutions. When curve fitting you should have more data points than coefficients to make sure you're not fitting noise. You need more data points in "yk" and "x" and/or fewer coefficients to fit. I've done a lot of curve fitting and I've never seen an equation with 112 coefficients, so I am thinking that you are not solving the problem correctly. Perhaps the 112 coefficients aren't really independent or there are 112 data points and 9 coefficients that you want to find.
For completeness, here is my edited version of the activity_coefficientE.m function that I created to work on this solution. In general, I never see Matlab code with this many variables with similar names. Much of this code could be greatly simplified by using vector operations. Most of my changes involve formatting, adding semicolons, and the checks for non-finite values at the end.
function yk=activity_coefficientE(taua,x)
T=523;
alpha12=0.3; alpha13=0.3; alpha21=0.3; alpha23=0.3; alpha31=0.3; alpha32=0.3;
alpha18=0.2; alpha81=0.2; alpha28=0.2; alpha82=0.2; alpha38=0.2; alpha83=0.3;
alpha19=0.2; alpha91=0.2; alpha29=0.2; alpha92=0.2; alpha39=0.2; alpha93=0.2;
alpha110=0.2;alpha101=0.2;alpha210=0.2;alpha102=0.2;alpha310=0.2;alpha103=0.2;
alpha113=0.2;alpha131=0.2;alpha213=0.2;alpha132=0.2;alpha313=0.2;alpha133=0.2;
alpha114=0.2;alpha141=0.2;alpha214=0.2;alpha142=0.2;alpha314=0.2;alpha143=0.2;
alpha115=0.2;alpha151=0.2;alpha215=0.2;alpha152=0.2;alpha315=0.2;alpha153=0.2;
alpha117=0.2;alpha171=0.2;alpha217=0.2;alpha172=0.2;alpha317=0.2;alpha173=0.2;
alpha118=0.2;alpha181=0.2;alpha218=0.2;alpha182=0.2;alpha318=0.2;alpha183=0.2;
alpha810=0.2;alpha915=0.2;alpha1314=0.2;alpha108=0.2;alpha159=0.2;alpha1413=0.2;
alpha1718=0.2;alpha1817=0.2;
tau12=0; tau13=0; tau21=0; tau23=0; tau31=0; tau32=0;
tau18=taua(1)+taua(57)/T;
tau81=taua(2)+taua(58)/T;
tau28=taua(3)+taua(59)/T;
tau82=taua(4)+taua(60)/T;
tau38=taua(5)+taua(61)/T;
tau83=taua(6)+taua(62)/T;
tau19=taua(7)+taua(63)/T;
tau91=taua(8)+taua(64)/T;
tau29=taua(9)+taua(65)/T;
tau92=taua(10)+taua(66)/T;
tau39=taua(11)+taua(67)/T;
tau93=taua(12)+taua(68)/T;
tau110=taua(13)+taua(69)/T;
tau101=taua(14)+taua(70)/T;
tau210=taua(15)+taua(71)/T;
tau102=taua(16)+taua(72)/T;
tau310=taua(17)+taua(73)/T;
tau103=taua(18)+taua(74)/T;
tau113=taua(19)+taua(75)/T;
tau131=taua(20)+taua(76)/T;
tau213=taua(21)+taua(77)/T;
tau132=taua(22)+taua(78)/T;
tau313=taua(23)+taua(79)/T;
tau133=taua(24)+taua(80)/T;
tau114=taua(25)+taua(81)/T;
tau141=taua(26)+taua(82)/T;
tau214=taua(27)+taua(83)/T;
tau142=taua(28)+taua(84)/T;
tau314=taua(29)+taua(85)/T;
tau143=taua(30)+taua(86)/T;
tau115=taua(31)+taua(87)/T;
tau151=taua(32)+taua(88)/T;
tau215=taua(33)+taua(89)/T;
tau152=taua(34)+taua(90)/T;
tau315=taua(35)+taua(91)/T;
tau153=taua(36)+taua(92)/T;
tau117=taua(37)+taua(93)/T;
tau171=taua(38)+taua(94)/T;
tau217=taua(39)+taua(95)/T;
tau172=taua(40)+taua(96)/T;
tau317=taua(41)+taua(97)/T;
tau173=taua(42)+taua(98)/T;
tau118=taua(43)+taua(99)/T;
tau181=taua(44)+taua(100)/T;
tau218=taua(45)+taua(101)/T;
tau182=taua(46)+taua(102)/T;
tau318=taua(47)+taua(103)/T;
tau183=taua(48)+taua(104)/T;
tau810=taua(49)+taua(105)/T;
tau108=taua(50)+taua(106)/T;
tau915=taua(51)+taua(107)/T;
tau159=taua(52)+taua(108)/T;
tau1314=taua(53)+taua(109)/T;
tau1413=taua(54)+taua(110)/T;
tau1718=taua(55)+taua(111)/T;
tau1817=taua(56)+taua(112)/T;
G12=exp(-(tau12*alpha12));
G21=exp(-(tau21*alpha21));
G13=exp(-(tau13*alpha13));
G31=exp(-(tau31*alpha31));
G23=exp(-(tau23*alpha23));
G32=exp(-(tau32*alpha32));
G18=exp(-(tau18*alpha18));
G81=exp(-(tau81*alpha81));
G28=exp(-(tau28*alpha28));
G82=exp(-(tau82*alpha82));
G38=exp(-(tau38*alpha83));
G83=exp(-(tau83*alpha83));
G19=exp(-(tau19*alpha19));
G91=exp(-(tau91*alpha91));
G29=exp(-(tau29*alpha29));
G92=exp(-(tau92*alpha92));
G39=exp(-(tau39*alpha39));
G93=exp(-(tau93*alpha93));
G110=exp(-(tau110*alpha110));
G101=exp(-(tau101*alpha101));
G210=exp(-(tau210*alpha210));
G102=exp(-(tau102*alpha102));
G310=exp(-(tau310*alpha310));
G103=exp(-(tau103*alpha103));
G113=exp(-(tau113*alpha113));
G131=exp(-(tau131*alpha131));
G213=exp(-(tau213*alpha213));
G132=exp(-(tau132*alpha132));
G313=exp(-(tau313*alpha313));
G133=exp(-(tau133*alpha133));
G114=exp(-(tau114*alpha114));
G141=exp(-(tau141*alpha141));
G214=exp(-(tau214*alpha214));
G142=exp(-(tau142*alpha142));
G314=exp(-(tau314*alpha314));
G143=exp(-(tau143*alpha143));
G115=exp(-(tau115*alpha115));
G151=exp(-(tau151*alpha151));
G215=exp(-(tau215*alpha215));
G152=exp(-(tau152*alpha152));
G315=exp(-(tau315*alpha315));
G153=exp(-(tau153*alpha153));
G117=exp(-(tau117*alpha117));
G171=exp(-(tau171*alpha171));
G217=exp(-(tau217*alpha217));
G172=exp(-(tau172*alpha172));
G317=exp(-(tau317*alpha317));
G173=exp(-(tau173*alpha173));
G118=exp(-(tau118*alpha118));
G181=exp(-(tau181*alpha181));
G218=exp(-(tau218*alpha218));
G182=exp(-(tau182*alpha182));
G318=exp(-(tau318*alpha318));
G183=exp(-(tau183*alpha183));
G810=exp(-(tau810*alpha810));
G108=exp(-(tau108*alpha108));
G915=exp(-(tau915*alpha915));
G159=exp(-(tau159*alpha159));
G1314=exp(-(tau1314*alpha1314));
G1413=exp(-(tau1413*alpha1413));
G1718=exp(-(tau1718*alpha1718));
G1817=exp(-(tau1817*alpha1817));
%calculating mole fractions of ionic species
x1=x(:,1);
x2=x(:,2);
x3=x(:,3);
A=[0.0674243 0.0773881 0.0843400 0.0865343 0.0899223 0.0882858 0.0715087 0.0643867 0.0483658];
B=[0.0141081 0.0479814 0.0643151 0.0737477 0.0820756 0.0838701 0.0701576 0.0634457 0.0479639];
C=[0.0565665 0.0450072 0.0387724 0.0313828 0.02506094 0.0186280 0.0092734 0.0073438 0.0041595 ];
D=[0.0336447 0.0267694 0.0230611 0.0186659 0.0149058 0.0110795 0.0055157 0.0043679 0.0024739 ];
E=[0.0008148 0.0008756 0.00087131 0.0008794 0.0008711 0.0008441 0.0007384 0.0006997 0.0005980 ];
N=length(A);
x1n=zeros(N,1);x2n=zeros(N,1);x3n=zeros(N,1);
X1=zeros(N,1);X2=zeros(N,1);X3=zeros(N,1);X4=zeros(N,1);X5=zeros(N,1);X6=zeros(N,1);X7=zeros(N,1);
X12=zeros(N,1);X16=zeros(N,1);
for i=1:N
x1n(i)=(x1(i)-A(i)-D(i)-2*E(i)-C(i)+3*B(i));
x2n(i)=(x2(i)-A(i)-C(i)-D(i));
x3n(i)=(x3(i)-B(i));
X1(i)=(x1n(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)));
X2(i)=(x2n(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)));
X3(i)=(x3n(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)));
X4(i)=(A(i)+D(i)+E(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)));
X5(i)=(C(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)));
X6(i)=(A(i)-B(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)));
X7(i)=(B(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)));
X12(i)=(E(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)));
X16(i)=(C(i)+D(i)/(x1n(i)+x2n(i)+x3n(i)+2*A(i)+4*B(i)+2*C(i)+2*D(i)+2*E(i)));
end
yc4=X4./(X4+X5);
yc5=X5./(X4+X5);
yc6=X6./(X6+X7+X12+X16);
yc7=X7./(X6+X7+X12+X16);
yc12=X12./(X6+X7+X12+X16);
yc16=X16./(X6+X7+X12+X16);
alpha14=yc6.*alpha18+yc7.*alpha19+yc12.*alpha113+yc16.*alpha117;
alpha24=yc6.*alpha28+yc7.*alpha29+yc12.*alpha213+yc16.*alpha217;
alpha34=yc6.*alpha38+yc7.*alpha39+yc12.*alpha313+yc16.*alpha317;
alpha15=yc6.*alpha110+yc7.*alpha115+yc12.*alpha114+yc16.*alpha118;
alpha25=yc6.*alpha210+yc7.*alpha215+yc12.*alpha214+yc16.*alpha218;
alpha35=yc6.*alpha310+yc7.*alpha315+yc12.*alpha314+yc16.*alpha318;
alpha16=yc4.*alpha81+yc5.*alpha101;
alpha26=yc4.*alpha82+yc5.*alpha102;
alpha36=yc4.*alpha83+yc5.*alpha103;
alpha17=yc4.*alpha91+yc5.*alpha151;
alpha27=yc4.*alpha92+yc5.*alpha152;
alpha37=yc4.*alpha93+yc5.*alpha153;
alpha112=yc4.*alpha131+yc5.*alpha141;
alpha212=yc4.*alpha132+yc5.*alpha142;
alpha312=yc4.*alpha133+yc5.*alpha143;
alpha116=yc4.*alpha171+yc5.*alpha181;
alpha216=yc4.*alpha172+yc5.*alpha182;
alpha316=yc4.*alpha173+yc5.*alpha183;
alpha46=yc5.*alpha810;
alpha47=yc5.*alpha915;
alpha412=yc5.*alpha1314;
alpha416=yc5.*alpha1718;
alpha56=yc4.*alpha108;
alpha57=yc4.*alpha159;
alpha512=yc4.*alpha1413;
alpha516=yc4.*alpha1817;
G14=yc6.*G18+yc7.*G19+yc12.*G113+yc16.*G117;
G24=yc6.*G28+yc7.*G29+yc12.*G213+yc16.*G217;
G34=yc6.*G38+yc7.*G39+yc12.*G313+yc16.*G317;
G15=yc6.*G110+yc7.*G115+yc12.*G114+yc16.*G118;
G25=yc6.*G210+yc7.*G215+yc12.*G214+yc16.*G218;
G35=yc6.*G310+yc7.*G315+yc12.*G314+yc16.*G318;
G16=yc4.*G81+yc5.*G101;
G26=yc4.*G82+yc5.*G102;
G36=yc4.*G83+yc5.*G103;
G17=yc4.*G91+yc5.*G151;
G27=yc4.*G92+yc5.*G152;
G37=yc4.*G93+yc5.*G153;
G112=yc4.*G131+yc5.*G141;
G212=yc4.*G132+yc5.*G142;
G312=yc4.*G133+yc5.*G143;
G116=yc4.*G171+yc5.*G181;
G216=yc4.*G172+yc5.*G182;
G316=yc4.*G173+yc5.*G183;
G46=yc5.*G810;
G47=yc5.*G915;
G412=yc5.*G1314;
G416=yc5.*G1718;
G56=yc4.*G108;
G57=yc4.*G159;
G512=yc4.*G1413;
G516=yc4.*G1817;
tau14=-log(G14)./alpha14;
tau24=-log(G24)./alpha24;
tau34=-log(G34)./alpha34;
tau15=-log(G15)./alpha15;
tau25=-log(G25)./alpha25;
tau35=-log(G35)./alpha35;
tau16=-log(G16)./alpha16;
tau26=-log(G26)./alpha26;
tau36=-log(G36)./alpha36;
tau17=-log(G17)./alpha17;
tau27=-log(G27)./alpha27;
tau37=-log(G37)./alpha37;
tau112=-log(G112)./alpha112;
tau212=-log(G212)./alpha212;
tau312=-log(G312)./alpha312;
tau116=-log(G116)./alpha116;
tau216=-log(G216)./alpha216;
tau316=-log(G316)./alpha316;
tau46=-log(G46)./alpha46;
tau47=-log(G47)./alpha47;
tau412=-log(G412)./alpha412;
tau416=-log(G416)./alpha416;
tau56=-log(G56)./alpha56;
tau57=-log(G57)./alpha57;
tau512=-log(G512)./alpha512;
tau516=-log(G516)./alpha516;
ln_y1_1=G12.*X2.*tau12+ G31.*X3.*tau13+ G14.*X4.*tau14+G15.*X5.*tau15+G16.*X6.*tau16+G17.*X7.*tau17+G112.*X12.*tau112+G116.*X16.*tau116;
ln_y1_2=G12.*X2+ G13.*X3+ G14.*X4+G15.*X5+G16.*X6+G17.*X7+G112.*X12+G116.*X16;
ln_y2_1=G21.*X1.*tau12+ G32.*X3.*tau32+ G24.*X4.*tau24+G25.*X5.*tau25+G26.*X6.*tau26+G27.*X7.*tau27+G212.*X12.*tau212+G216.*X16.*tau216;
ln_y2_2=G12.*X1+ G23.*X3+G24.*X4+G25.*X5+G26.*X6+G27.*X7+G212.*X12+G216.*X16;
ln_y3_1=G13.*X1.*tau13+ G23.*X3.*tau23+ G34.*X4.*tau34+G35.*X5.*tau35+G36.*X6.*tau36+G37.*X7.*tau37+G312.*X12.*tau312+G316.*X16.*tau316;
ln_y3_2=G13.*X1+ G23.*X3+ G34.*X4+G35.*X5+G36.*X6+G37.*X7+G312.*X12+G316.*X16;
ln_y4_1=G14.*X1.*tau14+G24.*X2.*tau24+G34.*X3.*tau34+G46.*X6.*tau46+G47.*X7.*tau47+G412.*X12.*tau412+G416.*X16.*tau416;
ln_y4_2=G14.*X1+G24.*X2+G34.*X3+G46.*X6+G47.*X7+G412.*X12+G416.*X16;
ln_y5_1=G15.*X1.*tau15+G25.*X2.*tau25+G35.*X3.*tau35+G56.*X6.*tau56+G57.*X7.*tau57+G512.*X12.*tau512+G516.*X16.*tau516;
ln_y5_2=G15.*X1+G25.*X2+G35.*X3+G56.*X6+G57.*X7+G512.*X12+G516.*X16;
ln_y6_1=G16.*X1.*tau16+G26.*X2.*tau26+G36.*X3.*tau36+G46.*X4.*tau46+G56.*X5.*tau56;
ln_y6_2=G16.*X1+G26.*X2+G36.*X3+G46.*X4+G56.*X5;
ln_y7_1=G17.*X1.*tau17+G27.*X2.*tau27+G37.*X3.*tau37+G47.*X4.*tau47+G57.*X5.*tau57;
ln_y7_2=G17.*X1+G27.*X2+G37.*X3+G47.*X4+G57.*X5;
ln_y12_1=G112.*X1.*tau112+G212.*X2.*tau212+G312.*X3.*tau312+G412.*X4.*tau412+G512.*X5.*tau512;
ln_y12_2=G112.*X1+G212.*X2+G312.*X3+G412.*X4+G512.*X5;
ln_y16_1=G116.*X1.*tau116+G216.*X2.*tau216+G316.*X3.*tau316+G416.*X4.*tau416+G516.*X5.*tau516;
ln_y16_2=G116.*X1+G216.*X2+G316.*X3+G416.*X4+G516.*X5;
ln_y1_3=(((X2.*G12)./ln_y2_2).*(tau12-(ln_y2_1)./(ln_y2_2)))+(((X3.*G13)./ln_y3_2).*(tau13-(ln_y3_1)./(ln_y3_2)));
ln_y1_4=(((X6.*G16)./ln_y6_2).*(tau16- (ln_y6_1./ln_y6_2))) + (((X7.*G17)./ln_y7_2).*(tau17- (ln_y7_1./ln_y7_2)))+(((X12.*G12)./ln_y12_2).*(tau112- (ln_y12_1./ln_y12_2)))+(((X16.*G16)./ln_y16_2).*(tau116- (ln_y16_1./ln_y16_2)));
ln_y1_5=(((X4.*G14)./ln_y4_2).*(tau14- (ln_y4_1./ln_y4_2))) + (((X5.*G15)./ln_y5_2).*(tau15- (ln_y5_1./ln_y5_2)));
yk=exp((ln_y1_1./ln_y1_2) + ln_y1_3 + ln_y1_4+ ln_y1_5)'; % activity coefficient for H2O
if any(~isfinite(yk))
yk = 10 * ones(size(yk));
end

What is the correct way of interpreting the effect of two interaction terms in lmer?

I am interested in examining the effect of time on the levels of antibodies and how that relationship in influenced by the interaction of gender and age. This is how I have built my model. I have included a random intercept for repeated measures.
model <- lmer(Antibody ~ Time + (Sex*Age)+ (1|PID), data=metadata)
This is the result
Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: Antibody ~ Time + (Sex * Age) + (1 | PID)
Data: metadata
AIC BIC logLik deviance df.resid
441.0 461.3 -213.5 427.0 128
Scaled residuals:
Min 1Q Median 3Q Max
-2.14160 -0.28264 -0.01453 0.26966 2.27572
Random effects:
Groups Name Variance Std.Dev.
PID (Intercept) 1.8039 1.343
Residual 0.3003 0.548
Number of obs: 135, groups: PID, 95
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 6.717567 0.263584 134.327633 25.485 < 2e-16 ***
Time -0.013952 0.002131 54.645901 -6.547 2.13e-08 ***
Sex 0.740442 0.299279 92.341423 2.474 0.0152 *
Age -0.101281 0.227621 92.276736 -0.445 0.6574
Sex.Male:Age 0.655921 0.307147 91.570395 2.136 0.0354 *
How can I interpret this output? Does the significant interaction between males and age mean that older males have higher antibodies for longer? If not how should I formulate the model to test for the impact of the interaction of age and sex on the duration of the antibody?
Thanks in advance

how to use if in matlab for 2 matrix condition? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
i have 2 reflection coefficient equations R1 and R2 from K with condition absolute must below 1, i use if command for this situation .But when i plot the graph the absolute reflection coefficient still above 1. (K is matrix with 1 column and 201 row)
R1=K+sqrt(K.^2-1);
R2=K-sqrt(K.^2-1);
if abs(R1)<1
r=R1;
else
r=R2;
end
this is the K in excel
real imaginer
-0.7536 0.0512
-0.802 0.0426
-0.8496 0.0408
-0.8872 0.0327
-0.927 0.0338
-0.9575 0.0242
-0.979 0.0174
-0.9977 0.0113
-10,031 0.0029
-10,012 -0.007
-0.9876 -0.0167
-0.9654 -0.0249
-0.9299 -0.0401
-0.8797 -0.0488
-0.8176 -0.0623
-0.7297 -0.0782
-0.6458 -0.0865
-0.5351 -0.1051
-0.4098 -0.1197
-0.2701 -0.1349
-0.1177 -0.1489
0.0536 -0.1699
0.213 -0.1853
0.3933 -0.1921
0.5519 -0.1857
0.7128 -0.1896
0.8511 -0.1712
0.9468 -0.1452
10,222 -0.0943
10,375 -0.04
10,134 0.0365
0.9361 0.1255
0.8122 0.2168
0.6622 0.3108
0.4657 0.3774
0.2577 0.4497
0.0431 0.4775
-0.1463 0.5093
-0.3442 0.4999
-0.5203 0.4782
-0.6692 0.4417
-0.7781 0.3822
-0.8856 0.3293
-0.9703 0.2615
-10,187 0.193
-10,524 0.1254
-10,614 0.0557
-10,539 -0.0016
-10,297 -0.0698
-0.9879 -0.1212
-0.9355 -0.1829
-0.8721 -0.2298
-0.8011 -0.2783
-0.7232 -0.325
-0.6401 -0.3586
-0.5455 -0.4008
-0.4429 -0.43
-0.3524 -0.4433
-0.2455 -0.4769
-0.1336 -0.4863
-0.0391 -0.5073
0.0779 -0.5105
0.1776 -0.5196
0.2869 -0.5152
0.3893 -0.5084
0.4831 -0.4978
0.5888 -0.4907
0.6822 -0.4574
0.7614 -0.4381
0.8484 -0.4017
0.9098 -0.3585
0.9771 -0.3172
10,268 -0.2607
10,667 -0.2102
10,969 -0.1464
11,115 -0.0724
11,141 -0.0019
10,981 0.0838
10,645 0.1546
10,135 0.2457
0.9409 0.3332
0.8657 0.4061
0.7519 0.4973
0.6426 0.5635
0.5072 0.6302
0.3633 0.6782
0.2148 0.7161
0.0382 0.7573
-0.1051 0.7395
-0.273 0.7359
-0.4273 0.7154
-0.5653 0.6794
-0.6971 0.6279
-0.8202 0.555
-0.905 0.493
-0.9996 0.4155
-10,716 0.3239
-11,006 0.2549
-11,444 0.1479
-11,464 0.0722
-11,493 -0.0031
-11,282 -0.0814
-11,040 -0.1603
-10,645 -0.2219
-10,187 -0.2787
-0.9514 -0.3223
-0.8878 -0.3841
-0.8225 -0.42
-0.7415 -0.4606
-0.6607 -0.4889
-0.5577 -0.5319
-0.482 -0.5512
-0.3775 -0.5614
-0.2918 -0.5798
-0.1621 -0.5712
-0.0979 -0.5917
0.0149 -0.5559
0.1062 -0.5734
0.2142 -0.5648
0.3159 -0.5363
0.3844 -0.5302
0.5019 -0.5066
0.5805 -0.4709
0.6626 -0.4506
0.7482 -0.4117
0.8005 -0.363
0.8799 -0.3378
0.9349 -0.2889
0.9883 -0.2449
10,306 -0.1946
10,643 -0.1373
10,870 -0.1025
10,935 -0.0389
10,840 0.0184
10,732 0.0639
10,333 0.1274
0.9906 0.1739
0.9243 0.2293
0.8455 0.2752
0.7527 0.3035
0.6292 0.3394
0.5384 0.3524
0.3808 0.3845
0.2509 0.4067
0.0931 0.4004
-0.0423 0.3839
-0.2123 0.377
-0.3666 0.3537
-0.4838 0.3309
-0.6157 0.288
-0.7211 0.2604
-0.8322 0.2172
-0.8947 0.1791
-0.9618 0.1366
-10,024 0.0932
-10,299 0.0493
-10,415 0.0099
-10,333 -0.0243
-10,092 -0.0612
-0.9798 -0.0906
-0.9321 -0.1302
-0.8796 -0.1472
-0.8121 -0.17
-0.7414 -0.1886
-0.6649 -0.2019
-0.5907 -0.2149
-0.4793 -0.2271
-0.4011 -0.2224
-0.3121 -0.2408
-0.1948 -0.2343
-0.0997 -0.2322
0.008 -0.2328
0.1304 -0.2224
0.2662 -0.2213
0.4093 -0.2298
0.553 -0.2406
0.7094 -0.3018
0.8613 -0.383
0.9745 -0.5634
0.9796 -0.8226
0.7781 -0.9412
0.6424 -0.8495
0.6264 -0.8147
0.6071 -0.6706
0.6682 -0.6029
0.6759 -0.5596
0.71 -0.5218
0.7479 -0.4825
0.7691 -0.4476
0.8264 -0.4056
0.8412 -0.3912
0.8511 -0.3813
0.8689 -0.3425
0.899 -0.3375
0.8827 -0.3198
0.9024 -0.3164
0.929 -0.2876
0.9106 -0.2855
0.9695 -0.2079
10,342 -0.5353
0.8692 -0.5046
I am not 100% sure exactly what you are asking, but I believe the problem you are experiencing is that r is above 1?
K is an imaginary number, where the first column is the real part and the second column is the imaginary part, do I have that correctly? So the first K value is -0.7536+0.0512i, right?
Ok, so did you perhaps intend to cycle through each position of the R1 matrix and see if each one was less than 1. Because right now what you are doing is saying if any values in the entire R1 vector are less than 1, then r equals to the entire R2 vector.
If you want to go through each position in the vector, you should do this:
R1=K+sqrt(K.^2-1);
R2=K-sqrt(K.^2-1);
l=length(R1);
for p=1:l
if abs(R1(p))<1
r(p)=R1(p);
else
r(p)=R2(p);
end
end

Matlab:Sampling Curve into Frames and Plotting

I have a Output Curve of following characteristics
http://i.imgur.com/hABfsiC.jpg
Following is the data which represents the output curve cited above
0 1228.15406117455 1213.71796132282 1199.44623423626 1185.33715849069 1171.38902630825 1157.60014358826 1143.96882993237 1130.49341866405 1117.17225684288 1104.00370527364 1090.98613851046 1078.11794485629 1065.39752635781 1052.82329879590 1040.39369167202 1028.10714819050 1015.96212523702 1003.95709335331 992.090536708388 980.360953066379 968.766853751044 957.306763607236 945.979220959370 934.782777567031 923.715998577884 912.777462477973 901.965761039541 891.279499266498 880.717295337626 870.277780547640 859.959599246218 849.761408775075 839.681879403208 829.719694260385 819.873549268974 810.142153074209 800.524226972966 791.018504841132 781.623733059661 772.338670439371 763.162088144576 754.092769615612 745.129510490332 736.271118524637 727.516413512102 718.864227202765 710.313403221133 701.862796983477 693.511275614446 685.257717863085 677.101014018280 669.040065823703 661.073786392290 653.201100120311 645.420942601057 637.732260538220 630.134011658968 622.625164626790 615.204698954125 607.871604914830 600.624883456507 593.463546112736 586.386614915240 579.393122306018 572.482111049470 565.652634144552 558.903754736983 552.234546031533 545.644091204419 539.131483315831 532.695825222615 526.336229491134 520.051818310328 513.841723405001 507.705085949342 501.641056480713 495.648794813713 489.727469954538 483.876260015660 478.094352130827 472.380942370417 466.735235657145 461.156445682143 455.643794821435 450.196514052799 444.813842873049 439.495029215736 434.239329369281 429.046007895553 423.914337548901 418.843599195643 413.833081734033 408.882082014698 403.989904761570 399.155862493301 394.379275445192 389.659471491612 384.995786068946 380.387562099043 375.834149913207 371.334907176693 366.889198813755 362.496396933217 358.155880754588 353.867036534721 349.629257495012 345.441943749158 341.304502231452 337.216346625644 333.176897294352 329.185581209025 325.241831880470 321.345089289941 317.494799820775 313.690416190604 309.931397384121 306.217208586402 302.547321116805 298.921212363411 295.338365718043 291.798270511836 288.300421951372 284.844321055367 281.429474591926 278.055395016351 274.721600409499 271.427614416707 268.172966187255 264.957190314395 261.779826775920 258.640420875285 255.538523183269 252.473689480189 249.445480698649 246.453462866826 243.497207052304 240.576289306430 237.690290609210 234.838796814729 232.021398597103 229.237691396949 226.487275368383 223.769755326528 221.084740695544 218.431845457169 215.810688099765 213.220891567874 210.662083212278 208.133894740554 205.635962168130 203.167925769835 200.729430031931 198.320123604641 195.939659255160 193.587693821135 191.263888164634 188.967907126584 186.699419481673 184.458097893730 182.243618871551 180.055662725203 177.893913522768 175.758059047548 173.647790755713 171.562803734401 169.502796660248 167.467471758370 165.456534761766 163.469694871160 161.506664715267 159.567160311482 157.650901026989 155.757609540290 153.887011803139 152.038837002892 150.212817525260 148.408688917462 146.626189851781 144.865062089509 143.125050445289 141.405902751840 139.707369825069 138.029205429564 136.371166244459 134.733011829684 133.114504592569 131.515409754832 129.935495319916 128.374532040696 126.832293387534 125.308555516696 123.803097239110 122.315699989477 120.846147795722 119.394227248782 117.959727472736 116.542440095264 115.142159218437 113.758681389832 112.391805573974 111.041333124092 109.707067754198 108.388815511474 107.086384748976 105.799586098638 104.528232444585 103.272138896747 102.031122764767 100.805003532210 99.5936028310572 98.3967444164976 97.2142541419957 96.0459599346504 94.8916917708293 93.7512816520819 92.6245635813268 91.5113735393103 90.4115494613329 89.3249312142428 88.2513605736907 87.1906812016462 86.1427386241704 85.1073802094438 84.0844551460460 83.0738144214844 82.0753108009696 81.0887988064351 80.1141346957970 79.1511764424544 78.1997837150241 77.2598178573099 76.3311418685023 75.4136203836077 74.5071196541023 73.6115075288110 72.7266534350062 71.8524283597264 70.9887048313103 70.1353569011454 69.2922601256279 68.4592915483322 67.6363296823873 66.8232544930576 66.0199473805265 65.2262911628803 64.4421700592893 63.6674696733859 62.9020769768354 62.1458802930985 61.3987692813833 59.4883213755835 57.6483869118112 55.8755259367794 54.1665202384763 52.5183563982524 50.9282102384589 49.3934325474650 47.9115359739955 46.4801829919653 45.0971748454356 43.7604413910364 42.4680317622626 41.2181057864981 40.0089260915283 38.8388508436906 37.7063270647464 36.6098844790632 35.5481298468222 34.5197417427304 33.5234657431651 32.5581099878283 31.6225410848696 30.7156803310698 29.8365002210865 28.9840212219663 28.1573087911403 27.3554706179645 26.5776540705486 25.8230438311588 25.0908597048888 24.3803545875820 23.6908125801659 23.0215472376397 22.3718999419403 21.7412383888150 21.1289551796556 20.5344665100015 19.9572109471129 19.3966482896451 18.8522585030342 18.3235407247356 17.8100123339373 17.3112080808174 16.8266792708190 16.3559929997865 15.8987314361504 15.4544911466551 15.0228824624129 14.6035288823265 14.1960665111621 13.8001435297733 13.4154196951792 13.0415658683801 12.6782635679663 12.3252045477276 11.9820903966137 11.6486321595240 11.3245499775272 11.0095727462157 10.7034377910043 10.4058905582723 10.1166843213306 9.83557990027752 9.56234539487254 9.29675592962605 9.03859341036164 8.78764629156238 8.54370935386321 8.30658349109817 8.07607550635358 7.85199791651758 7.63416876485290 7.42241144115244 7.21655450906823 7.01643154023247 6.82188095481515 6.63274586818697 6.44887394337809 6.27011724904377 6.09633212266684 5.92737903874406 5.76312248171972 5.60343082344452 5.44817620495165 5.29723442235448 5.15048481668219 5.00781016748056 4.86909659001510 4.73423343592343 4.60311319717196 4.47563141318063 4.35168658098654 4.23118006832444 4.11401602950876 4.00010132400749 3.88934543760435 3.78166040605072 3.67696074111369 3.57516335893142 3.47618751059112 3.37995471484913 3.28638869291620 3.19541530523493 3.10696249017925 3.02096020460939 2.93734036621838 2.85603679760903 2.77698517204319 2.70012296080697 2.62538938213866 2.55272535166765 2.48207343431511 2.41337779760910 2.34658416636844 2.28163977871173 2.21849334334935 2.15709499811800 2.09739626971883 2.03935003462156 1.98291048109845 1.92803307235332 1.87467451071194 1.82279270284141 1.77234672596718 1.72329679505757 1.67560423094658 1.62923142936686 1.58414183086548 1.54029989157635 1.49767105482374 1.45622172353228 1.41591923341968 1.37673182694912 1.33862862801892 1.30157961736815 1.26555560867691 1.23052822534142 1.19646987790401 1.16335374211922 1.13115373763752 1.09984450728875 1.06940139694817 1.03980043596818 1.01101831815952 0.983032383306248 0.955820599199133 0.929361544172696 0.903634390131477 0.878618886051614 0.854295341944170 0.830644613267103 0.807648085773110 0.785287660780989 0.763545740858505 0.742405215905110 0.721849449623219 0.701862266367018 0.682427938358193 0.663531173258183 0.645157102086936 0.627291267478379 0.609919612263140 0.593028468369314 0.576604546032312 0.560634923305132 0.545107035860604 0.530008667077409 0.515327938401923 0.501053299978151 0.487173521538225 0.473677683546191 0.460555168587976 0.447795653000654 0.435389098734315 0.423325745440032 0.411596102777619 0.400190942937019 0.389101293367371 0.378318429707958 0.367833868915394 0.357639362581574 0.347726890437081 0.338088654034864 0.328717070609165 0.319604767104817 0.310744574372160 0.302129521522970 0.293752830442904 0.285607910456123 0.277688353137837 0.269987927270671 0.262500573940842 0.255220401770266 0.248141682280806 0.241258845386994 0.234566475013650 0.228059304834930 0.221732214131435 0.215580223762081 0.209598492247567 0.203782311962319 0.198127105431917 0.192628421733057 0.187281932993220 0.182083430987262 0.177028823828250 0.172114132749923 0.167335488978228 0.162689130689473 0.158171400052687 0.153778740353848 0.149507693199712 0.145354895799043 0.141317078319080 0.137391061315172 0.133573753231541 0.129862147971212 0.126253322533180 0.122744434714959 0.119332720878702 0.116015493779123 0.112790140451515 0.109654120158199 0.106604962391776 0.103640264933625 0.100757691966098 0.0979549722369389 0.0952298972744753 0.0925803196521720 0.0900041513011877 0.0874993618696001 0.0850639771270087 0.0826960774132594 0.0803937961300688 0.0781553182743600 0.0759788790121574 0.0738627622919147 0.0718052994961873 0.0698048681305858 0.0678598905489812 0.0659688327139552 0.0641302029915237 0.0623425509791821 0.0606044663663534 0.0589145778263389 0.0572715519389033 0.0556740921426450 0.0541209377163267 0.0526108627883675 0.0511426753737151
The following function represents the output characteristics of Tracer in 50 minute time interval ( The Y-Axis-Mbq and X-Axis : Time in minutes)
Now i would like to Sample the Output Curve into 19 frames
4 frames : Each of 15 seconds time interval
2 frames : Each of 30 seconds time interval
2 frames : Each of 60 seconds time interval
11 frames : Each of 200 seconds time interval
and plot each of the Respective frames in a plot, kindly suggest me some methodology to approach this problem
If I understand correctly, you have for the corresponding x-values time from 0 to 50 minutes, so since you have 500 samples you have 10 samples per minute or an interval of 6 seconds between samples.
To get samples at a different rate, you can interpolate your signal using interp1. If the signal you gave above is stored in Y, you can interpolate it to 15 second intervals using:
x = 0:6:3000; % The original sample time, in seconds
xi = 0:15:3000; % The interpolated sample time, in seconds
Yi = interp1(x, Y, xi);
You can interpolate to any specified x-value within the original data, so for the varying sample rate you require you can define:
xi = [0:15:60, 90:30:120, 180:60:240, 440:200:2240];
Plotting of curves in MATLAB is usually done using the plot function. For your interpolated data you can use:
figure;
plot(xi / 60, Yi);
xlabel('Time [min]');
ylabel('Signal [units]');
title('My signal');
Note how the time units have been changed from seconds to minutes for the plot. The rest of the commands given here are useful for plotting as well. figure creates a new figure window for the plot and xlabel, ylabel and title are used to annotate it.

Libsvm Classification MATLAB

I used 1~200 data as trainning data, 201~220 as testing data
format likes: 3 class(class 1,class 2, class 3) and 20 features
2 1:100 2:96 3:88 4:94 5:96 6:94 7:72 8:68 9:69 10:70 11:76 12:70 13:73 14:71 15:74 16:76 17:78 18:81 19:76 20:76
2 1:96 2:100 3:88 4:88 5:90 6:98 7:71 8:66 9:63 10:74 11:75 12:66 13:71 14:68 15:74 16:78 17:78 18:85 19:77 20:76
2 1:88 2:88 3:100 4:96 5:91 6:89 7:70 8:70 9:68 10:74 11:76 12:71 13:73 14:74 15:79 16:77 17:73 18:80 19:78 20:78
2 1:94 2:87 3:96 4:100 5:92 6:88 7:76 8:73 9:71 10:70 11:74 12:67 13:71 14:71 15:76 16:77 17:71 18:80 19:73 20:73
2 1:96 2:90 3:91 4:93 5:100 6:92 7:74 8:67 9:67 10:75 11:75 12:67 13:74 14:73 15:77 16:77 17:75 18:82 19:76 20:74
2 1:93 2:98 3:90 4:88 5:92 6:100 7:73 8:66 9:65 10:73 11:78 12:69 13:73 14:72 15:75 16:74 17:75 18:83 19:79 20:77
3 1:73 2:71 3:73 4:76 5:74 6:73 7:100 8:79 9:79 10:71 11:65 12:58 13:67 14:73 15:74 16:72 17:60 18:63 19:64 20:60
3 1:68 2:66 3:70 4:73 5:68 6:67 7:78 8:100 9:85 10:77 11:57 12:57 13:58 14:62 15:68 16:64 17:59 18:57 19:57 20:59
3 1:69 2:64 3:70 4:72 5:69 6:65 7:78 8:85 9:100 10:70 11:56 12:63 13:62 14:61 15:64 16:69 17:56 18:55 19:55 20:51
3 1:71 2:74 3:74 4:70 5:76 6:73 7:71 8:73 9:71 10:100 11:58 12:58 13:59 14:60 15:58 16:65 17:57 18:57 19:63 20:57
1 1:77 2:75 3:76 4:73 5:75 6:79 7:66 8:56 9:56 10:59 11:100 12:77 13:84 14:79 15:82 16:80 17:82 18:82 19:81 20:82
1 1:70 2:66 3:71 4:67 5:67 6:70 7:63 8:57 9:62 10:58 11:77 12:100 13:84 14:75 15:76 16:78 17:73 18:72 19:87 20:80
1 1:73 2:72 3:73 4:71 5:74 6:74 7:68 8:58 9:61 10:59 11:84 12:84 13:100 14:86 15:88 16:91 17:81 18:81 19:84 20:86
1 1:71 2:69 3:75 4:71 5:73 6:73 7:74 8:61 9:61 10:60 11:79 12:75 13:86 14:100 15:90 16:88 17:74 18:79 19:81 20:82
1 1:74 2:74 3:80 4:76 5:78 6:76 7:73 8:66 9:64 10:59 11:81 12:76 13:88 14:90 15:100 16:93 17:74 18:83 19:81 20:85
1 1:76 2:77 3:77 4:76 5:78 6:75 7:73 8:64 9:68 10:65 11:80 12:78 13:91 14:88 15:93 16:100 17:79 18:79 19:82 20:83
1 1:78 2:78 3:73 4:71 5:75 6:75 7:61 8:58 9:57 10:56 11:82 12:73 13:81 14:74 15:74 16:80 17:100 18:85 19:80 20:85
1 1:81 2:85 3:79 4:80 5:82 6:82 7:63 8:56 9:55 10:57 11:82 12:72 13:81 14:79 15:83 16:79 17:85 18:100 19:83 20:79
1 1:76 2:77 3:78 4:75 5:76 6:79 7:65 8:57 9:57 10:63 11:81 12:87 13:84 14:81 15:81 16:82 17:80 18:83 19:100 20:87
1 1:76 2:76 3:78 4:73 5:75 6:78 7:60 8:59 9:51 10:57 11:82 12:80 13:86 14:82 15:85 16:83 17:85 18:79 19:87 20:100
Then, I write code to classify them:
% read the data set
[image_label, image_features] = libsvmread(fullfile('D:\...'));
[N D] = size(image_features);
% Determine the train and test index
trainIndex = zeros(N,1);
trainIndex(1:200) = 1;
testIndex = zeros(N,1);
testIndex(201:N) = 1;
trainData = image_features(trainIndex==1,:);
trainLabel = image_label(trainIndex==1,:);
testData = image_features(testIndex==1,:);
testLabel = image_label(testIndex==1,:);
% Train the SVM
model = svmtrain(trainLabel, trainData, '-c 1 -g 0.05 -b 1');
% Use the SVM model to classify the data
[predict_label, accuracy, prob_values] = svmpredict(testLabel, testData, model, '-b 1');
But the final result for predict_label are all class 1, so the accuracy is 50%, which that it cannot get the correct predict label for class 2 and 3.
Is there something wrong from the format of data, or the code that I implemented?
Please help me, thanks very much.
To elaborate a bit more about the problem, there are at least three problems here:
You just check one values of parameters C (c) and Gamma (g) - behaviour of SVM is heavily dependant on the good choice of these parameters, so it is a common approach to use a grid search using cross validation testing for selecting the best ones.
Data scale also plays an important role here, if some of the dimensions are much bigger then the rest, you will bias the whole classifier, in order to deal with it there are at least two basic approaches: 1. Scale linearly each dimension to some interval (like [0,1] or [-1,1]) or normalize the data by transformation through Sigma^(-1/2) where Sigma is a data covariance matrix
Label imbalance - SVM works best when you have exactly the same amount of points in each class. Once it is not true, you should use the class weighting scheme in order to get valid results.
After fixing these three issues you should get reasonable results.
My guess is that you'd want to tune your parameters.
Make a loop over your -c and -g values (typically logarithimically, eg -c 10^(-3:5) ) and pick the one that is best.
That said, it is advisable to normalize your data, eg. scale it such that all values are between 0 and 1.