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

error when applying weight function to ins() #29

Open
agstone90 opened this issue Jan 29, 2021 · 0 comments
Open

error when applying weight function to ins() #29

agstone90 opened this issue Jan 29, 2021 · 0 comments

Comments

@agstone90
Copy link

Hi Dr. Rizopoulos,

I am having trouble getting the standard normal density function from your book to work with the DerivSplines and was wondering if I need to adapt it in some way. I am currently using
<

g <- function(u, pow = 0) {
f <- function(t) integrate(function(s) s^pow * dnorm(t - s), 0, t)$value
sapply(u, f)
}
iform_cew<-list(fixed=-1+I(g(time))+
ins(time,knots=3,weight.fun =g)+
I(g(time)*(cov)),
indFixed=1:5,
random=
-1+I(g(time))+I(g(time,1)),indRandom=1:2)

corresponding to lme object with code
<

lmefit<-lme(longvar~ns(time,3)+cov,random=~time|ID,
data=data,control=lmeControl(opt="optim"))

Running the model with this derivForm returns an error: "Error in integrate(function(s) s^pow * dnorm(t - s), 0, t) :
evaluation of function gave a result of wrong length
In addition: Warning messages:
1: In s^pow :
longer object length is not a multiple of shorter object length
2: In s^pow * dnorm(t - s) :
longer object length is not a multiple of shorter object length"

I haven't been able to find any sample syntax for applying weighting functions to splines for JM and would appreciate any guidance. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant