0
Q:

predict in r

predict(object = your_model, newdata = your_test_data)
0
# Tmod, Tamb and GI are columns in the data frame data2
# Find the k coefficient to complete the equation
Model_Tmod <- nls(Tmod ~ Tamb + k * GI, data = data2, start=list(k=1))

k = coef(Model_Tmod)
And where ever there is an NA in Tmod column it gets filled with the predicted
data2$Tmod[is.na(data2$Tmod)] = data2$Tamb[is.na(data2$Tmod)] + k * data2$GI[is.na(data2$Tmod)]
0

New to Communities?

Join the community