lisrelToR/0000755000176200001440000000000014560676205012204 5ustar liggesuserslisrelToR/NAMESPACE0000644000176200001440000000022614560561421013414 0ustar liggesusersexport(readLisrel) export(lisrelMatrix) S3method(print, lisrel) importFrom("utils", "read.table") # S3method(plot, lisrel) # S3method(summary, lisrel)lisrelToR/README.md0000644000176200001440000000031614560560641013457 0ustar liggesuserslisrelToR ========= This is an unofficial package aimed at automating the import of LISREL output in R. This package or its maintainer is not in any way affiliated with the creators of LISREL and SSI, Inc.lisrelToR/man/0000755000176200001440000000000014560560641012753 5ustar liggesuserslisrelToR/man/lisrelToR-package.Rd0000644000176200001440000000076014560560641016555 0ustar liggesusers\name{lisrelToR-package} \alias{lisrelToR-package} \alias{lisrelToR} \docType{package} \title{ Import LISREL output in R. } \description{ This is an unofficial package aimed at automating the import of LISREL output in R. This package or its maintainer is not in any way affiliated with the creators of LISREL and SSI, Inc. } \author{ Sacha Epskamp (mail@sachaepskamp.com) Maintainer: Sacha Epskamp } \references{ github.com/SachaEpskamp/lisrelToR } \keyword{ package }lisrelToR/man/readLisrel.Rd0000644000176200001440000000443214560561465015340 0ustar liggesusers\name{readLisrel} \alias{readLisrel} \title{ Read LISREL matrices into R } \description{ This function scans LISREL (Joreskog & Sorbom, 1996) output for model matrices and fit indices. } \usage{ readLisrel(x) } %- maybe also 'usage' for other objects documented here. \arguments{ \item{x}{ String indicating the location of a LISREL output file. } } \details{ \code{LisrelToR} uses the following names for the model matrices: \describe{ \item{LY}{ Lambda-Y matrix. } \item{PS}{ Psi matrix. } \item{BE}{ Beta matrix. } \item{TE}{ Theta-Epsilon matrix. } \item{TY}{ Tau-Y matrix. } \item{AL}{ Alpha matrix. } \item{LX}{ Lambda-X matrix. } \item{PH}{ Phi matrix. } \item{GA}{ Gamma matrix. } \item{TD}{ Theta-Delta matrix. } \item{TX}{ Tau-X matrix. } \item{KA}{ Kappa } \item{ObsCovs}{ The observed covariance matrix, or a list of such matrices for each group. } \item{ImpCovs}{ The implied covariance matrix, or a list of such matrices for each group. } } Furthermore, \code{lisrelToR} uses the following names for matrix types: \describe{ \item{est}{Parameter estimates} \item{se}{Standard errors} \item{t}{t-values} \item{parSpec}{Parameter numbers} } } \value{ A list of class \code{"lisrel"} contaning: \item{fitIndices}{Fit indices, currently not supported.} \item{matrices}{A list contaning the model matrices. For each group this list conains a list with for each matrix (using LISREL style naming, see details) a list contaning elements \code{est} for parameter estimates, \code{se} for standard errors, \code{t} for t-values and \code{parSpec} for parameter numbers. Use \code{\link{lisrelMatrix}} to extract the matrices.} \item{variables}{Currently not used.} \item{Covariances}{A list with elements \code{implied} and \code{observed} containing the implied and observed covariance matrices.} } \references{ Joreskog, K. G., & Sorbom, D. (1996). LISREL 8 user's reference guide. Scientific Software. } \author{ Sacha Epskamp } \examples{ ## Measurment invariance example: modFile <- system.file("extdata", "mi1.OUT", package = "lisrelToR") Lis <- readLisrel(modFile) # Extract Lambda-Y for group 2: lisrelMatrix(Lis,"LY", group = 2) # Structure of object: str(Lis) # Print full LISREL output to console: print(Lis) } \seealso{ \code{\link{lisrelMatrix}} }lisrelToR/man/methods.Rd0000644000176200001440000000125114560560641014704 0ustar liggesusers\name{lisrel-methods} \alias{print.lisrel} %\alias{plot.lisrel} %\alias{summary.lisrel} %- Also NEED an '\alias' for EACH other topic documented here. \title{ Methods for lisrel objects } \description{ Print method prints LISREL output file to the console, summary method returns RAM of parameter estimates as given by \code{semPlotModel} from the \code{semPlot} package and plot method calls \code{semPaths} from the \code{semPlot} package. } \usage{ \method{print}{lisrel}(x, \dots) } %- maybe also 'usage' for other objects documented here. \arguments{ \item{x}{ output of \code{\link{readLisrel}} } \item{\dots}{Not used} } \author{ Sacha Epskamp } lisrelToR/man/lisrelMatrix.Rd0000644000176200001440000000370114560561277015730 0ustar liggesusers\name{lisrelMatrix} \alias{lisrelMatrix} %- Also NEED an '\alias' for EACH other topic documented here. \title{ Extract LISREL matrices from \code{lisrel} object. } \description{ This function can be used to extract matrices from the output of \code{\link{readLisrel}}. } \usage{ lisrelMatrix(object, matrix, group = 1, type = "est") } %- maybe also 'usage' for other objects documented here. \arguments{ \item{object}{ A \code{"lisrel"} object obtained by \code{\link{readLisrel}}. } \item{matrix}{ Specification of the matrix to be extracted. See details. } \item{group}{ An integer specifying which group the matrix should be extracted from. } \item{type}{ Specification of the type of matrix to be extracted. } } \details{ \code{LisrelToR} uses the following names for the model matrices: \describe{ \item{LY}{ Lambda-Y matrix. } \item{PS}{ Psi matrix. } \item{BE}{ Beta matrix. } \item{TE}{ Theta-Epsilon matrix. } \item{TY}{ Tau-Y matrix. } \item{AL}{ Alpha matrix. } \item{LX}{ Lambda-X matrix. } \item{PH}{ Phi matrix. } \item{GA}{ Gamma matrix. } \item{TD}{ Theta-Delta matrix. } \item{TX}{ Tau-X matrix. } \item{KA}{ Kappa } \item{ObsCovs}{ The observed covariance matrix, or a list of such matrices for each group. } \item{ImpCovs}{ The implied covariance matrix, or a list of such matrices for each group. } } Furthermore, \code{lisrelToR} uses the following names for matrix types: \describe{ \item{est}{Parameter estimates} \item{se}{Standard errors} \item{t}{t-values} \item{parSpec}{Parameter numbers} } } \value{ A matrix. } \references{ Joreskog, K. G., & Sorbom, D. (1996). LISREL 8 user's reference guide. Scientific Software. } \author{ Sacha Epskamp } \seealso{ \code{\link{readLisrel}} } \examples{ ## Measurment invariance example: modFile <- system.file("extdata", "mi1.OUT", package = "lisrelToR") Lis <- readLisrel(modFile) # Extract Lambda-Y for group 2: lisrelMatrix(Lis,"LY", group = 2) } lisrelToR/DESCRIPTION0000644000176200001440000000102014560676205013703 0ustar liggesusersPackage: lisrelToR Type: Package Title: Import Output from LISREL into R Version: 0.3 Depends: R (>= 2.15.0) Author: Sacha Epskamp Maintainer: Sacha Epskamp Description: This is an unofficial package aimed at automating the import of LISREL output in R. This package or its maintainer is not in any way affiliated with the creators of LISREL and SSI, Inc. License: GPL-2 NeedsCompilation: no Packaged: 2024-02-07 01:59:22 UTC; sachaepskamp Repository: CRAN Date/Publication: 2024-02-07 12:50:13 UTC lisrelToR/NEWS0000644000176200001440000000140314560561527012701 0ustar liggesusersChanges in Version 0.3 o Help file examples no longer download files Changes in Version 0.2 o Fixed bugs with CIs and p-values included Changes in Version 0.1.4 o Fixed a bug with default names (ETA 1, VAR 3, etcetera) causing unexpected results. Changes in Version 0.1.3 o semPlot suggest removed to avoid the cyclic dependency behavior. o summary and plot method removed. Will be added in 'semPlot' in a future update. o Common metric standardization is now supported, although not yet documented. o Several bug fixes for large LISREL model with large lower triangle parameter estimate matrices. Changes in version 0.1.1 o 'paste0' calls have been replaced by 'paste' for backward compatibility. o Added plot and summary methods using 'semPlot'lisrelToR/R/0000755000176200001440000000000014560560641012401 5ustar liggesuserslisrelToR/R/methods.R0000644000176200001440000000074714560560641014177 0ustar liggesusers print.lisrel <- function(x, ...) { cat("\n",paste(x$output,collapse="\n"),"\n") } # # # Plot function from semPlot: # plot.lisrel <- function(x, ...) # { # if (!require("semPlot")) stop("Plot method requires 'semPlot' package to be installed") # semPaths(x, ...) # } # # # Summary function returns RAM: # summary.lisrel <- function(object, ...) # { # if (!require("semPlot")) stop("Summary method requires 'semPlot' package to be installed") # semPlotModel(object)@RAM # }lisrelToR/R/zzz.R0000644000176200001440000000053114560560641013360 0ustar liggesusers# I copied this piece of code from Lavaan mainly: .onAttach <- function(libname, pkgname) { version <- read.dcf(file=system.file("DESCRIPTION", package=pkgname), fields="Version") packageStartupMessage("This is ",paste(pkgname, version)) packageStartupMessage(pkgname, " is BETA software! Please report any bugs.") }lisrelToR/R/readLisrel.R0000644000176200001440000001103514560560641014612 0ustar liggesusersreadLisrel <- function(x) { # browser() # Read output: Out <- readLines(x) # Empty output structure (S3): Res <- list( fitIndices = list(), # list containing dataframes, 'global' and 'Group1'. 'Group2',... matrices = list( ), # List containing per matrix a list contaning 'est', 'par', 'se', 't' matrices variables = data.frame(), # data frame contaning information on each variable: manifest or latent and exo or endo. covariances = list( implied = NULL, # model Implied covariance matrix observed = NULL # observed covariance matrix ), output = Out ) class(Res) <- "lisrel" class(Res$matrices) <- c("list","semMatrixModel") ### Find linenumbers of output structure: Struc <- list( parSpec = grep("Parameter Specifications",Out), est = grep("LISREL Estimates",Out), fit = grep("Goodness of Fit Statistics",Out), modInd = grep("Modification Indices and Expected Change",Out), std = grep("Standardized Solution",Out), stdComp = grep("Completely Standardized Solution",Out), stdcommet = grep("Common Metric Standardized Solution",Out), stdcommetComp = grep("Common Metric Completely Standardized Solution",Out) ) Struc$std <- Struc$std[!Struc$std%in%c(Struc$stdComp,Struc$stdcommet,Struc$stdcommetComp)] Struc$stdComp <- Struc$stdComp[!Struc$stdComp%in%Struc$stdcommetComp] StrucUL <- unlist(Struc) ### Find linenumbers of matrices: Mats <- list( ObsCov = grep("^\\s*Covariance Matrix\\s*$",Out), ImpCov = grep("^\\s*Fitted Covariance Matrix\\s*$",Out), LX = grep("LAMBDA-X",Out), PH = grep("PHI",Out), TD = grep("THETA-DELTA",Out), GA = grep("GAMMA",Out), LY = grep("LAMBDA-Y",Out), PS = grep("PSI",Out), TE = grep("THETA-EPS",Out), BE = grep("BETA",Out), TX = grep("TAU-X",Out), TY = grep("TAU-Y",Out), AL = grep("ALPHA",Out), KA = grep("KAPPA",Out) ) Mats$ObsCov <- Mats$ObsCov[!Mats$ObsCov%in%Mats$ImpCov] # Check for continued matrices: for (i in 1:length(Mats)) { if (length(Mats[[i]])>0) { Inds <- lapply(Mats[[i]],matRange,Out=Out) Mats[[i]] <- Mats[[i]][!sapply(Mats[[i]],function(x)any(x>sapply(Inds,'[',1) & x<=sapply(Inds,'[',2)))] } } # Extract number of groups from parSpec matrices: Ng <- length(Struc$parSpec) ### EXTRACT MATRICES ### for (mat in c("LX","PH","TD","GA","TX","KA","LY","PS","TE","BE","TY","AL")) { Res$matrices[[mat]] <- list() for (g in Ng:1) { Res$matrices[[mat]][[g]] <- list() for (type in c("est","std","stdComp","stdcommet","stdcommetComp","parSpec")) { if (length(Struc[[type]])>0) { if (length(Struc[[type]])!=Ng) warning(paste("Number of",type,"matrices are not equal to number of parameter specification matrices. Resulting multigroup structure will NOT be reliable")) Res$matrices[[mat]][[g]][[type]] <- findMatrix(mat,type,Mats,Struc,Out,g) if (identical(Res$matrices[[mat]][[g]][[type]],"NextGroup")) { Res$matrices[[mat]][[g]][[type]] <- Res$matrices[[mat]][[g+1]][[type]] if (type=="est") { Res$matrices[[mat]][[g]][['se']] <- Res$matrices[[mat]][[g+1]][['se']] Res$matrices[[mat]][[g]][['t']] <- Res$matrices[[mat]][[g+1]][['t']] } } else if (type=="est" & is.list(Res$matrices[[mat]][[g]][[type]])) { Res$matrices[[mat]][[g]][['se']] <- Res$matrices[[mat]][[g]][[type]][['se']] Res$matrices[[mat]][[g]][['t']] <- Res$matrices[[mat]][[g]][[type]][['t']] Res$matrices[[mat]][[g]][[type]] <- Res$matrices[[mat]][[g]][[type]][['est']] } } } } names(Res$matrices[[mat]]) <- paste("group",seq_along(Res$matrices[[mat]]),sep="") } Res$covariances$implied <- findCov("ImpCov",Mats,Out) if (length(Res$covariances$implied)>0) names(Res$covariances$implied) <- paste("group",seq_along(Res$covariances$implied),sep="") Res$covariances$observed <- findCov("ObsCov",Mats,Out) if (length(Res$covariances$observed)>0) names(Res$covariances$observed) <- paste("group",seq_along(Res$covariances$observed),sep="") # # if (length(Struc$fit)==1) # { # Res$fitIndices$global <- findFit(Out,Struc$fit) # } else { # Res$fitIndices$global <- findFit(Out,Struc$fit[grep("Global",Out[Struc$fit])]) # for (g in 1:(length(Struc$fit)-1)) # { # Res$fitIndices[[paste("group",g,sep="")]] <- findFit(Out,Struc$fit[grep("Group",Out[Struc$fit])[g]]) # } # } # # Return: return(Res) } lisrelToR/R/matRange.R0000644000176200001440000000073014560560641014262 0ustar liggesusersmatRange <- function(start,lisName,Out) { if (grepl("IN THE FOLLOWING GROUP",Out[start])) return(c(start,start)) if (missing(lisName)) lisName <- gsub("(^\\s*)|(\\s*$)","",Out[start]) # Find end: IndEnd <- start repeat { IndEnd <- IndEnd + 1 if (length(Out)==IndEnd) break if (Out[IndEnd]=="" & !grepl(lisName,Out[IndEnd+1]) & !grepl(lisName,Out[IndEnd-1]) & !grepl(" Note:",Out[IndEnd-1],ignore.case=TRUE)) break } return(c(start,IndEnd)) }lisrelToR/R/findCov.R0000644000176200001440000000065114560560641014116 0ustar liggesusersfindCov <- function(mat,Mats,Out) { # Define LISREL name: if (mat=="ObsCov") lisName <- "Covariance Matrix" if (mat=="ImpCov") lisName <- "Fitted Covariance Matrix" Res <- list() if (length(Mats[[mat]]) > 0) { for (g in seq_along(Mats[[mat]])) { Inds <- matRange(Mats[[mat]][[g]],lisName,Out) Res[[g]] <- getMatrix(Out[Inds[1]:Inds[2]],lisName,TRUE,TRUE) } } return(Res) }lisrelToR/R/lisrelMatrix.R0000644000176200001440000000525414560560641015211 0ustar liggesuserslisrelMatrix <- function(object, matrix, group = 1, type = "est") { # Check class: if (!"lisrel"%in%class(object)) stop("Input must be a 'lisrel' object.") # Set defaults: if (missing(matrix)) { matrix <- names(object$matrices)[sapply(lapply(object$matrices,sapply,length),function(x)all(x>0))] } else { # Set matrix: matrix[grepl("lamb?d?a?.?x",matrix,ignore.case=TRUE)] <- "LX" matrix[grepl("lamb?d?a?.?y",matrix,ignore.case=TRUE)] <- "LY" matrix[grepl("phi",matrix,ignore.case=TRUE)] <- "PH" matrix[grepl("the?t?a?.?(y|eps)",matrix,ignore.case=TRUE)] <- "TE" matrix[grepl("the?t?a?.?(x|del)",matrix,ignore.case=TRUE)] <- "TD" matrix[grepl("gamm?a?",matrix,ignore.case=TRUE)] <- "GA" matrix[grepl("psi",matrix,ignore.case=TRUE)] <- "PS" matrix[grepl("bet?a?",matrix,ignore.case=TRUE)] <- "BE" matrix[grepl("tau.?x",matrix,ignore.case=TRUE)] <- "TX" matrix[grepl("tau.?y",matrix,ignore.case=TRUE)] <- "TY" matrix[grepl("alp?h?a?",matrix,ignore.case=TRUE)] <- "AL" matrix[grepl("kap?p?a?",matrix,ignore.case=TRUE)] <- "KA" if (any(grepl("lam?",matrix,ignore.case=TRUE))) { if (length(object$matrices$LX[[1]]) == 0 & length(object$matrices$LY[[1]]) > 0) { matrix[grepl("lam?",matrix,ignore.case=TRUE)] <- "LY" } else if (length(object$matrices$LX[[1]]) > 0 & length(object$matrices$LY[[1]])==0) { matrix[grepl("lam?",matrix,ignore.case=TRUE)] <- "LX" } else stop(paste("Matrix",grep("lam?",matrix,value=TRUE,ignore.case=TRUE),"could not be interpreted.")) } if (any(grepl("tau",matrix,ignore.case=TRUE))) { if (length(object$matrices$TX[[1]]) == 0 & length(object$matrices$TY[[1]]) > 0) { matrix[grepl("tau",matrix,ignore.case=TRUE)] <- "TY" } else if (length(object$matrices$TX[[1]]) > 0 & length(object$matrices$TY[[1]])==0) { matrix[grepl("tau",matrix,ignore.case=TRUE)] <- "TX" } else stop(paste("Matrix",grep("tau",matrix,value=TRUE,ignore.case=TRUE),"could not be interpreted.")) } if (any(grepl("thet?a?",matrix,ignore.case=TRUE))) { if (length(object$matrices$TD[[1]]) == 0 & length(object$matrices$TE[[1]]) > 0) { matrix[grepl("thet?a?",matrix,ignore.case=TRUE)] <- "TE" } else if (length(object$matrices$TD[[1]]) > 0 & length(object$matrices$TE[[1]])==0) { matrix[grepl("thet?a?",matrix,ignore.case=TRUE)] <- "TD" } else stop(paste("Matrix",grep("thet?a?",matrix,value=TRUE,ignore.case=TRUE),"could not be interpreted.")) } } Res <- lapply(object$matrices[matrix],function(x)x[[group]][[type]]) if (length(Res)==1) Res <- Res[[1]] return(Res) }lisrelToR/R/findMatrix.R0000644000176200001440000000224614560560641014635 0ustar liggesusersfindMatrix <- function(mat,type,Mats,Struc,Out,g) { StrucUL <- unlist(Struc) # Define LISREL name: if (mat=="LX") lisName <- "LAMBDA-X" if (mat=="PH") lisName <- "PHI" if (mat=="TD") lisName <- "THETA-DELTA" if (mat=="GA") lisName <- "GAMMA" if (mat=="LY") lisName <- "LAMBDA-Y" if (mat=="PS") lisName <- "PSI" if (mat=="TE") lisName <- "THETA-EPS" if (mat=="BE") lisName <- "BETA" if (mat=="TX") lisName <- "TAU-X" if (mat=="TY") lisName <- "TAU-Y" if (mat=="AL") lisName <- "ALPHA" if (mat=="KA") lisName <- "KAPPA" Res <- NULL if (length(Struc[[type]]) > 0 & length(Mats[[mat]]) > 0 & any(Mats[[mat]]>Struc[[type]][g])) { IndStart <- min(Mats[[mat]][Mats[[mat]]>Struc[[type]][g]]) if (!any(StrucUL[StrucUL > Struc[[type]][g]] < IndStart)) { # Checn equal next group" if (grepl(paste(lisName,"EQUALS",lisName,"IN THE FOLLOWING GROUP"),Out[IndStart])) { Res <- "NextGroup" } else { Inds <- matRange(IndStart,lisName,Out) # browser() Res <- getMatrix(Out[Inds[1]:Inds[2]],lisName,mat %in% c("TD","TE","PS","PH"),mat %in% c("TD","TE","PS","PH")) } } } return(Res) } lisrelToR/R/findFit.R0000644000176200001440000000115414560560641014110 0ustar liggesusersfindFit <- function(Out,start) { ### Extract fit statistics: IndStart <- start # Find end: IndEnd <- IndStart repeat { IndEnd <- IndEnd + 1 if (!(grepl("\\s*",Out[IndEnd]) | grepl("=",Out[IndEnd]))) break } modTxt <- Out[IndStart:IndEnd] modTxt <- modTxt[grepl("=",modTxt)] modTxt <- strsplit(modTxt,split="=") modTxt <- lapply(modTxt,gsub,pattern="^\\s*",replacement="") modTxt <- lapply(modTxt,gsub,pattern="\\s*$",replacement="") motTxt <- lapply(modTxt,function(x)c(x[1],paste(x[-1],collapse="="))) return(data.frame(Statstic=sapply(modTxt,"[",1),Value=sapply(modTxt,"[",2))) }lisrelToR/R/getMatrix.R0000644000176200001440000001502014560560641014466 0ustar liggesusersgetMatrix <- function(x,name,diag=FALSE,symmetrical=FALSE,estimates) { # browser() ### Fix default naming: x <- gsub("VAR (?=\\d)","VAR",x,perl=TRUE) x <- gsub("ETA (?=\\d)","ETA",x,perl=TRUE) x <- gsub("KSI (?=\\d)","KSI",x,perl=TRUE) xorig <- x # Make similar to readLines if length==1: if (length(x)==1) x <- strsplit(x,split="\n")[[1]] # Check if estimate matrix: if (missing(estimates)) { estimates <- any(grepl("\\(",x)) } if (estimates) { # First append spaces to every line: maxSpace <- max(nchar(x)) for (i in seq_along(x)) { x[i] <- paste(x[i],paste(rep(" ",maxSpace - nchar(x[i])), collapse=""), sep = "") } # Loop over lines, check if one contains "- -" and the next a bracket, and fill in "- -" signs for (i in which(grepl("- -",x[-length(x)]) & grepl("\\(",x[-1]))) { emLocs <- gregexpr("- -",x[i])[[1]] for (j in 1:length(emLocs)) { substring(x[i+1],emLocs[j],emLocs[j]+2) <- "- -" substring(x[i+2],emLocs[j],emLocs[j]+2) <- "- -" # Check if CI is included (new LISREL verson) and add more: if (grepl(";",x[i+1])){ substring(x[i+3],emLocs[j],emLocs[j]+2) <- "- -" substring(x[i+4],emLocs[j],emLocs[j]+2) <- "- -" substring(x[i+5],emLocs[j],emLocs[j]+2) <- "- -" } } } } # Remove leading and trailing spaces: x <- gsub("^\\s+","",x) x <- gsub("\\s+$","",x) # Remove empty lines: x <- x[x!=""] # Normalize spacing: # x <- gsub("\\s+"," ",x) # Make "- -" NA: x <- gsub("- -","NA",x) # Identify start of submatrices: sub <- grep(name,x) # Extract submatrices: X <- list() for (i in seq_along(sub)) { if (i1) { if (missing(symmetrical)) symmetrical <- TRUE totR <- nrow(Tabs[[1]]) for (i in 2:length(Tabs)) { Tabs[[i]] <- rbind(matrix(NA,totR-nrow(Tabs[[i]]),ncol(Tabs[[i]])),Tabs[[i]]) if (estimates) { seTabs[[i]] <- rbind(matrix(NA,totR-nrow(seTabs[[i]]),ncol(seTabs[[i]])),seTabs[[i]]) tTabs[[i]] <- rbind(matrix(NA,totR-nrow(tTabs[[i]]),ncol(tTabs[[i]])),tTabs[[i]]) # Xse[[i]] <- c(rep(paste(rep(NA,ncol(Tabs[[i]])),collapse=" "),totR-length(Xse[[i]])),Xse[[i]]) # Xt[[i]] <- c(rep(paste(rep(NA,ncol(Tabs[[i]])),collapse=" "),totR-length(Xt[[i]])),Xt[[i]]) } } } # Combine: Tab <- as.matrix(do.call(cbind,Tabs)) rownames(Tab) <- rowNames if (!any(dim(Tab)==1)) diag <- FALSE # Diagonalize: if (diag) { nm <- colnames(Tab) Tab <- diag(c(Tab),length(Tab),length(Tab)) rownames(Tab) <- colnames(Tab) <- nm } # Symmetrize: if (symmetrical) { Tab[upper.tri(Tab)] <- t(Tab)[upper.tri(Tab)] } Tab[is.na(Tab)] <- 0 # Compute SE and t-value matrices if needed: if (estimates) { # seTabs <- lapply(Xse,function(txt)as.matrix(read.table(text=txt,header=TRUE,fill=TRUE))) seTab <- do.call(cbind,seTabs) # tTabs <- lapply(Xt,function(txt)as.matrix(read.table(text=txt,header=TRUE,fill=TRUE))) tTab <- do.call(cbind,tTabs) # Diagonalize: if (diag) { seTab <- diag(c(seTab),length(seTab),length(seTab)) tTab <- diag(c(tTab),length(tTab),length(tTab)) } colnames(seTab) <- colnames(tTab) <- colnames(Tab) rownames(seTab) <- rownames(tTab) <- rownames(Tab) # Symmetrize: if (symmetrical) { seTab[upper.tri(seTab)] <- t(seTab)[upper.tri(seTab)] tTab[upper.tri(tTab)] <- t(tTab)[upper.tri(tTab)] } # Return list: return(list(est=Tab,se=seTab,t=tTab)) } # Return matrix: return(Tab) } lisrelToR/MD50000644000176200001440000000154214560676205012516 0ustar liggesusersd0791c3620eb41f8cef5e42a45c2617b *DESCRIPTION 62dc2ef54df827298b916a0c6303b3f3 *NAMESPACE 6dec5700dc366dd00f01c3d01beeae05 *NEWS 1594fe2761635b6b88ae7874d512b690 *R/findCov.R 3e24e4007bc4933ee3abf3087da76e4a *R/findFit.R b4a71f03b5492f5ac01d0726845a2140 *R/findMatrix.R 38d49b1dfde5825edcde8cf1f0a22805 *R/getMatrix.R 3a93c4b61a5c21be5707007fa66d0bdc *R/lisrelMatrix.R ab0c8788239cbb49eb6d96cc6d8584e2 *R/matRange.R 528aca9870d62375c05f38ba45a80cf4 *R/methods.R cfccb381e11cd2f7ab03e87a7bbb61f5 *R/readLisrel.R 8e878ca6e62bc94869ac46313cc32326 *R/zzz.R 674b1932685f6dea47a525a3a4cd5c46 *README.md 5fe2599ac6548eee369f36ae86e6a456 *inst/extdata/mi1.OUT 4ee72827a013320e9a342dca42695c54 *man/lisrelMatrix.Rd 08b086ffc986ff7316457be6554fa097 *man/lisrelToR-package.Rd 93f933ddd3c0f83a01aadbd78263a159 *man/methods.Rd b636b3b8a67787fe0e511145aa2f3f4a *man/readLisrel.Rd lisrelToR/inst/0000755000176200001440000000000014560561256013160 5ustar liggesuserslisrelToR/inst/extdata/0000755000176200001440000000000014560561256014612 5ustar liggesuserslisrelToR/inst/extdata/mi1.OUT0000644000176200001440000004221314560561161015666 0ustar liggesusers DATE: 11/26/2012 TIME: 14:11 L I S R E L 9.10 (STUDENT) BY Karl G. Jöreskog & Dag Sörbom This program is published exclusively by Scientific Software International, Inc. http://www.ssicentral.com Copyright by Scientific Software International, Inc., 1981-2012 Use of this program is subject to the terms specified in the Universal Copyright Convention. The following lines were read from file C:\Users\Sacha\Documents\lisrel\mi1.lis: title groups da No=1868 ni=4 ng=2 cm sy 8.24 2.84 8.47 3.54 3.24 9.06 2.55 2.40 2.86 9.36 Me 10.41 10.37 10.73 10.41 la pc pa oa ma mo ly=fu,fr ps=sy,fr te=sy,fr ne=1 ny=4 ty=fu,fr al=fu,fi le perfIQ pa ly 0 2 3 4 ma ly 1 0 0 0 ma al 0 pa ps 1 pa te 1 0 1 0 0 1 0 0 0 1 ! pa ty ! 21 22 23 24 ou groups Number of Input Variables 4 Number of Y - Variables 4 Number of X - Variables 0 Number of ETA - Variables 1 Number of KSI - Variables 0 Number of Observations 305 Number of Groups 2 title N=305 Group 2 da no=305 ni=4 cm sy 9.18 3.40 9.18 4.39 3.68 8.76 3.51 3.12 1.81 10.37 Me 8.12 8.10 7.89 8.39 la pc pa oa ma mo ly=fu,fr ps=sy,fr te=sy,fr ne=1 ny=4 ty=in al=fu,fr ! note ty=in le perfIQ pa ly 0 2 3 4 ma ly 1 0 0 0 ma al -2 pa al ! estimate the mean in group 2. this parameter is the mean difference! 1 pa te 1 0 1 0 0 1 0 0 0 1 ! pa ty ! i used ty=in on the mo line. parameter number is an alternative ! 21 22 23 24 ou mi title N=305 Group 2 Number of Input Variables 4 Number of Y - Variables 4 Number of X - Variables 0 Number of ETA - Variables 1 Number of KSI - Variables 0 Number of Observations 305 Number of Groups 2 groups Covariance Matrix pc pa oa ma -------- -------- -------- -------- pc 8.240 pa 2.840 8.470 oa 3.540 3.240 9.060 ma 2.550 2.400 2.860 9.360 Total Variance = 35.130 Generalized Variance = 3453.917 Largest Eigenvalue = 17.538 Smallest Eigenvalue = 5.085 Condition Number = 1.857 Means pc pa oa ma -------- -------- -------- -------- 10.410 10.370 10.730 10.410 title N=305 Group 2 Covariance Matrix pc pa oa ma -------- -------- -------- -------- pc 9.180 pa 3.400 9.180 oa 4.390 3.680 8.760 ma 3.510 3.120 1.810 10.370 Total Variance = 37.490 Generalized Variance = 3827.891 Largest Eigenvalue = 19.362 Smallest Eigenvalue = 4.152 Condition Number = 2.159 Means pc pa oa ma -------- -------- -------- -------- 8.120 8.100 7.890 8.390 groups Parameter Specifications LAMBDA-Y EQUALS LAMBDA-Y IN THE FOLLOWING GROUP PSI perfIQ -------- 4 THETA-EPS pc pa oa ma -------- -------- -------- -------- 5 6 7 8 TAU-Y EQUALS TAU-Y IN THE FOLLOWING GROUP title N=305 Group 2 Parameter Specifications LAMBDA-Y perfIQ -------- pc 0 pa 1 oa 2 ma 3 PSI perfIQ -------- 13 THETA-EPS pc pa oa ma -------- -------- -------- -------- 14 15 16 17 TAU-Y pc pa oa ma -------- -------- -------- -------- 9 10 11 12 ALPHA perfIQ -------- 18 groups Number of Iterations = 7 LISREL Estimates (Maximum Likelihood) LAMBDA-Y EQUALS LAMBDA-Y IN THE FOLLOWING GROUP Covariance Matrix of ETA perfIQ -------- 3.210 PSI perfIQ -------- 3.210 (0.477) 6.728 THETA-EPS pc pa oa ma -------- -------- -------- -------- 5.088 5.787 5.150 7.311 (0.542) (0.570) (0.584) (0.658) 9.393 10.158 8.817 11.109 Squared Multiple Correlations for Y - Variables pc pa oa ma -------- -------- -------- -------- 0.387 0.321 0.429 0.213 TAU-Y EQUALS TAU-Y IN THE FOLLOWING GROUP Log-likelihood Values Estimated Model Saturated Model --------------- --------------- Number of free parameters(t) 18 14 -2ln(L) 7448.841 7428.988 AIC (Akaike, 1974)* 7484.841 7456.988 BIC (Schwarz, 1978)* 7564.254 7518.753 *LISREL uses AIC= 2t - 2ln(L) and BIC = tln(N)- 2ln(L) Group Goodness of Fit Statistics Contribution to Chi-Square 6.075 Percentage Contribution to Chi-Square 30.601 Root Mean Square Residual (RMR) 0.0661 Standardized RMR 0.00754 Goodness of Fit Index (GFI) 1.00 groups Modification Indices and Expected Change Modification Indices for LAMBDA-Y perfIQ -------- pc 0.047 pa 0.040 oa 0.033 ma 0.078 Expected Change for LAMBDA-Y perfIQ -------- pc -0.031 pa -0.021 oa 0.022 ma 0.029 No Non-Zero Modification Indices for PSI Modification Indices for THETA-EPS pc pa oa ma -------- -------- -------- -------- pc - - pa 0.107 - - oa 0.009 0.000 - - ma - - 0.030 0.013 - - Expected Change for THETA-EPS pc pa oa ma -------- -------- -------- -------- pc - - pa -0.146 - - oa 0.047 -0.003 - - ma - - 0.079 0.053 - - Modification Indices for TAU-Y pc pa oa ma -------- -------- -------- -------- 2.641 0.005 1.599 0.258 Expected Change for TAU-Y pc pa oa ma -------- -------- -------- -------- -0.091 -0.004 0.067 0.039 No Non-Zero Modification Indices for ALPHA title N=305 Group 2 Number of Iterations = 7 LISREL Estimates (Maximum Likelihood) LAMBDA-Y perfIQ -------- pc 1.000 pa 0.923 (0.070) 13.097 oa 1.098 (0.077) 14.253 ma 0.784 (0.071) 11.064 Covariance Matrix of ETA perfIQ -------- 3.693 Mean Vector of Eta-Variables perfIQ -------- -2.469 PSI perfIQ -------- 3.693 (0.530) 6.964 THETA-EPS pc pa oa ma -------- -------- -------- -------- 5.006 5.963 4.681 8.356 (0.543) (0.588) (0.564) (0.743) 9.215 10.147 8.302 11.242 Squared Multiple Correlations for Y - Variables pc pa oa ma -------- -------- -------- -------- 0.425 0.345 0.488 0.214 TAU-Y pc pa oa ma -------- -------- -------- -------- 10.500 10.374 10.663 10.371 (0.155) (0.155) (0.164) (0.157) 67.597 67.101 65.159 65.999 ALPHA perfIQ -------- -2.469 (0.209) -11.825 Log-likelihood Values Estimated Model Saturated Model --------------- --------------- Number of free parameters(t) 18 14 -2ln(L) 7448.841 7428.988 AIC (Akaike, 1974)* 7484.841 7456.988 BIC (Schwarz, 1978)* 7564.254 7518.753 *LISREL uses AIC= 2t - 2ln(L) and BIC = tln(N)- 2ln(L) Global Goodness of Fit Statistics Degrees of Freedom for (C1)-(C2) 10 Maximum Likelihood Ratio Chi-Square (C1) 19.853 (P = 0.0307) Browne's (1984) ADF Chi-Square (C2_NT) -19927.496 (P = 0.0000) Estimated Non-centrality Parameter (NCP) 9.853 90 Percent Confidence Interval for NCP (0.863 ; 26.584) Minimum Fit Function Value 0.0326 Population Discrepancy Function Value (F0) 0.0162 90 Percent Confidence Interval for F0 (0.00142 ; 0.0437) Root Mean Square Error of Approximation (RMSEA) 0.0569 90 Percent Confidence Interval for RMSEA (0.0168 ; 0.0934) P-Value for Test of Close Fit (RMSEA < 0.05) 0.336 Expected Cross-Validation Index (ECVI) 0.0917 90 Percent Confidence Interval for ECVI (0.0638 ; 0.106) ECVI for Saturated Model 0.0328 ECVI for Independence Model 0.756 Chi-Square for Independence Model (12 df) 452.673 Normed Fit Index (NFI) 45.094 Non-Normed Fit Index (NNFI) 55.384 Parsimony Normed Fit Index (PNFI) 37.579 Comparative Fit Index (CFI) 1.000 Incremental Fit Index (IFI) 46.115 Relative Fit Index (RFI) 53.913 Critical N (CN) 0.292 Group Goodness of Fit Statistics Contribution to Chi-Square 6.156 Percentage Contribution to Chi-Square 31.008 Root Mean Square Residual (RMR) 0.548 Standardized RMR 0.0568 Goodness of Fit Index (GFI) 0.974 title N=305 Group 2 Modification Indices and Expected Change Modification Indices for LAMBDA-Y perfIQ -------- pc 0.046 pa 24.536 oa -0.099 ma 0.173 Expected Change for LAMBDA-Y perfIQ -------- pc 0.031 pa 3.996 oa 0.015 ma -0.035 No Non-Zero Modification Indices for PSI Modification Indices for THETA-EPS pc pa oa ma -------- -------- -------- -------- pc - - pa 1.634 - - oa 2.337 0.072 - - ma 4.045 2.824 16.503 - - Expected Change for THETA-EPS pc pa oa ma -------- -------- -------- -------- pc - - pa -0.590 - - oa 0.786 0.131 - - ma 0.958 0.817 -2.009 - - Modification Indices for TAU-Y pc pa oa ma -------- -------- -------- -------- -3.923 -0.001 0.100 -0.086 Expected Change for TAU-Y pc pa oa ma -------- -------- -------- -------- -0.203 0.004 -0.121 -0.011 No Non-Zero Modification Indices for ALPHA Max. Mod. Index is 24.54 for Element ( 2, 1) of LAMBDA-Y in Group 2 Time used 0.016 seconds