--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+unsubscribe@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.
Error: p == round(p, 0) is not TRUE
library(readxl)df.full.sem <- read_excel("BDAMOS.xls", sheet = "Warren")df.full.sem
lower <- df.full.sem[2:9,3:10]lower=as.matrix(lower)library(lavaan)wheaton.cov <- getCov(lower, names = c("P1","P2","C1","C2","V1","V2","S1","S2"), diagonal = F)
Hi Jorge,Are you sure the attached is a correlation matrix? The diagonals are not 1.If you don't have the standard deviations, I don't know how you can get a covariance matrix. However, you could just treat your correlation matrix as a covariance matrix, because a correlation matrix is a covariance matrix.
On Thu, May 31, 2018 at 10:15 AM, Jorge Sinval <jorge...@gmail.com> wrote:
Hello!
I have this database with the correlation matrix, n, and means, how can I import it to lavaan? I saw the function getCov(), and the cor2cov, although I have no std...Thanks.
--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.
lower <- df.full.sem[2:9,3:10]lower=as.matrix(lower)
lower <- df.full.sem[lower.tri(df.full.sem)]
library(readxl)df.full.sem <- read_excel("BDAMOS.xls", sheet = "Warren")
mean.wwf=as.numeric(df.full.sem[10,3:10])
df.full.sem=as.matrix(df.full.sem[2:9,3:10])
rownames(df.full.sem) = c("P1","P2","C1","C2","V1","V2","S1","S2")colnames(df.full.sem)=rownames(df.full.sem)
model.wwf='performance =~ P1 + P2knowledge =~ C1 + C2value =~ V1 + V2satisfaction =~ S1 + S2performance ~ knowledge+value+satisfaction'
fit.model.wwf=sem(model.wwf, sample.cov = df.full.sem, sample.nobs = 98, sample.mean =mean.wwf)
--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+unsubscribe@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.
This would have also worked because we remove these non-standard tibbles …
library(readxl)
df.full.sem <- read_excel("BDAMOS.xls", sheet = "Warren")
df.full.sem <- data.frame(df.full.sem)
df.mat <- df.full.sem[2:9,3:10]
wheaton.cov <- getCov(df.mat[lower.tri(df.mat, diag = TRUE)],
names = c("P1","P2","C1","C2","V1","V2","S1","S2"), diagonal= TRUE)
wheaton.cov
df.full.sem=as.matrix(df.full.sem[2:9,3:10])
P1 P2 C1 C2 V1 V2 S1 S2
[1,] 0.0271 NA NA NA NA NA NA NA
[2,] 0.0172 0.0222 NA NA NA NA NA NA
[3,] 0.0219 0.0193 0.0876 NA NA NA NA NA
[4,] 0.0164 0.0130 0.0317 0.0568 NA NA NA NA
[5,] 0.0284 0.0294 0.0383 0.0151 0.1826 NA NA NA
[6,] 0.0217 0.0185 0.0356 0.0230 0.0774 0.1473 NA NA
[7,] 0.0083 0.0011 -0.0001 0.0055 -0.0087 -0.0069 0.1137 NA
[8,] 0.0074 0.0015 0.0035 0.0089 -0.0007 -0.0088 0.0722 0.1024
lower=df.full.sem[lower.tri(df.full.sem, diag = TRUE)]cov.wff=getCov(lower, names=c("P1","P2","C1","C2","V1","V2","S1","S2"))
P1 P2 C1 C2 V1 V2 S1 S2
P1 0.0271 0.0172 0.0164 0.0083 0.0130 0.0876 0.0568 -0.0087
P2 0.0172 0.0219 0.0284 0.0074 0.0294 0.0317 0.0151 -0.0007
C1 0.0164 0.0284 0.0217 0.0222 0.0185 0.0383 0.0230 0.1473
C2 0.0083 0.0074 0.0222 0.0193 0.0011 0.0356 0.0055 -0.0069
V1 0.0130 0.0294 0.0185 0.0011 0.0015 -0.0001 0.0089 -0.0088
V2 0.0876 0.0317 0.0383 0.0356 -0.0001 0.0035 0.1826 0.1137
S1 0.0568 0.0151 0.0230 0.0055 0.0089 0.1826 0.0774 0.0722
S2 -0.0087 -0.0007 0.1473 -0.0069 -0.0088 0.1137 0.0722 0.1024
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+unsubscribe@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.
fit.model.wwf=sem(model.wwf, sample.cov = wheaton.cov, sample.nobs = 98, sample.mean =mean.wwf)
Error in lav_samplestats_icov(COV = cov[[g]], ridge = ridge, x.idx = x.idx[[g]], : lavaan ERROR: sample covariance matrix is not positive-definite
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.
df.full.sem <- read_excel("BDAMOS.xls", sheet = "Warren")
lower <- df.full.sem[2:9,3:10]
--
You received this message because you are subscribed to a topic in the Google Groups "lavaan" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lavaan/2S8Wuu_qO74/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lavaan+un...@googlegroups.com.