Increasing the number of iterations in GeneralizedLinearModel.fit
조회 수: 10 (최근 30일)
이전 댓글 표시
Dear Experts,
I am fitting a matrix of predictors (desmat) to a timeseries (ts) and to do it I use a GeneralizedLinearModel object as follows:
m = GeneralizedLinearModel.fit(desmat, ts);
However, I often get the following warning:
Warning: Iteration limit reached.
> In glmfit (line 332)
In GeneralizedLinearModel/postFit (line 605)
In classreg.regr.FitObject/doFit (line 95)
In GeneralizedLinearModel.fit (line 887)
I have to use GeneralizedLinearModel.fit instead of glmfit because I am also running some contrasts between the model parameters down the line.
My question is this: how can I increase the number of maximum iterations in this fit method, so I can try to make my model converge? Alternatively, is there a way to do a contrast of coefficients that returns p-values using the glmfit function?
Thank you very much,
Leonardo Tozzi
댓글 수: 0
답변 (1개)
Aditya Patil
2021년 5월 13일
As per my understanding, you want to get the p values from the fitted model. You can use fitglm for this purpose. You can increase the iterations using the MaxIter option.
load hospital
dsa = hospital;
modelspec = 'Smoker ~ Age*Weight*Sex - Age:Weight:Sex';
mdl = fitglm(dsa,modelspec,'Distribution','binomial','Options',statset('MaxIter',1000))
참고 항목
카테고리
Help Center 및 File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!