glm - Loop in R to select lowest AIC for a statistical model -


I want to change the degree of independence and write a loop to get the AIC value for the following model for the following model , Such as DF = 2 in the definition of varknots1 .

I use random data here only because I do not know how to upload my data. I am trying to learn to write my own loop, however, I have not been successful in creating one at this time.

Library (DLN) Library (Splene) A = Rernerum (500) B = Rernmore (500) C = Rurnmore (500) d = rnorm (500) varknots1 & lt; - Equalnots (B, Fun = "BS", DF = 5, Degree = 2) lagknots1 & lt; - logknots (24, 3) CBT1 & lt; -crossbasis (b, interval = 24, argvar = list (fun = "bs", knot = varknots1), arglag = list (knots = lagknots1)) varknots2 & lt; - Equalnots (C, Fun = "BS", DF = 5, Degree = 2) lagknots2 & lt; - Lognots (24, 3) CBT2 - Envelope (24, 3) CB2 & lt; - Crossboys (c, lag = 24, asarwar = list (fun = "bs", knot = varknots2), arglog = list (knot = lagnets 2)) Model & lt; -lm A ~ cb1 + cb2 + D) AIC (Model)

  Aic & lt; - (in 1, 8) (v, 1, 8) (v, 1) 3) CB1 and lieutenant; -Crosabesis (B, lag = 24, Azerver = list (fun = "BS", knot = varknots1), Argal = list (knot = lignlot 1)) varknots2 & lt; - Equalnots (C, Fun = "BS", Df = (i + 2), Degree = 2) lagnetose 2 & lt; - Lognots (24, 3) CBS2 and Lt; - Crossbases (c, lag = 24, aswarvar = list (fun = "bs", knot = varknots2), arglog = list (knot = lagonautos 2)) aic [i] & lt; -aic (lm (a ~ cb1 + cb2 + d))}  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -