Displaying 1 result from an estimated 1 matches for "sdkern".
2003 Sep 03
2
lme in R and Splus
...ints
mm <- 7 # number of support sites for x(s)
# create sites s
ss <- seq(1,10,length=nn)
# create the data y
e1 <- rnorm(nn,sd=0.1)
e2 <- cos(ss/10*2*pi*4)*.2
yy <- sin(ss/10*2*pi)+e2+e1
plot(ss,yy)
# locations of support points
ww <- seq(1-2,10+2,length=mm)
# width of kernel
sdkern <- 2
# create the matrix KK
KK <- matrix(NA,ncol=mm,nrow=nn)
for(ii in 1:mm){
KK[,ii] <- dnorm(ss,mean=ww[ii],sd=sdkern)
}
# create a dataframe to hold the data
df1 <- data.frame(y=yy,K=KK,sub=1)
df1$sub <- as.factor(df1$sub)
# now fit a mixed model using lme
a1 <- lme(fixed= y...