[R] Lavaan

deva d devazresearch at gmail.com
Tue Jun 23 18:47:05 CEST 2015


i am attaching a .csv file, and the associated code worked out in R Studio.

i used the lavaan and sem packages, and conducted it.

now, i wish to draw the SEM model, as is available in AMOS other packages
and how does one draw the covariance arrows in R.

ONE STATISTICS oriented question - how can one provide interpretation for
negative coefficients.

kindly guide.

thanks and regds,





taxliability <- read.csv("~/R WORK SPACE/taxliability.csv")
>   View(taxliability)
> model <-'tax~ inc + exp + svg + inv'
> fit <- sem(model, data = taxliability)
Error: could not find function "sem"
> library("lavaan", lib.loc="~/R/win-library/3.2")
This is lavaan 0.5-18
lavaan is BETA software! Please report any bugs.
> fit <- sem(model, data = taxliability)
Warning message:
In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats,  :
  lavaan WARNING: could not compute standard errors!
  lavaan NOTE: this may be a symptom that the model is not identified.

> library("sem", lib.loc="~/R/win-library/3.2")
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
:
  there is no package called ‘htmlwidgets’
Error: package or namespace load failed for ‘sem’
> fit <- sem(model, data = taxliability)
Warning message:
In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats,  :
  lavaan WARNING: could not compute standard errors!
  lavaan NOTE: this may be a symptom that the model is not identified.

> summary(fit,rsq=T, fit.measures=TRUE)
lavaan (0.5-18) converged normally after   1 iterations

  Number of observations                            66

  Estimator                                         ML
  Minimum Function Test Statistic                0.000
  Degrees of freedom                                 0

Model test baseline model:

  Minimum Function Test Statistic              160.444
  Degrees of freedom                                 4
  P-value                                        0.000

User model versus baseline model:

  Comparative Fit Index (CFI)                    1.000
  Tucker-Lewis Index (TLI)                       1.000

Loglikelihood and Information Criteria:

  Loglikelihood user model (H0)              -3441.453
  Loglikelihood unrestricted model (H1)      -3441.453

  Number of free parameters                          5
  Akaike (AIC)                                6892.905
  Bayesian (BIC)                              6903.854
  Sample-size adjusted Bayesian (BIC)         6888.113

Root Mean Square Error of Approximation:

  RMSEA                                          0.000
  90 Percent Confidence Interval          0.000  0.000
  P-value RMSEA <= 0.05                          1.000

Standardized Root Mean Square Residual:

  SRMR                                           0.000

Parameter estimates:

  Information                                 Expected
  Standard Errors                             Standard

                   Estimate  Std.err  Z-value  P(>|z|)
Regressions:
  tax ~
    inc               0.103
    exp              -0.023
    svg              -0.073
    inv               0.222

Variances:
    tax           4662558.169

R-Square:

    tax               0.912

 semPlot
Error: object 'semPlot' not found
> library("semPlot", lib.loc="~/R/win-library/3.2")
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
:
  there is no package called ‘htmlwidgets’
Error: package or namespace load failed for ‘semPlot’
> semPlot::
Error: unexpected end of line in "semPlot::"
>




*....*

*Deva*


...............



*in search of knowledge, everyday something is added ....*

*in search of wisdom, everyday something is dropped  ... an old Chinese
Proverb*
:::::::::::::::::::::::::

On Tue, Jun 23, 2015 at 9:03 PM, Sarah Goslee <sarah.goslee at gmail.com>
wrote:

> Hi,
>
> There are various tutorials for lavaan online, and even an entire book
> on the R package. Have you worked through those examples and tutorials
> successfully? If so, a clearer description of what you've tried and
> what failed is required to be able to help you.
>
> Without a reproducible example that includes some sample data (fake is
> fine), the code you used, and some clear idea of what output you
> expect, it's impossible to figure out how to help you. Here are some
> suggestions for creating a good reproducible example:
>
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
>
> Sarah
>
> On Tue, Jun 23, 2015 at 10:48 AM, DzR <devazresearch at gmail.com> wrote:
> > Dear Senior users of R/R Studio,
> >
> > I am very new to this environment hence am unable to plot the SEM models
> including use of graphic package ggplot.
> >
> > Request for some help in getting the plots please.
> >
> > Thanks,
> >
> > -----
> > Deva
>
> --
> Sarah Goslee
> http://www.functionaldiversity.org
>


More information about the R-help mailing list