path_analysis
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
path_analysis [2022/11/09 21:21] – created hkimscil | path_analysis [2024/09/28 05:45] (current) – hkimscil | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Path Analysis ====== | ====== Path Analysis ====== | ||
===== Planned Behavior Modeling ===== | ===== Planned Behavior Modeling ===== | ||
- | < | + | < |
###################################################### | ###################################################### | ||
## data file: PlannedBehavior.csv | ## data file: PlannedBehavior.csv | ||
Line 27: | Line 27: | ||
# Summarize model | # Summarize model | ||
summary(fitmod, | summary(fitmod, | ||
+ | </ | ||
+ | ====== Output ====== | ||
+ | < | ||
+ | ###################################################### | ||
+ | > ## data file: PlannedBehavior.csv | ||
+ | > ###################################################### | ||
+ | > df <- read.csv(" | ||
+ | > head(df) | ||
+ | attitude norms control intention behavior | ||
+ | 1 | ||
+ | 2 | ||
+ | 3 | ||
+ | 4 | ||
+ | 5 | ||
+ | 6 | ||
+ | > str(df) | ||
+ | ' | ||
+ | $ attitude : num 2.31 4.66 3.85 4.24 2.91 2.99 3.96 3.01 4.77 3.67 ... | ||
+ | $ norms : num 2.31 4.01 3.56 2.25 3.31 2.51 4.65 2.98 3.09 3.63 ... | ||
+ | $ control | ||
+ | $ intention: num 2.5 3.99 4.35 1.51 1.45 2.59 4.08 2.58 4.87 3.09 ... | ||
+ | $ behavior : num 2.62 3.64 3.83 2.25 2 2.2 4.41 4.15 4.35 3.95 ... | ||
+ | > ###################################################### | ||
+ | > # attitude | ||
+ | > # norms | ||
+ | > # control | ||
+ | > # intention | ||
+ | > # behavior | ||
+ | > ###################################################### | ||
+ | > # install.packages(" | ||
+ | > library(lavaan) | ||
+ | This is lavaan 0.6-9 | ||
+ | lavaan is FREE software! Please report any bugs. | ||
+ | Warning message: | ||
+ | 패키지 ‘lavaan’는 R 버전 4.1.2에서 작성되었습니다 | ||
+ | > | ||
+ | > # Specify model | ||
+ | > specmod <- " | ||
+ | + intention ~ attitude + norms + control | ||
+ | + " | ||
+ | > # Estimate model | ||
+ | > fitmod <- sem(specmod, | ||
+ | > | ||
+ | > # Summarize model | ||
+ | > summary(fitmod, | ||
+ | lavaan 0.6-9 ended normally after 11 iterations | ||
+ | |||
+ | Estimator | ||
+ | Optimization method | ||
+ | Number of model parameters | ||
+ | | ||
+ | Number of observations | ||
+ | | ||
+ | Model Test User Model: | ||
+ | | ||
+ | Test statistic | ||
+ | Degrees of freedom | ||
+ | |||
+ | Model Test Baseline Model: | ||
+ | |||
+ | Test statistic | ||
+ | Degrees of freedom | ||
+ | P-value | ||
+ | |||
+ | 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) | ||
+ | Loglikelihood unrestricted model (H1) | ||
+ | | ||
+ | Akaike (AIC) | ||
+ | Bayesian (BIC) | ||
+ | Sample-size adjusted Bayesian (BIC) 446.990 | ||
+ | |||
+ | Root Mean Square Error of Approximation: | ||
+ | |||
+ | RMSEA 0.000 | ||
+ | 90 Percent confidence interval - lower 0.000 | ||
+ | 90 Percent confidence interval - upper 0.000 | ||
+ | P-value RMSEA <= 0.05 NA | ||
+ | |||
+ | Standardized Root Mean Square Residual: | ||
+ | |||
+ | SRMR 0.000 | ||
+ | |||
+ | Parameter Estimates: | ||
+ | |||
+ | Standard errors | ||
+ | Information | ||
+ | Information saturated (h1) model Structured | ||
+ | |||
+ | Regressions: | ||
+ | | ||
+ | intention ~ | ||
+ | attitude | ||
+ | norms | ||
+ | control | ||
+ | |||
+ | Variances: | ||
+ | | ||
+ | | ||
+ | |||
+ | R-Square: | ||
+ | | ||
+ | intention | ||
</ | </ | ||
- | ====== | + | ====== |
+ | < | ||
+ | # Specify model | ||
+ | specmod2 <- " | ||
+ | intention ~ attitude + norms + control | ||
+ | attitude ~~ norms + control | ||
+ | norms ~~ control | ||
+ | " | ||
+ | # Estimate model | ||
+ | fitmod2 <- sem(specmod2, | ||
+ | |||
+ | # Summarize model | ||
+ | summary(fitmod2, | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | fitmod <- lm(intention ~ attitude + norms + control, data=df) | ||
+ | summary(fitmod) | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | > # Specify model | ||
+ | > specmod2 <- " | ||
+ | + intention ~ attitude + norms + control | ||
+ | + attitude ~~ norms + control | ||
+ | + norms ~~ control | ||
+ | + " | ||
+ | > # Estimate model | ||
+ | > fitmod2 <- sem(specmod2, | ||
+ | > | ||
+ | > # Summarize model | ||
+ | > summary(fitmod2, | ||
+ | lavaan 0.6-9 ended normally after 17 iterations | ||
+ | |||
+ | Estimator | ||
+ | Optimization method | ||
+ | Number of model parameters | ||
+ | |||
+ | Number of observations | ||
+ | |||
+ | Model Test User Model: | ||
+ | |||
+ | Test statistic | ||
+ | Degrees of freedom | ||
+ | |||
+ | Model Test Baseline Model: | ||
+ | |||
+ | Test statistic | ||
+ | Degrees of freedom | ||
+ | P-value | ||
+ | |||
+ | User Model versus Baseline Model: | ||
+ | |||
+ | Comparative Fit Index (CFI) 1.000 | ||
+ | Tucker-Lewis Index (TLI) | ||
+ | |||
+ | Loglikelihood and Information Criteria: | ||
+ | |||
+ | Loglikelihood user model (H0) -1011.828 | ||
+ | Loglikelihood unrestricted model (H1) -1011.828 | ||
+ | |||
+ | Akaike (AIC) 2043.656 | ||
+ | Bayesian (BIC) 2076.589 | ||
+ | Sample-size adjusted Bayesian (BIC) | ||
+ | |||
+ | Root Mean Square Error of Approximation: | ||
+ | |||
+ | RMSEA 0.000 | ||
+ | 90 Percent confidence interval - lower | ||
+ | 90 Percent confidence interval - upper | ||
+ | P-value RMSEA <= 0.05 NA | ||
+ | |||
+ | Standardized Root Mean Square Residual: | ||
+ | |||
+ | SRMR | ||
+ | |||
+ | Parameter Estimates: | ||
+ | |||
+ | Standard errors | ||
+ | Information | ||
+ | Information saturated (h1) model Structured | ||
+ | |||
+ | Regressions: | ||
+ | | ||
+ | intention ~ | ||
+ | attitude | ||
+ | norms | ||
+ | control | ||
+ | |||
+ | Covariances: | ||
+ | | ||
+ | attitude ~~ | ||
+ | norms | ||
+ | control | ||
+ | norms ~~ | ||
+ | control | ||
+ | |||
+ | Variances: | ||
+ | | ||
+ | | ||
+ | attitude | ||
+ | norms | ||
+ | control | ||
+ | |||
+ | R-Square: | ||
+ | | ||
+ | intention | ||
+ | |||
+ | > | ||
+ | > fitmod <- lm(intention ~ attitude + norms + control, data=df) | ||
+ | > summary(fitmod) | ||
+ | |||
+ | Call: | ||
+ | lm(formula = intention ~ attitude + norms + control, data = df) | ||
+ | |||
+ | Residuals: | ||
+ | | ||
+ | -1.80282 -0.52734 -0.06018 | ||
+ | |||
+ | Coefficients: | ||
+ | Estimate Std. Error t value Pr(> | ||
+ | (Intercept) | ||
+ | attitude | ||
+ | norms 0.15250 | ||
+ | control | ||
+ | --- | ||
+ | Signif. codes: | ||
+ | |||
+ | Residual standard error: 0.7356 on 195 degrees of freedom | ||
+ | Multiple R-squared: | ||
+ | F-statistic: | ||
+ | |||
+ | > | ||
+ | </ | ||
+ | ====== Model 3 ====== | ||
+ | < | ||
+ | # Specify model | ||
+ | specmod3 <- " | ||
+ | # directional relationships | ||
+ | intention ~ attitude + norms + control | ||
+ | behavior ~ intention | ||
+ | |||
+ | # covariances | ||
+ | attitude ~~ norms + control | ||
+ | norms ~~ control | ||
+ | " | ||
+ | # Estimate model | ||
+ | fitmod3 <- sem(specmod3, | ||
+ | |||
+ | # Summarize model | ||
+ | summary(fitmod3, | ||
+ | </ | ||
+ | < | ||
+ | > df <- read.csv(" | ||
+ | > # Specify model | ||
+ | > specmod3 <- " | ||
+ | + # directional relationships | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + # covariances | ||
+ | + | ||
+ | + norms ~~ control | ||
+ | + " | ||
+ | > # Estimate model | ||
+ | > fitmod3 <- sem(specmod3, | ||
+ | > | ||
+ | > # Summarize model | ||
+ | > summary(fitmod3, | ||
+ | lavaan 0.6-12 ended normally after 18 iterations | ||
+ | |||
+ | Estimator | ||
+ | Optimization method | ||
+ | Number of model parameters | ||
+ | |||
+ | Number of observations | ||
+ | |||
+ | Model Test User Model: | ||
+ | |||
+ | Test statistic | ||
+ | Degrees of freedom | ||
+ | P-value (Chi-square) | ||
+ | |||
+ | Model Test Baseline Model: | ||
+ | |||
+ | Test statistic | ||
+ | Degrees of freedom | ||
+ | P-value | ||
+ | |||
+ | User Model versus Baseline Model: | ||
+ | |||
+ | Comparative Fit Index (CFI) 1.000 | ||
+ | Tucker-Lewis Index (TLI) | ||
+ | |||
+ | Loglikelihood and Information Criteria: | ||
+ | |||
+ | Loglikelihood user model (H0) -1258.517 | ||
+ | Loglikelihood unrestricted model (H1) -1257.506 | ||
+ | |||
+ | Akaike (AIC) 2541.035 | ||
+ | Bayesian (BIC) 2580.555 | ||
+ | Sample-size adjusted Bayesian (BIC) | ||
+ | |||
+ | Root Mean Square Error of Approximation: | ||
+ | |||
+ | RMSEA 0.000 | ||
+ | 90 Percent confidence interval - lower | ||
+ | 90 Percent confidence interval - upper | ||
+ | P-value RMSEA <= 0.05 0.735 | ||
+ | |||
+ | Standardized Root Mean Square Residual: | ||
+ | |||
+ | SRMR | ||
+ | |||
+ | Parameter Estimates: | ||
+ | |||
+ | Standard errors | ||
+ | Information | ||
+ | Information saturated (h1) model Structured | ||
+ | |||
+ | Regressions: | ||
+ | | ||
+ | intention ~ | ||
+ | attitude | ||
+ | norms | ||
+ | control | ||
+ | behavior ~ | ||
+ | intention | ||
+ | |||
+ | Covariances: | ||
+ | | ||
+ | attitude ~~ | ||
+ | norms | ||
+ | control | ||
+ | norms ~~ | ||
+ | control | ||
+ | |||
+ | Variances: | ||
+ | | ||
+ | | ||
+ | | ||
+ | attitude | ||
+ | norms | ||
+ | control | ||
+ | |||
+ | R-Square: | ||
+ | | ||
+ | intention | ||
+ | behavior | ||
+ | |||
+ | </ | ||
+ | |||
+ | < | ||
+ | a <- (5*(5+1))/ | ||
+ | b <- 12 | ||
+ | a-b | ||
- | < | ||
</ | </ |
path_analysis.1667996494.txt.gz · Last modified: 2022/11/09 21:21 by hkimscil