Predict the model outcome for a new set of data
predict.FKM.glm.Rd
Predict the model outcome for a new set of data by first fitting tensor-product splines to the new dataset and then identifying degree of cluster membership for the previously identified clusters.
Usage
# S3 method for FKM.glm
predict(object, newdata, ...)
Arguments
- object
An object of class
FKM.glm
found by modeling an outcome based on cluster membership degrees.- newdata
A new data containing the same variables clustered on and used as covariates in the model.
- ...
Additional arguments.
Value
A data frame containing the degree of cluster membership for each individual in the new dataset and predicted outcome.
Examples
# Fit initial model
data(TS.sim)
fitsplines <- TPSfit(TS.sim, vars=c("Var1", "Var2", "Var3"), time="Time",
ID="SubjectID", knots_time=c(0, 91, 182, 273, 365), n_fit_times=10)
clusters1 <- cluster.fitted(fitsplines, k=3, m=1.3, seed=12345, RS=5, noise=TRUE)
model <- FKM.glm(clusters1, TS.sim, y="outcome", covariates=c("x1", "x2"),
family="binomial")
# Get new dataset
data(TS.sim.new)
predicted <- predict(model, TS.sim.new)