Skip to content

Commit cda6feb

Browse files
fixes
1 parent b57549c commit cda6feb

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

R/models.R

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,12 @@ mmeaffinityNoRegul <- function(model, muhat, xtol_rel=1e-4, maxeval=1e5, tolIpfp
150150
maxeval=maxeval,
151151
print_level = print_level))
152152
# AffinityMatrix = matrix(res$solution,nrow=dX)
153+
if (resopt$status<0) {warning("nloptr convergence failed.")}
154+
#
153155
thetahat = resopt$solution
154156
ret =list(thetahat=thetahat,
155-
val=resopt$objective)
157+
val=resopt$objective,
158+
status = resopt$status)
156159
#
157160
return(ret)
158161
}
@@ -381,9 +384,12 @@ mme.TU_logit <- function(model, muhat, xtol_rel=1e-4, maxeval=1e5, print_level=
381384
thetahat = resopt$solution[(1+nbX*nbY):(nbParams+nbX*nbY)]
382385
V = matrix(kron %*% thetahat,nbX,nbY) - U
383386
#
387+
if (resopt$status<0) {warning("nloptr convergence failed.")}
388+
#
384389
ret =list(thetahat=thetahat,
385390
U=U, V=V,
386-
val=resopt$objective)
391+
val=resopt$objective,
392+
status = resopt$status)
387393
#
388394
return(ret)
389395
}
@@ -823,9 +829,12 @@ mme.TU_rum <- function(model, muhat, xtol_rel=1e-4, maxeval=1e5, print_level=0)
823829
thetahat = resopt$solution[(1+nbX*nbY):(nbParams+nbX*nbY)]
824830
V = matrix(kron %*% thetahat,nbX,nbY) - U
825831
#
832+
if (resopt$status<0) {warning("nloptr convergence failed.")}
833+
#
826834
ret =list(thetahat=thetahat,
827835
U=U, V=V,
828-
val=resopt$objective)
836+
val=resopt$objective,
837+
status = resopt$status)
829838
#
830839
return(ret)
831840
}

0 commit comments

Comments
 (0)