Comments (4)
Thanks for the report -- do I understand correctly that things work fine so long as everything was fit with the latest version, but the latest version of ctKalman does not play nicely with fit objects from earlier ctsem versions? If that's the case then I don't think I can fix this, but in at least some cases like this the ctFitUpdate function is helpful for bringing an older fit object in line with newer version internals.
from ctsem.
Hi Charles,
Looked into it a bit more, ctKalman does not play nicely with fits from the later versions either. Here is a reproducible example using the chicken data from the readme (Note the problem happens when the chicken id does not map directly to the numeric id map). Again, I think this issue is caused by the numeric column selection mentioned above.
`library(data.table)
library(mltools)
library(ctsem)
Runs Fine
chickdata <- one_hot(as.data.table(ChickWeight),cols = 'Diet')
chickdata$weight <- scale(chickdata$weight)
m <- ctModel(
LAMBDA=diag(1), #Factor loading matrix of latent processes on measurements, fixed to 1
type = 'stanct', #Could specify 'standt' here for discrete time.
tipredDefault = FALSE, #limit covariate effects on parameters to those explicitly specified
manifestNames='weight', #Observed measurements of the latent processes
latentNames='Lweight', #Names here simply make parameters and plots more interpretable
TIpredNames = paste0('Diet_',2:4), #Covariates, in this case one category needs to be baseline...
DRIFT='a11 | param', #normally self feedback (diagonal drift terms) are restricted to negative
MANIFESTMEANS=0, #For identification CINT is normally zero with this freely estimated
CINT='cint ||||Diet_2,Diet_3,Diet_4', #diet covariates specified in 5th 'slot' (four '|' separators)
time='Time',
id='Chick')
f <- ctStanFit(chickdata,m,nopriors=FALSE)
ctKalman(f,plot=TRUE,subjects=2:4,kalmanvec=c('yprior','ysmooth'))
Breaks if the chicks have character ids
chickdata <- one_hot(as.data.table(ChickWeight),cols = 'Diet')
chickdata$weight <- scale(chickdata$weight)
chickdata$Chick <- paste0(chickdata$Chick, "a") # Create Chick character id
m <- ctModel(
LAMBDA=diag(1), #Factor loading matrix of latent processes on measurements, fixed to 1
type = 'stanct', #Could specify 'standt' here for discrete time.
tipredDefault = FALSE, #limit covariate effects on parameters to those explicitly specified
manifestNames='weight', #Observed measurements of the latent processes
latentNames='Lweight', #Names here simply make parameters and plots more interpretable
TIpredNames = paste0('Diet_',2:4), #Covariates, in this case one category needs to be baseline...
DRIFT='a11 | param', #normally self feedback (diagonal drift terms) are restricted to negative
MANIFESTMEANS=0, #For identification CINT is normally zero with this freely estimated
CINT='cint ||||Diet_2,Diet_3,Diet_4', #diet covariates specified in 5th 'slot' (four '|' separators)
time='Time',
id='Chick')
f <- ctStanFit(chickdata,m,nopriors=FALSE)
ctKalman(f,plot=TRUE,subjects=2:4,kalmanvec=c('yprior','ysmooth')) `
from ctsem.
I see, thanks a lot. It's not 'strictly' an error but rather just poor coding practice re backwards compatibility -- in the 2nd example, you really need to specify subjects=c('2a',3a','4a')
, but that doesn't match up with earlier versions so I've pushed a fix that allows both specifications (and warns if integers are used when realid=TRUE
, which is the default)
from ctsem.
This happens when I use model objects fit with older versions of ctsem. Maybe the id mapping changed? Instead of selecting by column number maybe it should be by column name.
from ctsem.
Related Issues (14)
- R CMD check failure with rstan 2.13.2 HOT 4
- ctstantestfit.rda is causing an installation failure with next StanHeaders HOT 39
- Error when specyfing subjects in ctStanDiscretePars HOT 25
- How can I see the p value HOT 1
- plot.ctStanFit error when plotting posterior densities HOT 3
- ctStanSubjectPars(..., pointest = FALSE) HOT 1
- browser() in sgd HOT 4
- unable to update ctsem HOT 6
- Broken Vignette Manual's Citations? HOT 2
- stan_checkdivergences gives error HOT 2
- Infinite Error Printing - sh: findstr: command not found HOT 4
- 32-bit builds of cstem fail on Launchpad HOT 1
- Remove hard coding of ID column HOT 2
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 ctsem.