Comments (16)
How can I reproduce this error?
Is it a public example?
from ggpmx.
It's personnal data previously analyzed with NONMEM (FOCEI and SAEM).
from ggpmx.
head(d3)
ID TIME DV GR AMT BSL EVID
1 1 7:30 0 1 27586 0 1
2 1 9:00 732 1 0 0 0
3 1 12:00 152 1 0 0 0
4 1 12:30 0 1 27586 0 1
5 1 14:00 701 1 0 0 0
6 1 16:00 452 1 0 0 0
one.cmt.ka <- function() {
ini({
tka <- 0.1 ; label("log KA")
tcl <- log(5) ; label("log Cl")
tv <- log(20) ; label("log V")
eta.ka ~ 0.1
eta.cl ~ 0.3
eta.v ~ 0.1
add.err <- 10
})
model({
cl <- exp(tcl + eta.cl)
v <- exp(tv + eta.v)
Ka <- exp(tka + eta.ka)
linCmt() ~ add(add.err)
})
}
fit_ka_focei <- nlmixr(one.cmt.ka, d3, est="focei",table = list(cwres=TRUE, npde=TRUE))
print(fit_ka_focei)
-- nlmixr FOCEi (outer: nlminb) fit --------------------------------------------
OBJF AIC BIC Log-likelihood Condition Number
FOCEi 4376.714 5050.512 5077.695 -2518.256 201.2068
-- Time (sec; fit_ka_focei$time): ----------------------------------------------
setup optimize covariance table npde other
elapsed 30.487 5.182 5.182 0.16 2.59 50.729
.../...
ctr <- pmx_nlmixr(fit_ka_focei)
Compiling model...done
Compiling VPC model...done
done (2.50 sec)
Error in pmx_nlmixr(fit_ka_focei) :
Cannot merge nlmixr fit with observation dataset
from ggpmx.
Can you show me the output of :
FIT <- as.data.frame(fit_ka_focei)
obs <- as.data.table(nlmixr::getData(fit_ka_focei))
## obs <- obs[!(EVID == 1 & MDV == 1)]
if (any(names(obs) == "EVID")) {
obs <- obs[EVID == 0 || EVID == 2]
} else if (any(names(obs) == "MDV")) {
obs <- obs[MDV == 0]
}
if (any(names(obs) == "ID")) {
obs$ID <- paste(obs$ID)
}
## Merge with DV too
no_cols <- setdiff(intersect(names(FIT), names(obs)), c("ID", "TIME"))
obs[, (no_cols) := NULL]
uID <- unique(FIT$ID)
obs <- subset(obs, ID %in% uID)
obs$ID <- factor(obs$ID, levels = levels(fit$ID))
FIT$ID <- factor(FIT$ID, levels = levels(fit$ID))
head(obs)
head(FIT)
from ggpmx.
obs$ID <- factor(obs$ID, levels = levels(FIT$ID))
FIT$ID <- factor(FIT$ID, levels = levels(FIT$ID))
head(obs)
Empty data.table (0 rows and 5 cols): ID,TIME,GR,AMT,BSL
head(FIT)
ID TIME DV EVID PRED RES WRES IPRED IRES IWRES CPRED CRES
1 1 2 152 0 0.0000 152.00000 0.016129525 0.0000 152.00000 0.60194368 0.0000 152.0000
2 1 4 701 0 568.3839 132.61614 0.014072601 685.2753 15.72470 0.06227228 564.9302 136.0698
3 1 5 452 0 357.2372 94.76279 0.010055782 463.6817 -11.68171 -0.04626139 344.1230 107.8770
4 1 13 732 0 360.5989 371.40110 0.039411338 468.0528 263.94715 1.04527184 347.2910 384.7090
5 2 1 184 0 0.0000 184.00000 0.019525215 0.0000 184.00000 0.72866866 0.0000 184.0000
6 2 2 69 0 0.0000 69.00000 0.007321955 0.0000 69.00000 0.27325075 0.0000 69.0000
CWRES eta.ka eta.cl eta.v rx1c cl v Ka depot
1 0.6019437 0.006593247 -0.2173521 0.007965366 0.0000 14.25946 6.774591 0.5891999 0.000
2 0.4383556 0.006593247 -0.2173521 0.007965366 685.2751 14.25946 6.774591 0.5891999 15303.912
3 0.3558046 0.006593247 -0.2173521 0.007965366 463.6817 14.25946 6.774591 0.5891999 8490.167
4 1.2648771 0.006593247 -0.2173521 0.007965366 468.0530 14.25946 6.774591 0.5891999 8566.344
5 0.7286687 -0.010607003 0.2939231 -0.006954881 0.0000 23.77645 6.674263 0.5791522 0.000
6 0.2732507 -0.010607003 0.2939231 -0.006954881 0.0000 23.77645 6.674263 0.5791522 0.000
central EPRED ERES NPDE
1 0.000 7.28364 144.7164 0.8479605
2 4642.459 831.64152 -130.6415 0.2540297
3 3141.254 569.40459 -117.4046 0.4447049
4 3170.868 412.81680 319.1832 1.3796618
5 0.000 27.64481 156.3552 -0.4891047
6 0.000 -200.28132 269.2813 0.9187177
from ggpmx.
It looks that the obs is empty due to a certain filter , can you run this please ? :
obs <- as.data.table(nlmixr::getData(fit_ka_focei))
head(obs)
if (any(names(obs) == "EVID")) {
obs <- obs[EVID == 0 || EVID == 2]
} else if (any(names(obs) == "MDV")) {
obs <- obs[MDV == 0]
}
head(obs)
uID <- unique(FIT$ID)
obs <- subset(obs, ID %in% uID)
head(obs)
from ggpmx.
Here it is
obs <- as.data.table(nlmixr::getData(fit_ka_focei))
head(obs)
ID TIME DV GR AMT BSL EVID
1: 1 7:30 0 1 27586 0 1
2: 1 9:00 732 1 0 0 0
3: 1 12:00 152 1 0 0 0
4: 1 12:30 0 1 27586 0 1
5: 1 14:00 701 1 0 0 0
6: 1 16:00 452 1 0 0 0
if (any(names(obs) == "EVID")) {
- obs <- obs[EVID == 0 || EVID == 2]
- } else if (any(names(obs) == "MDV")) {
- obs <- obs[MDV == 0]
- }
head(obs)
Empty data.table (0 rows and 7 cols): ID,TIME,DV,GR,AMT,BSL...
uID <- unique(FIT$ID)
Error in unique(FIT$ID) : object 'FIT' not found
obs <- subset(obs, ID %in% uID)
Error in ID %in% uID : object 'uID' not found
head(obs)
Empty data.table (0 rows and 7 cols): ID,TIME,DV,GR,AMT,BSL...
from ggpmx.
it should be fixed now. can reinstall ggPMX please.
from ggpmx.
from ggpmx.
from ggpmx.
from ggpmx.
amazing. very hard to debug without a reproducible data aset.
It looks that the obs is empty due to a certain filter , can you run this please ? :
Can you rerun this part to see what message do you have please?
obs <- as.data.table(nlmixr::getData(fit_ka_focei))
head(obs)
if (any(names(obs) == "EVID")) {
obs <- obs[EVID == 0 | EVID == 2]
} else if (any(names(obs) == "MDV")) {
obs <- obs[MDV == 0]
}
head(obs)
uID <- unique(FIT$ID)
obs <- subset(obs, ID %in% uID)
head(obs)
from ggpmx.
from ggpmx.
from ggpmx.
thank you for sending the code. But I don't see the data file in the attachment. You can send it by email (maintainer email)
from ggpmx.
close issue since no data was provided.
from ggpmx.
Related Issues (20)
- Use `readr::read_table()`
- Change `select()` usage
- Use `reframe()` intesad of `summarize()` or recast as data.table syntax
- Use `purr::map() + purr::exec()`
- Unknown error when creating controller HOT 2
- Make a `pmx_effects()` controller with documentation about what everything means AND more intuitive parameter names
- Remove captioner
- Too much white space for figures HOT 1
- Remove captioner for now (doesn't match match our internal standards)
- `use.title` = `FALSE`
- censoring defaults HOT 1
- Switch on/off sci notation for tables
- Conditionally include `nlmixr2`
- CRAN update
- Parameter table for Monolix 2013R1
- Observations Ignored in Individual Plots HOT 2
- No all plots using ggPMX and a Monolix project HOT 2
- CRAN package requirement.
- Bare theophylline controller creation call fails
- directory fixes for CRAN
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ggpmx.