Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NMreadExt was incorrectly calculating blocksize for OMEGAs, I proposed a fix #50

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions R/NMreadExt.R
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,16 @@ NMreadExt <- function(file,return,as.fun,modelname,col.model,auto.ext,tableno="m
## est is just a copy of value for backward compatibility
pars[,est:=value]

### add OMEGA block information based on off diagonal values
tab.blocks <- rbind(pars[par.type%in%c("OMEGA","SIGMA"),.(par.type,i=i,j=j,value)],
pars[par.type%in%c("OMEGA","SIGMA"),.(par.type,i=j,j=i,value)])[
abs(value)>1e-9,.(iblock=min(i,j),blocksize=max(abs(j-i))+1),by=.(par.type,i)]
### add OMEGA block information based on off diagonal values
tab.i <- rbind(pars[par.type%in%c("OMEGA","SIGMA"),.(par.type,i=i,j=j,value)],
pars[par.type%in%c("OMEGA","SIGMA"),.(par.type,i=j,j=i,value)])[
# include i==j so that if an OMEGA is fixed to zero it is still assigned an iblock
i==j|abs(value)>1e-9,.(iblock=min(i,j)),by=.(par.type,i)]
tab.i[,blocksize:=.N,by=.(par.type,iblock)]

## pars0 <- copy(pars)
## tab.blocks
pars <- mergeCheck(pars,tab.blocks,by=cc(par.type,i),all.x=T,quiet=TRUE)
pars <- mergeCheck(pars,tab.i,by=cc(par.type,i),all.x=T,quiet=TRUE)

## pars[par.type%in%c("OMEGA","SIGMA"),.(i,j,iblock,blocksize,value)]

Expand Down
Loading