degree=3
x<-c(0,2,4,8,11,14)
mypoly<-poly(x=x,degree=degree, simple = TRUE)
int<-rep(1/sqrt(6),6)
TSprime_poly<-cbind(int,mypoly)
TSprime_poly
int 1 2 3
[1,] 0.4082483 -0.5352015 0.519842695 -0.4427470
[2,] 0.4082483 -0.3705241 -0.004725843 0.3554442
[3,] 0.4082483 -0.2058467 -0.353194559 0.4815676
[4,] 0.4082483 0.1235080 -0.521832524 -0.2174819
[5,] 0.4082483 0.3705241 -0.186048965 -0.5258859
[6,] 0.4082483 0.6175402 0.545959194 0.3491029
based on these produced orthogonal polynomials, we refitted the model as below, and got all estimates normally:
> model_cubic <- '
i =~ 0.4082483*T1 + 0.4082483*T2 + 0.4082483*T3 + 0.4082483*T4 + 0.4082483*T5 + 0.4082483*T6
s =~ -0.5352015*T1 + -0.3705241*T2 + -0.2058467*T3 + 0.1235080*T4 + 0.3705241*T5 + 0.6175402*T6
q =~ 0.519842695*T1 + -0.004725843*T2 + -0.353194559*T3 + -0.521832524*T4 + -0.186048965*T5 + 0.545959194*T6
c =~ -0.4427470*T1 + 0.3554442*T2 + 0.4815676*T3 + -0.2174819*T4 + -0.5258859*T5 + 0.3491029*T6
+
+ '
> fit_cubic <- growth(model_cubic, data= data, sampling.weights="WEIGHT2")
however, the intercept after using orthogonal polynomials has changed to means across time, which is not what we were expected to explain. Based on the description shown below (P91, Hedeker & Gibbons, 2006), so we found these estimate parameters based on orthogonal polynomials could be translated to ones based on the original measured time that we would want to make interpretations:
.....translating parameters.....The parameters from a model using orthogonal polynomials can be directly related to those in the corresponding model that uses the original metric for time. One is simply a reexpressed or translated version of the other......
another question on coding of time, originally for ease of interpretation, we centred time to the first time points, from 3/5/7/11/14/17 to 0/2/4/8/11/14, but got 'optimizer problems', now with the use of orthogonal polynomials, we faced data transformations, and this seems a challenge for plotting trajectory as I do not know how to rescale back to original measured time. But recently, I saw someone used other strategies to code the time in growth models:
the original time is 0 months, 4 months, 36 months, 48 months.....Three LGM models were considered to specify the linear and non-linear growth components: (1) linear, (2) quadratic (non-linear), and (3) cubic (non-linear). In the linear model, the loadings of the latent intercept were fixed as 1 across four occasions, and the loadings for the linear change were fixed as 0, 0.3, 3, and 4 according to the time of measurement (i.e., the interval between T1 and T2 was four months; the interval between T2 and T3 was 32 months, and the interval between T3 and T4 was 12 months).....https://link.springer.com/article/10.1007/s10964-022-01727-w#Tab4
just wondering if it is suitable to recode the time above in my studies using such strategies which may reduce errors we came across: from 0/2/4/8/11/14 to 0/1/2/4/5.5/7
but I tried to this new coding strategy to fit the cubic model, and I got another error:
Warning message: In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, : lavaan WARNING: The variance-covariance matrix of the estimated parameters (vcov) does not appear to be positive definite! The smallest eigenvalue (= 3.935873e-13) is close to zero. This may be a symptom that the model is not identified.
With my limited knowledge, I do no really understand what this means, and what further suggestions could you please help make based on all the above descriptions.
Thank you very much.
Best,
Wenyuan
It would be helpful if you provide an example of the code
the orthogonal polynomials we used to model the trajectory of variables of interest are shown below:degree=3
x<-c(0,2,4,8,11,14)
mypoly<-poly(x=x,degree=degree, simple = TRUE)
int<-rep(1/sqrt(6),6)
TSprime_poly<-cbind(int,mypoly)
TSprime_poly
int 1 2 3
[1,] 0.4082483 -0.5352015 0.519842695 -0.4427470
[2,] 0.4082483 -0.3705241 -0.004725843 0.3554442
[3,] 0.4082483 -0.2058467 -0.353194559 0.4815676
[4,] 0.4082483 0.1235080 -0.521832524 -0.2174819
[5,] 0.4082483 0.3705241 -0.186048965 -0.5258859
[6,] 0.4082483 0.6175402 0.545959194 0.3491029
based on these produced orthogonal polynomials, we refitted the model as below, and got all estimates normally:
> model_cubic <- ' i =~ 0.4082483*T1 + 0.4082483*T2 + 0.4082483*T3 + 0.4082483*T4 + 0.4082483*T5 + 0.4082483*T6
s =~ -0.5352015*T1 + -0.3705241*T2 + -0.2058467*T3 + 0.1235080*T4 + 0.3705241*T5 + 0.6175402*T6
q =~ 0.519842695*T1 + -0.004725843*T2 + -0.353194559*T3 + -0.521832524*T4 + -0.186048965*T5 + 0.545959194*T6
c =~ -0.4427470*T1 + 0.3554442*T2 + 0.4815676*T3 + -0.2174819*T4 + -0.5258859*T5 + 0.3491029*T6 + + ' > fit_cubic <- growth(model_cubic, data= data, sampling.weights="WEIGHT2")
however, the intercept after using orthogonal polynomials has changed to means across time, which is not what we were expected to explain