Library: | metrics |
See also: | redun makedesign |
Quantlet: | dpls | |
Description: | calculates latent variables, weights, loadings and path coefficients with dynamic partial least squares algorithm |
Usage: | {wg,b,sk,sdv,skl,slv,lk,iter} = dpls(w,d,dy,dl,y,lag,precis) | |
Input: | ||
w | l x k matrix, start weights | |
d | k x k matrix, inner unlagged designs (0 or 1), no diagonal values are allowed | |
dy | l x k matrix, outer designs (0 or 1) rows are counting manifest variables | |
dl | k x k matrix, inner lagged designs (0 or 1), the diagonal elements are showing autoregression | |
y | n x l matrix, manifest variables (indicators) | |
lag | scalar, lag order | |
precis | scalar, cancelling criterion | |
Output: | ||
wg | l x k matrix, weights | |
b | l x k matrix, loadings | |
sk | k x k matrix, path coefficients | |
sdv | k x k matrix, standard deviations of path coefficients | |
skl | k x k matrix, lagged path coefficients with the same dimension as d and ordered like designed | |
slv | k x k matrix, the standard deviations of the path coefficients | |
lk | n x k matrix, latent variables | |
iter | scalar, the number of iterations used |
randomize(13409) library("metrics") b1=0.3 c1=0.6 s=500 n1=normal(s+1) n1lag=n1[1:s,] n1=n1[2:rows(n1),] ;innermodel n2=b1*n1+c1*n1lag+normal(rows(n1))/5 n=n1~n2 nn=n./sqrt(var(n)) ;loadingsmatrix p=(1|2|3|4|0|0|0)~(0|0|0|0|5|6|7) y=nn*p'+normal(rows(n),rows(p))/8 d=(0|1)~(0|0) dl=(0|1)~(0|0) w=(1|1|1|1|0|0|0)~(0|0|0|0|1|1|1) myfit=dpls(w,d,w,dl,y,1,3) myfit.wg myfit.b myfit.sk myfit.skl myfit.iter
Contents of wg [1,] 0.032821 0 [2,] 0.066113 0 [3,] 0.099959 0 [4,] 0.13301 0 [5,] 0 0.045413 [6,] 0 0.054268 [7,] 0 0.063904 Contents of b [1,] 0.9967 0 [2,] 2.0131 0 [3,] 3.005 0 [4,] 4.0134 0 [5,] 0 5.0093 [6,] 0 5.9997 [7,] 0 6.9937 Contents of sk [1,] 0 0 [2,] 0.423 0 Contents of skl [1,] 0 0 [2,] 0.856 0 Contents of iter [1,] 2