library(readr)
rechard <- read_csv("~/Zim Projects PHD/Rechard Munyanyi/rechard.csv")
## Parsed with column specification:
## cols(
## .default = col_double()
## )
## See spec(...) for full column specifications.
attach(rechard)
## loading the required packages
library(ggplot2)
library(msm)
library(sandwich)
library(psych)
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
library(MASS)
library(factoextra)
## Welcome! Related Books: `Practical Guide To Cluster Analysis in R` at https://goo.gl/13EFCZ
library(FactoMineR)
## Warning: package 'FactoMineR' was built under R version 3.6.1
library(ggplot2)
library(nFactors)
## Loading required package: boot
##
## Attaching package: 'boot'
## The following object is masked from 'package:psych':
##
## logit
## The following object is masked from 'package:msm':
##
## cav
## Loading required package: lattice
##
## Attaching package: 'lattice'
## The following object is masked from 'package:boot':
##
## melanoma
##
## Attaching package: 'nFactors'
## The following object is masked from 'package:lattice':
##
## parallel
library(semPlot)
## Registered S3 methods overwritten by 'huge':
## method from
## plot.sim BDgraph
## print.sim BDgraph
library(foreign)
library(dplyr)
## Warning: package 'dplyr' was built under R version 3.6.1
##
## Attaching package: 'dplyr'
## The following object is masked from 'package:MASS':
##
## select
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(sem)
library(lavaan)
## Warning: package 'lavaan' was built under R version 3.6.1
## This is lavaan 0.6-4
## lavaan is BETA software! Please report any bugs.
##
## Attaching package: 'lavaan'
## The following objects are masked from 'package:sem':
##
## cfa, sem
## The following object is masked from 'package:psych':
##
## cor2cov
### pca
res.pca <- prcomp(rechard, scale = TRUE)
fviz_eig(res.pca)
#########################################
fviz_pca_var(res.pca,
col.var = "contrib", # Color by contributions to the PC
gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
repel = TRUE # Avoid text overlapping
)
#00AFBB
fviz_pca_ind(res.pca,
col.ind = "cos2", # Color by the quality of representation
gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
repel = TRUE # Avoid text overlapping
)
### determining the number of components to consider
ev<-eigen(cor(rechard))
ap<-parallel(subject=nrow(rechard),var=ncol(rechard),rep=100,cent=.05)
nS<-nScree(x=ev$values,parallel=ap$eigen$qevpea)
plotnScree(nS)
### contribution of each matrix
fac<-factanal(rechard,16,rotation="varimax")
print(fac,digits = 2,cutoff=.4,sort=TRUE)
##
## Call:
## factanal(x = rechard, factors = 16, rotation = "varimax")
##
## Uniquenesses:
## Q11_1 Q11_2 Q11_3 Q11_4 Q11_5 Q11_6 Q11_7 Q11_8 Q11_9 Q12_1 Q12_2 Q12_3
## 0.19 0.15 0.45 0.00 0.00 0.00 0.19 0.00 0.00 0.00 0.00 0.52
## Q13_1 Q13_2 Q13_3 Q14_1 Q14_2 Q14_3 Q15_1 Q15_2 Q15_3 Q15_4 Q16_1 Q16_2
## 0.29 0.00 0.14 0.00 0.66 0.77 0.81 0.63 0.74 0.76 0.63 0.78
## Q16_3 Q16_4 Q16_5 Q16_6 Q17_1 Q17_2 Q17_3 Q17_4 Q17_5 Q17_6 Q17_7 Q18_1
## 0.57 0.86 0.79 0.72 0.63 0.72 0.75 0.83 0.63 0.68 0.68 0.70
## Q18_2 Q18_3 Q18_4 Q18_5 Q18_6 Q18_7 Q18_8 Q19_1 Q19_2 Q20_1 Q20_2 Q20_3
## 0.67 0.64 0.68 0.66 0.36 0.00 0.56 0.17 0.17 0.17 0.00 0.21
## Q21_1 Q21_2 Q21_3 Q21_4 Q21_5 Q21_6 Q21_7 Q21_8
## 0.17 0.23 0.24 0.56 0.00 0.20 0.00 0.19
##
## Loadings:
## Factor1 Factor2 Factor3 Factor4 Factor5 Factor6 Factor7 Factor8
## Q17_1 0.51
## Q17_5 0.52
## Q17_7 0.52
## Q18_3 0.55
## Q18_5 0.52
## Q11_1 0.88
## Q11_3 0.68
## Q15_2 0.51
## Q18_6 0.75
## Q18_8 0.52
## Q14_1 0.97
## Q21_8 0.86
## Q11_8 0.92
## Q20_3 0.74
## Q11_4 0.97
## Q19_1 0.88
## Q11_6 0.95
## Q20_1 0.86
## Q13_3 0.80
## Q21_7 0.92
## Q11_9 0.96
## Q21_1 0.85
## Q11_2
## Q18_7
## Q12_2
## Q21_3
## Q11_7
## Q20_2
## Q11_5
## Q19_2
## Q13_2
## Q21_6
## Q13_1
## Q21_5
## Q12_1
## Q21_2
## Q16_3
## Q12_3
## Q14_2 0.41
## Q14_3
## Q15_1
## Q15_3
## Q15_4
## Q16_1
## Q16_2
## Q16_4
## Q16_5
## Q16_6 0.41
## Q17_2 0.41
## Q17_3
## Q17_4
## Q17_6 0.48
## Q18_1 0.43
## Q18_2 0.49
## Q18_4 0.48
## Q21_4
## Factor9 Factor10 Factor11 Factor12 Factor13 Factor14 Factor15
## Q17_1
## Q17_5
## Q17_7
## Q18_3
## Q18_5
## Q11_1
## Q11_3
## Q15_2
## Q18_6
## Q18_8
## Q14_1
## Q21_8
## Q11_8
## Q20_3
## Q11_4
## Q19_1
## Q11_6
## Q20_1
## Q13_3
## Q21_7
## Q11_9
## Q21_1
## Q11_2 0.81
## Q18_7 0.96
## Q12_2 0.97
## Q21_3 0.80
## Q11_7 0.73
## Q20_2 0.89
## Q11_5 0.94
## Q19_2 0.82
## Q13_2 0.92
## Q21_6 0.78
## Q13_1 0.70
## Q21_5 0.90
## Q12_1 0.93
## Q21_2 0.76
## Q16_3
## Q12_3
## Q14_2
## Q14_3
## Q15_1
## Q15_3
## Q15_4
## Q16_1
## Q16_2
## Q16_4
## Q16_5
## Q16_6
## Q17_2
## Q17_3
## Q17_4
## Q17_6
## Q18_1
## Q18_2
## Q18_4
## Q21_4
## Factor16
## Q17_1
## Q17_5
## Q17_7
## Q18_3
## Q18_5
## Q11_1
## Q11_3
## Q15_2
## Q18_6
## Q18_8
## Q14_1
## Q21_8
## Q11_8
## Q20_3
## Q11_4
## Q19_1
## Q11_6
## Q20_1
## Q13_3
## Q21_7
## Q11_9
## Q21_1
## Q11_2
## Q18_7
## Q12_2
## Q21_3
## Q11_7
## Q20_2
## Q11_5
## Q19_2
## Q13_2
## Q21_6
## Q13_1
## Q21_5
## Q12_1
## Q21_2
## Q16_3 0.54
## Q12_3
## Q14_2
## Q14_3
## Q15_1
## Q15_3
## Q15_4
## Q16_1
## Q16_2
## Q16_4
## Q16_5
## Q16_6
## Q17_2
## Q17_3
## Q17_4
## Q17_6
## Q18_1
## Q18_2
## Q18_4
## Q21_4
##
## Factor1 Factor2 Factor3 Factor4 Factor5 Factor6 Factor7
## SS loadings 3.42 3.39 2.51 2.21 1.96 1.95 1.93
## Proportion Var 0.06 0.06 0.04 0.04 0.04 0.03 0.03
## Cumulative Var 0.06 0.12 0.17 0.21 0.24 0.28 0.31
## Factor8 Factor9 Factor10 Factor11 Factor12 Factor13
## SS loadings 1.90 1.87 1.84 1.82 1.82 1.81
## Proportion Var 0.03 0.03 0.03 0.03 0.03 0.03
## Cumulative Var 0.34 0.38 0.41 0.44 0.48 0.51
## Factor14 Factor15 Factor16
## SS loadings 1.80 1.80 1.77
## Proportion Var 0.03 0.03 0.03
## Cumulative Var 0.54 0.57 0.60
##
## Test of the hypothesis that 16 factors are sufficient.
## The chi square statistic is 2790.23 on 764 degrees of freedom.
## The p-value is 6.15e-228
KMO(rechard)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = rechard)
## Overall MSA = 0.49
## MSA for each item =
## Q11_1 Q11_2 Q11_3 Q11_4 Q11_5 Q11_6 Q11_7 Q11_8 Q11_9 Q12_1 Q12_2 Q12_3
## 0.50 0.54 0.42 0.21 0.34 0.32 0.67 0.50 0.30 0.47 0.35 0.43
## Q13_1 Q13_2 Q13_3 Q14_1 Q14_2 Q14_3 Q15_1 Q15_2 Q15_3 Q15_4 Q16_1 Q16_2
## 0.58 0.45 0.42 0.42 0.90 0.81 0.79 0.74 0.74 0.81 0.85 0.87
## Q16_3 Q16_4 Q16_5 Q16_6 Q17_1 Q17_2 Q17_3 Q17_4 Q17_5 Q17_6 Q17_7 Q18_1
## 0.74 0.68 0.71 0.63 0.63 0.76 0.75 0.79 0.73 0.73 0.70 0.79
## Q18_2 Q18_3 Q18_4 Q18_5 Q18_6 Q18_7 Q18_8 Q19_1 Q19_2 Q20_1 Q20_2 Q20_3
## 0.80 0.85 0.62 0.66 0.44 0.50 0.44 0.21 0.33 0.32 0.70 0.51
## Q21_1 Q21_2 Q21_3 Q21_4 Q21_5 Q21_6 Q21_7 Q21_8
## 0.30 0.46 0.38 0.46 0.60 0.42 0.39 0.40
Explanatory (sem model)
HS.model <-'attitudes=~Q11_1+Q11_2+Q11_3+Q11_4+Q11_5+Q11_6+Q11_7+Q11_8+Q11_9
commitment=~ Q12_1+Q12_2
complexity=~Q13_1+Q13_2+Q13_3
training=~Q14_1+Q14_2
strategy=~Q15_2
support=~Q16_6
impact=~Q17_1+Q17_2+Q17_5+Q17_6+Q17_7
management=~Q18_1+Q18_2+Q18_3+Q18_4+Q18_5+Q18_6+Q18_7+Q18_8
triability=~Q19_1+Q19_2
satisfaction=~ Q20_1+Q20_2+Q20_3
barriers=~Q21_1+Q21_2+Q21_3+Q21_5+Q21_6+Q21_7+Q21_8'
fit <- cfa(HS.model,data=rechard)
## Warning in lav_object_post_check(object): lavaan WARNING: covariance matrix of latent variables
## is not positive definite;
## use lavInspect(fit, "cov.lv") to investigate.
summary(fit, fit.measures=TRUE)
## lavaan 0.6-4 ended normally after 152 iterations
##
## Optimization method NLMINB
## Number of free parameters 139
##
## Number of observations 280
##
## Estimator ML
## Model Fit Test Statistic 6961.177
## Degrees of freedom 807
## P-value (Chi-square) 0.000
##
## Model test baseline model:
##
## Minimum Function Test Statistic 9304.668
## Degrees of freedom 903
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.268
## Tucker-Lewis Index (TLI) 0.180
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -19296.499
## Loglikelihood unrestricted model (H1) -15815.910
##
## Number of free parameters 139
## Akaike (AIC) 38870.997
## Bayesian (BIC) 39376.233
## Sample-size adjusted Bayesian (BIC) 38935.473
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.165
## 90 Percent Confidence Interval 0.161 0.169
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.113
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|)
## attitudes =~
## Q11_1 1.000
## Q11_2 1.271 0.387 3.286 0.001
## Q11_3 1.292 0.376 3.434 0.001
## Q11_4 0.586 0.311 1.882 0.060
## Q11_5 2.327 0.562 4.140 0.000
## Q11_6 1.934 0.499 3.878 0.000
## Q11_7 3.105 0.710 4.372 0.000
## Q11_8 3.061 0.701 4.367 0.000
## Q11_9 1.366 0.402 3.395 0.001
## commitment =~
## Q12_1 1.000
## Q12_2 0.608 0.100 6.094 0.000
## complexity =~
## Q13_1 1.000
## Q13_2 1.139 0.133 8.559 0.000
## Q13_3 1.122 0.128 8.739 0.000
## training =~
## Q14_1 1.000
## Q14_2 0.822 0.112 7.342 0.000
## strategy =~
## Q15_2 1.000
## support =~
## Q16_6 1.000
## impact =~
## Q17_1 1.000
## Q17_2 0.895 0.194 4.617 0.000
## Q17_5 1.454 0.240 6.059 0.000
## Q17_6 1.344 0.229 5.862 0.000
## Q17_7 1.327 0.229 5.808 0.000
## management =~
## Q18_1 1.000
## Q18_2 1.065 0.171 6.213 0.000
## Q18_3 1.167 0.179 6.532 0.000
## Q18_4 0.951 0.161 5.899 0.000
## Q18_5 1.059 0.169 6.272 0.000
## Q18_6 0.266 0.088 3.032 0.002
## Q18_7 0.401 0.128 3.122 0.002
## Q18_8 0.328 0.106 3.102 0.002
## triability =~
## Q19_1 1.000
## Q19_2 2.296 0.667 3.444 0.001
## satisfaction =~
## Q20_1 1.000
## Q20_2 1.436 0.204 7.044 0.000
## Q20_3 1.462 0.204 7.156 0.000
## barriers =~
## Q21_1 1.000
## Q21_2 1.762 0.353 4.995 0.000
## Q21_3 1.082 0.263 4.109 0.000
## Q21_5 2.042 0.393 5.202 0.000
## Q21_6 2.211 0.417 5.298 0.000
## Q21_7 2.092 0.392 5.330 0.000
## Q21_8 1.599 0.337 4.747 0.000
##
## Covariances:
## Estimate Std.Err z-value P(>|z|)
## attitudes ~~
## commitment 0.182 0.050 3.655 0.000
## complexity 0.164 0.043 3.794 0.000
## training 0.146 0.043 3.376 0.001
## strategy 0.113 0.034 3.364 0.001
## support 0.071 0.031 2.271 0.023
## impact 0.003 0.015 0.223 0.824
## management 0.058 0.023 2.499 0.012
## triability 0.080 0.029 2.714 0.007
## satisfaction 0.180 0.048 3.731 0.000
## barriers 0.075 0.023 3.213 0.001
## commitment ~~
## complexity 0.444 0.084 5.259 0.000
## training 0.470 0.112 4.207 0.000
## strategy 0.107 0.085 1.256 0.209
## support 0.075 0.103 0.731 0.465
## impact 0.126 0.062 2.026 0.043
## management 0.087 0.071 1.234 0.217
## triability 0.120 0.054 2.230 0.026
## satisfaction 0.258 0.069 3.747 0.000
## barriers 0.315 0.069 4.554 0.000
## complexity ~~
## training 0.535 0.092 5.835 0.000
## strategy 0.308 0.064 4.842 0.000
## support 0.078 0.068 1.141 0.254
## impact 0.085 0.042 2.049 0.041
## management 0.178 0.053 3.349 0.001
## triability 0.132 0.046 2.865 0.004
## satisfaction 0.294 0.060 4.915 0.000
## barriers 0.338 0.071 4.722 0.000
## training ~~
## strategy 0.141 0.083 1.704 0.088
## support 0.045 0.100 0.448 0.654
## impact 0.153 0.062 2.465 0.014
## management 0.198 0.073 2.717 0.007
## triability 0.153 0.059 2.604 0.009
## satisfaction 0.308 0.072 4.256 0.000
## barriers 0.324 0.072 4.526 0.000
## strategy ~~
## support 0.214 0.082 2.610 0.009
## impact -0.050 0.047 -1.061 0.289
## management 0.108 0.057 1.913 0.056
## triability 0.007 0.034 0.193 0.847
## satisfaction 0.118 0.049 2.387 0.017
## barriers 0.098 0.035 2.840 0.005
## support ~~
## impact 0.226 0.066 3.448 0.001
## management 0.318 0.078 4.063 0.000
## triability 0.040 0.043 0.927 0.354
## satisfaction 0.081 0.058 1.401 0.161
## barriers 0.049 0.037 1.317 0.188
## impact ~~
## management 0.317 0.070 4.542 0.000
## triability 0.062 0.030 2.050 0.040
## satisfaction 0.066 0.035 1.885 0.059
## barriers 0.084 0.028 2.999 0.003
## management ~~
## triability 0.111 0.042 2.615 0.009
## satisfaction 0.197 0.052 3.820 0.000
## barriers 0.131 0.037 3.529 0.000
## triability ~~
## satisfaction 0.191 0.060 3.188 0.001
## barriers 0.097 0.034 2.855 0.004
## satisfaction ~~
## barriers 0.198 0.048 4.151 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## .Q11_1 1.125 0.096 11.746 0.000
## .Q11_2 1.670 0.142 11.738 0.000
## .Q11_3 1.421 0.121 11.717 0.000
## .Q11_4 1.875 0.159 11.815 0.000
## .Q11_5 1.265 0.111 11.362 0.000
## .Q11_6 1.586 0.137 11.590 0.000
## .Q11_7 0.893 0.086 10.378 0.000
## .Q11_8 0.896 0.086 10.436 0.000
## .Q11_9 1.675 0.143 11.723 0.000
## .Q12_1 0.867 0.175 4.966 0.000
## .Q12_2 1.509 0.140 10.749 0.000
## .Q13_1 1.419 0.118 12.038 0.000
## .Q13_2 1.207 0.104 11.644 0.000
## .Q13_3 1.039 0.091 11.470 0.000
## .Q14_1 1.074 0.157 6.828 0.000
## .Q14_2 1.047 0.124 8.452 0.000
## .Q15_2 0.000
## .Q16_6 0.000
## .Q17_1 1.465 0.135 10.812 0.000
## .Q17_2 1.710 0.154 11.134 0.000
## .Q17_5 1.101 0.124 8.904 0.000
## .Q17_6 1.241 0.129 9.625 0.000
## .Q17_7 1.291 0.132 9.768 0.000
## .Q18_1 1.624 0.152 10.671 0.000
## .Q18_2 1.331 0.130 10.215 0.000
## .Q18_3 1.194 0.124 9.654 0.000
## .Q18_4 1.361 0.129 10.578 0.000
## .Q18_5 1.251 0.124 10.130 0.000
## .Q18_6 0.761 0.065 11.659 0.000
## .Q18_7 1.612 0.138 11.646 0.000
## .Q18_8 1.094 0.094 11.649 0.000
## .Q19_1 1.779 0.155 11.455 0.000
## .Q19_2 1.299 0.233 5.587 0.000
## .Q20_1 1.552 0.134 11.602 0.000
## .Q20_2 0.897 0.088 10.246 0.000
## .Q20_3 0.797 0.081 9.829 0.000
## .Q21_1 1.618 0.135 11.999 0.000
## .Q21_2 1.499 0.123 12.220 0.000
## .Q21_3 1.750 0.146 12.011 0.000
## .Q21_5 1.328 0.108 12.256 0.000
## .Q21_6 1.211 0.099 12.222 0.000
## .Q21_7 0.986 0.081 12.192 0.000
## .Q21_8 1.816 0.150 12.147 0.000
## attitudes 0.091 0.041 2.232 0.026
## commitment 1.084 0.217 5.002 0.000
## complexity 0.446 0.100 4.466 0.000
## training 1.048 0.201 5.213 0.000
## strategy 1.117 0.094 11.832 0.000
## support 1.649 0.139 11.832 0.000
## impact 0.379 0.109 3.461 0.001
## management 0.533 0.137 3.895 0.000
## triability 0.078 0.059 1.307 0.191
## satisfaction 0.369 0.099 3.721 0.000
## barriers 0.158 0.058 2.743 0.006
semPaths(fit, style="lisrel",
whatLabels = "std", edge.label.cex = .7, node.label.cex = .6,
label.prop=0.9, edge.label.color = "black", rotation = 4,
equalizeManifests = FALSE, optimizeLatRes = TRUE, node.width = 1.5,
edge.width = 2, shapeMan = "square", shapeLat = "ellipse",
shapeInt = "circle", sizeMan = 2, sizeInt = 3, sizeLat = 2,
curve=2, unCol = "blue")
## Warning in qgraph::qgraph(Edgelist, labels = nLab, bidirectional = Bidir, :
## The following arguments are not documented and likely not arguments of
## qgraph and thus ignored: node.label.cex
Another data set
library(readr)
correlations <- read_csv("~/Zim Projects PHD/Rechard Munyanyi/correlations.csv")
## Parsed with column specification:
## cols(
## .default = col_double(),
## gender = col_character(),
## age = col_character(),
## marital_status = col_character(),
## level = col_character(),
## faculty = col_character(),
## primary = col_character(),
## secondary = col_character(),
## computer_use_statge = col_character(),
## laptop_ownership = col_character(),
## internet_access = col_character()
## )
## See spec(...) for full column specifications.
attach(correlations)
gender=as.factor(gender)
age=as.factor(age)
marital_status=as.factor(marital_status)
level=as.factor(level)
faculty=as.factor(faculty)
primary=as.factor(primary)
secondary=as.factor(secondary)
computer_use_statge=as.factor(computer_use_statge)
laptop_ownership=as.factor(laptop_ownership)
internet_access=as.factor(internet_access)
library(PerformanceAnalytics)
## Warning: package 'PerformanceAnalytics' was built under R version 3.6.1
## Loading required package: xts
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
## Registered S3 method overwritten by 'xts':
## method from
## as.zoo.xts zoo
##
## Attaching package: 'xts'
## The following objects are masked from 'package:dplyr':
##
## first, last
##
## Attaching package: 'PerformanceAnalytics'
## The following object is masked from 'package:graphics':
##
## legend
co<-data.frame(attitudes,commitment,complexity,training,strategy,support,impact, management,triability,satisfaction,barriers)
chart.Correlation(co)
md<-lm(attitudes~commitment+complexity+training+strategy+support+impact+ management+triability+satisfaction+barriers,data = correlations)
summary(md)
##
## Call:
## lm(formula = attitudes ~ commitment + complexity + training +
## strategy + support + impact + management + triability + satisfaction +
## barriers, data = correlations)
##
## Residuals:
## Min 1Q Median 3Q Max
## -10.9220 -2.7337 -0.6058 1.6895 21.0927
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.19879 1.19503 3.514 0.000519 ***
## commitment 0.65728 0.13690 4.801 2.63e-06 ***
## complexity 0.70447 0.13160 5.353 1.86e-07 ***
## training 0.28357 0.13051 2.173 0.030671 *
## strategy 1.16886 0.26066 4.484 1.09e-05 ***
## support 0.46502 0.20994 2.215 0.027601 *
## impact -0.21533 0.06593 -3.266 0.001232 **
## management 0.17359 0.05599 3.101 0.002138 **
## triability 0.73528 0.14464 5.083 6.97e-07 ***
## satisfaction 0.75493 0.10846 6.961 2.60e-11 ***
## barriers -0.35139 0.08397 -4.185 3.87e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.2 on 268 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.5723, Adjusted R-squared: 0.5564
## F-statistic: 35.86 on 10 and 268 DF, p-value: < 2.2e-16
### attitude vs gender model
md2<-lm(barriers~gender+age+marital_status+level+faculty+primary+secondary+computer_use_statge+laptop_ownership+internet_access,data = correlations)
anova(md2)
## Analysis of Variance Table
##
## Response: barriers
## Df Sum Sq Mean Sq F value Pr(>F)
## gender 1 0.6 0.612 0.0180 0.893292
## age 2 373.1 186.568 5.4983 0.004594 **
## marital_status 2 103.5 51.763 1.5255 0.219491
## level 3 31.2 10.402 0.3066 0.820638
## faculty 4 132.6 33.143 0.9767 0.420750
## primary 4 144.1 36.034 1.0619 0.375867
## secondary 4 78.8 19.712 0.5809 0.676728
## computer_use_statge 2 12.2 6.111 0.1801 0.835304
## laptop_ownership 1 6.5 6.473 0.1908 0.662649
## internet_access 1 125.4 125.357 3.6944 0.055710 .
## Residuals 255 8652.6 33.932
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
stat_box_data <- function(commitment, upper_limit = max(commitment)*1.5) {
return(
data.frame(
y = 10,
label = paste('N =', length(commitment), '\n',
'Mean =', round(mean(commitment), 0), '\n')
)
)
}
####
theme_set(theme_gray(base_size = 10)) ###This sets the font sizes of anything writt
ggplot(correlations, aes(x = faculty, y = commitment))+ geom_boxplot(size=0.7,varwidth = TRUE,outlier.colour = "red",outlier.shape = 1, shape=6) + geom_smooth(method=lm)+ ylab("Commitment of students") + xlab("")+stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = stat_box_data,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
color="blue"
)+
theme_bw(base_size = 10)+ theme(axis.text.x = element_text(face="bold", color="black",
size=10),
axis.text.y = element_text(face="bold", color="black",
size=10))
######################
stat_box_data <- function(attitudes, upper_limit = max(attitudes)*1.5) {
return(
data.frame(
y = 40,
label = paste('N =', length(attitudes), '\n',
'Mean =', round(mean(attitudes), 0), '\n')
)
)
}
#####
theme_set(theme_gray(base_size = 10)) ###This sets the font sizes of anything writt
ggplot(correlations, aes(x = age, y = attitudes))+ geom_boxplot(size=0.7,varwidth = TRUE,outlier.colour = "red",outlier.shape = 1, shape=6) + geom_smooth(method=lm)+ ylab("Attitude of students") + xlab("")+stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = stat_box_data,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
color="blue"
)+
theme_bw(base_size = 10)+facet_wrap(.~gender)
stat_box_data <- function(complexity, upper_limit = max(complexity)*1.5) {
return(
data.frame(
y = 20,
label = paste('N =', length(complexity), '\n',
'Mean =', round(mean(complexity), 0), '\n')
)
)
}
#####
theme_set(theme_gray(base_size = 10)) ###This sets the font sizes of anything writt
ggplot(correlations, aes(x = faculty, y = complexity))+ geom_boxplot(size=0.7,varwidth = TRUE,outlier.colour = "red",outlier.shape = 1, shape=6) + geom_smooth(method=lm)+ ylab("Complexity of e-learning to students") + xlab("")+stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = stat_box_data,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
color="blue"
)+
theme_bw(base_size = 10)
stat_box_data <- function(training, upper_limit = max(training)*1.5) {
return(
data.frame(
y = 12,
label = paste('N =', length(training), '\n',
'Mean =', round(mean(training), 0), '\n')
)
)
}
#####
theme_set(theme_gray(base_size = 10)) ###This sets the font sizes of anything writt
ggplot(correlations, aes(x = age, y = training))+ geom_boxplot(size=0.7,varwidth = TRUE,outlier.colour = "red",outlier.shape = 1, shape=6) + geom_smooth(method=lm)+ ylab("Training of e-learning scores") + xlab("")+stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = stat_box_data,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
color="blue"
)+
theme_bw(base_size = 10)