This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(car)
## Loading required package: carData
library(rgeos)
## Loading required package: sp
## rgeos version: 0.6-3, (SVN revision 696)
## GEOS runtime version: 3.9.3-CAPI-1.14.3
## Please note that rgeos will be retired during October 2023,
## plan transition to sf or terra functions using GEOS at your earliest convenience.
## See https://r-spatial.org/r/2023/05/15/evolution4.html for details.
## GEOS using OverlayNG
## Linking to sp version: 2.0-0
## Polygon checking: TRUE
library(rgdal)
## Please note that rgdal will be retired during October 2023,
## plan transition to sf/stars/terra functions using GDAL and PROJ
## at your earliest convenience.
## See https://r-spatial.org/r/2023/05/15/evolution4.html and https://github.com/r-spatial/evolution
## rgdal: version: 1.6-7, (SVN revision 1203)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 3.5.2, released 2022/09/02
## Path to GDAL shared files: C:/Users/mahir.bhatt/AppData/Local/Programs/R/R-4.2.3/library/rgdal/gdal
## GDAL binary built with GEOS: TRUE
## Loaded PROJ runtime: Rel. 8.2.1, January 1st, 2022, [PJ_VERSION: 821]
## Path to PROJ shared files: C:/Users/mahir.bhatt/AppData/Local/Programs/R/R-4.2.3/library/rgdal/proj
## PROJ CDN enabled: FALSE
## Linking to sp version:2.0-0
## To mute warnings of possible GDAL/OSR exportToProj4() degradation,
## use options("rgdal_show_exportToProj4_warnings"="none") before loading sp or rgdal.
library(sf)
library(ggplot2)
library(tab)
## Loading required package: dplyr
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:rgeos':
##
## intersect, setdiff, symdiff, union
## The following object is masked from 'package:car':
##
## recode
## The following objects are masked from 'package:xts':
##
## first, last
## The following object is masked from 'package:MASS':
##
## select
## The following object is masked from 'package:smerc':
##
## distinct
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(texreg)
## Version: 1.38.6
## Date: 2022-04-06
## Author: Philip Leifeld (University of Essex)
##
## Consider submitting praise using the praise or praise_interactive functions.
## Please cite the JSS article in your publications -- see citation("texreg").
library(ggpubr)
## Registered S3 methods overwritten by 'broom':
## method from
## tidy.glht jtools
## tidy.summary.glht jtools
library(rgdal)
library(terra)
## terra 1.7.23
##
## Attaching package: 'terra'
## The following object is masked from 'package:ggpubr':
##
## rotate
## The following object is masked from 'package:texreg':
##
## extract
## The following object is masked from 'package:rgdal':
##
## project
## The following object is masked from 'package:zoo':
##
## time<-
## The following object is masked from 'package:MASS':
##
## area
## The following object is masked from 'package:knitr':
##
## spin
library(data.table)
##
## Attaching package: 'data.table'
## The following object is masked from 'package:terra':
##
## shift
## The following objects are masked from 'package:dplyr':
##
## between, first, last
## The following objects are masked from 'package:xts':
##
## first, last
## The following objects are masked from 'package:lubridate':
##
## hour, isoweek, mday, minute, month, quarter, second, wday, week,
## yday, year
library(gapminder)
library(tidyquant)
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:MASS':
##
## select
## The following object is masked from 'package:smerc':
##
## distinct
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(ARPALData)
library(shinyjs)
##
## Attaching package: 'shinyjs'
## The following object is masked from 'package:terra':
##
## click
## The following object is masked from 'package:texreg':
##
## show
## The following object is masked from 'package:rgeos':
##
## show
## The following object is masked from 'package:sp':
##
## show
## The following object is masked from 'package:quantmod':
##
## show
## The following object is masked from 'package:lubridate':
##
## show
## The following objects are masked from 'package:methods':
##
## removeClass, show
library(shiny)
##
## Attaching package: 'shiny'
## The following object is masked from 'package:shinyjs':
##
## runExample
library(tmaptools)
library(plotly)
library(incidence)
library(xts)
library(bigmemory)
##
## Attaching package: 'bigmemory'
## The following object is masked from 'package:terra':
##
## deepcopy
library(ff)
## Loading required package: bit
##
## Attaching package: 'bit'
## The following object is masked from 'package:data.table':
##
## setattr
## The following object is masked from 'package:dplyr':
##
## symdiff
## The following object is masked from 'package:rgeos':
##
## symdiff
## The following object is masked from 'package:base':
##
## xor
## Attaching package ff
## - getOption("fftempdir")=="C:/Users/MAHIR~1.BHA/AppData/Local/Temp/RtmpiYq2U8/ff"
## - getOption("ffextension")=="ff"
## - getOption("ffdrop")==TRUE
## - getOption("fffinonexit")==TRUE
## - getOption("ffpagesize")==65536
## - getOption("ffcaching")=="mmnoflush" -- consider "ffeachflush" if your system stalls on large writes
## - getOption("ffbatchbytes")==16777216 -- consider a different value for tuning your system
## - getOption("ffmaxbytes")==536870912 -- consider a different value for tuning your system
##
## Attaching package: 'ff'
## The following object is masked from 'package:bigmemory':
##
## is.readonly
## The following objects are masked from 'package:terra':
##
## is.factor, ncol<-, nrow<-
## The following objects are masked from 'package:utils':
##
## write.csv, write.csv2
## The following objects are masked from 'package:base':
##
## is.factor, is.ordered
library(plyr)
## ------------------------------------------------------------------------------
## You have loaded plyr after dplyr - this is likely to cause problems.
## If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
## library(plyr); library(dplyr)
## ------------------------------------------------------------------------------
##
## Attaching package: 'plyr'
## The following objects are masked from 'package:plotly':
##
## arrange, mutate, rename, summarise
## The following object is masked from 'package:ggpubr':
##
## mutate
## The following objects are masked from 'package:dplyr':
##
## arrange, count, desc, failwith, id, mutate, rename, summarise,
## summarize
library(ggplot2)
library(grid)
##
## Attaching package: 'grid'
## The following object is masked from 'package:ff':
##
## pattern
## The following object is masked from 'package:terra':
##
## depth
library(dplyr)
library(tidyr)
##
## Attaching package: 'tidyr'
## The following object is masked from 'package:terra':
##
## extract
## The following object is masked from 'package:texreg':
##
## extract
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ purrr 1.0.1 ✔ tibble 3.2.1
## ✔ readr 2.1.4
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ plyr::arrange() masks plotly::arrange(), dplyr::arrange()
## ✖ data.table::between() masks dplyr::between()
## ✖ purrr::compact() masks plyr::compact()
## ✖ plyr::count() masks dplyr::count()
## ✖ plyr::desc() masks dplyr::desc()
## ✖ plotly::distinct() masks dplyr::distinct(), smerc::distinct()
## ✖ tidyr::extract() masks terra::extract(), texreg::extract()
## ✖ plyr::failwith() masks dplyr::failwith()
## ✖ plotly::filter() masks dplyr::filter(), stats::filter()
## ✖ data.table::first() masks dplyr::first(), xts::first()
## ✖ data.table::hour() masks lubridate::hour()
## ✖ plyr::id() masks dplyr::id()
## ✖ data.table::isoweek() masks lubridate::isoweek()
## ✖ dplyr::lag() masks stats::lag()
## ✖ data.table::last() masks dplyr::last(), xts::last()
## ✖ data.table::mday() masks lubridate::mday()
## ✖ data.table::minute() masks lubridate::minute()
## ✖ data.table::month() masks lubridate::month()
## ✖ plyr::mutate() masks plotly::mutate(), ggpubr::mutate(), dplyr::mutate()
## ✖ data.table::quarter() masks lubridate::quarter()
## ✖ dplyr::recode() masks car::recode()
## ✖ plyr::rename() masks plotly::rename(), dplyr::rename()
## ✖ data.table::second() masks lubridate::second()
## ✖ plotly::select() masks dplyr::select(), MASS::select()
## ✖ shinyjs::show() masks texreg::show(), rgeos::show(), sp::show(), quantmod::show(), lubridate::show(), methods::show()
## ✖ purrr::some() masks car::some()
## ✖ plyr::summarise() masks plotly::summarise(), dplyr::summarise()
## ✖ plyr::summarize() masks dplyr::summarize()
## ✖ bit::symdiff() masks dplyr::symdiff(), rgeos::symdiff()
## ✖ purrr::transpose() masks data.table::transpose()
## ✖ data.table::wday() masks lubridate::wday()
## ✖ data.table::week() masks lubridate::week()
## ✖ data.table::yday() masks lubridate::yday()
## ✖ data.table::year() masks lubridate::year()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(lubridate)
library(dygraphs)
library(zoo)
library(heatmaply)
## Loading required package: viridis
## Loading required package: viridisLite
## Registered S3 methods overwritten by 'registry':
## method from
## print.registry_field proxy
## print.registry_entry proxy
##
## ======================
## Welcome to heatmaply version 1.4.2
##
## Type citation('heatmaply') for how to cite the package.
## Type ?heatmaply for the main documentation.
##
## The github page is: https://github.com/talgalili/heatmaply/
## Please submit your suggestions and bug-reports at: https://github.com/talgalili/heatmaply/issues
## You may ask questions at stackoverflow, use the r and heatmaply tags:
## https://stackoverflow.com/questions/tagged/heatmaply
## ======================
library(ggcorrplot)
library(openair)
library(rcompanion)
library(lattice)
library(aplpack)
## Registered S3 method overwritten by 'aplpack':
## method from
## plot.bagplot DescTools
library(tcltk)
library(maps)
##
## Attaching package: 'maps'
##
## The following object is masked from 'package:viridis':
##
## unemp
##
## The following object is masked from 'package:purrr':
##
## map
##
## The following object is masked from 'package:plyr':
##
## ozone
library(mapview)
library(vars)
## Loading required package: strucchange
## Loading required package: sandwich
##
## Attaching package: 'strucchange'
##
## The following object is masked from 'package:stringr':
##
## boundary
##
## Loading required package: urca
## Loading required package: lmtest
##
## Attaching package: 'lmtest'
##
## The following object is masked from 'package:shinyjs':
##
## reset
##
##
## Attaching package: 'vars'
##
## The following object is masked from 'package:tidyquant':
##
## VAR
library(sjPlot)
## Install package "strengejacke" from GitHub (`devtools::install_github("strengejacke/strengejacke")`) to load all sj-packages at once!
library(sjmisc)
##
## Attaching package: 'sjmisc'
##
## The following object is masked from 'package:purrr':
##
## is_empty
##
## The following object is masked from 'package:tibble':
##
## add_case
##
## The following object is masked from 'package:tidyr':
##
## replace_na
##
## The following object is masked from 'package:terra':
##
## trim
##
## The following objects are masked from 'package:jtools':
##
## %nin%, center
library(likert)
## Loading required package: xtable
##
## Attaching package: 'xtable'
##
## The following object is masked from 'package:terra':
##
## align
##
##
## Attaching package: 'likert'
##
## The following object is masked from 'package:dplyr':
##
## recode
##
## The following object is masked from 'package:car':
##
## recode
library(expss)
## Loading required package: maditr
##
## To drop variable use NULL: let(mtcars, am = NULL) %>% head()
##
##
## Attaching package: 'maditr'
##
## The following object is masked from 'package:sjmisc':
##
## to_long
##
## The following object is masked from 'package:purrr':
##
## transpose
##
## The following object is masked from 'package:readr':
##
## cols
##
## The following object is masked from 'package:plyr':
##
## take
##
## The following objects are masked from 'package:data.table':
##
## copy, dcast, melt
##
## The following objects are masked from 'package:terra':
##
## query, shift
##
## The following objects are masked from 'package:dplyr':
##
## between, coalesce, first, last
##
## The following objects are masked from 'package:xts':
##
## first, last
##
##
## Use 'expss_output_viewer()' to display tables in the RStudio Viewer.
## To return to the console output, use 'expss_output_default()'.
##
##
## Attaching package: 'expss'
##
## The following object is masked from 'package:likert':
##
## recode
##
## The following objects are masked from 'package:sjmisc':
##
## add_columns, add_rows, rec
##
## The following objects are masked from 'package:stringr':
##
## fixed, regex
##
## The following objects are masked from 'package:purrr':
##
## keep, modify, modify_if, when
##
## The following objects are masked from 'package:tidyr':
##
## contains, nest
##
## The following object is masked from 'package:plyr':
##
## split_labels
##
## The following objects are masked from 'package:shinyjs':
##
## hide, info
##
## The following objects are masked from 'package:data.table':
##
## copy, like
##
## The following object is masked from 'package:ggpubr':
##
## compare_means
##
## The following objects are masked from 'package:dplyr':
##
## compute, contains, na_if, recode, vars, where
##
## The following object is masked from 'package:ggplot2':
##
## vars
##
## The following object is masked from 'package:car':
##
## recode
library(openxlsx)
library(strucchange)
library(ltm)
## Loading required package: msm
## Loading required package: polycor
library(corrr)
##
## Attaching package: 'corrr'
##
## The following object is masked from 'package:terra':
##
## stretch
library(modeest)
## Registered S3 methods overwritten by 'rmutil':
## method from
## plot.residuals psych
## print.response httr
##
## Attaching package: 'modeest'
##
## The following object is masked from 'package:PerformanceAnalytics':
##
## skewness
library(tableone)
library(Hmisc)
## Registered S3 methods overwritten by 'Hmisc':
## method from
## [.labelled expss
## print.labelled expss
## as.data.frame.labelled expss
##
## Attaching package: 'Hmisc'
##
## The following objects are masked from 'package:xtable':
##
## label, label<-
##
## The following object is masked from 'package:sjmisc':
##
## %nin%
##
## The following objects are masked from 'package:plyr':
##
## is.discrete, summarize
##
## The following object is masked from 'package:bigmemory':
##
## describe
##
## The following object is masked from 'package:shinyjs':
##
## html
##
## The following object is masked from 'package:plotly':
##
## subplot
##
## The following objects are masked from 'package:terra':
##
## describe, mask, units, zoom
##
## The following objects are masked from 'package:dplyr':
##
## src, summarize
##
## The following object is masked from 'package:rgeos':
##
## translate
##
## The following object is masked from 'package:quantmod':
##
## Lag
##
## The following object is masked from 'package:jtools':
##
## %nin%
##
## The following objects are masked from 'package:base':
##
## format.pval, units
library(modelsummary)
##
## Attaching package: 'modelsummary'
##
## The following object is masked from 'package:Hmisc':
##
## Mean
library(foreign)
library(lavaan)
## This is lavaan 0.6-15
## lavaan is FREE software! Please report any bugs.
##
## Attaching package: 'lavaan'
##
## The following object is masked from 'package:TTR':
##
## growth
library(corrr)
library(gtsummary)
##
## Attaching package: 'gtsummary'
##
## The following objects are masked from 'package:expss':
##
## contains, vars
##
## The following object is masked from 'package:plyr':
##
## mutate
##
## The following object is masked from 'package:MASS':
##
## select
library(gridExtra)
##
## Attaching package: 'gridExtra'
##
## The following object is masked from 'package:dplyr':
##
## combine
library(leaflet)
##
## Attaching package: 'leaflet'
##
## The following object is masked from 'package:xts':
##
## addLegend
library(haven)
##
## Attaching package: 'haven'
##
## The following objects are masked from 'package:expss':
##
## is.labelled, read_spss
library(labelled)
##
## Attaching package: 'labelled'
##
## The following object is masked from 'package:expss':
##
## is.labelled
##
## The following objects are masked from 'package:sjmisc':
##
## to_character, to_factor
library(naniar)
##
## Attaching package: 'naniar'
##
## The following object is masked from 'package:expss':
##
## is_na
##
## The following object is masked from 'package:sjmisc':
##
## all_na
##
## The following object is masked from 'package:terra':
##
## shade
library(ordinal)
##
## Attaching package: 'ordinal'
##
## The following object is masked from 'package:plotly':
##
## slice
##
## The following object is masked from 'package:dplyr':
##
## slice
You can also embed plots, for example:
cool <- read.csv("~/PhD/Cool roof paints/CoolRoofMosq_temperature_RH_fem2.csv")
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.
cool <- cool %>%
mutate(inte = case_when(type == "CONTROLE" ~ 0, type == "SOPREMA" ~ 1, type == "SIKA" ~ 2, type == "EPS" ~3))%>%
set_value_labels(inte = c("CONTROLE" = 0, "SOPREMA"=1, "SIKA" = 2, "EPS" = 3)) %>%
set_variable_labels(inte = "Intervention Type")
cool$inte<-as.factor(cool$inte)
cool <- cool %>%
mutate(roof_t = case_when(roof == "Banco" ~ 1, roof == "Toles" ~ 2))%>%
set_value_labels(roof_t = c("Banco" = 1, "Toles"=2)) %>%
set_variable_labels(roof_t = "Intervention Type")
cool$roof_t<-as.factor(cool$roof_t)
cool$fem2_anopheles_asp_am<-as.factor(cool$fem2_anopheles_asp_am)
olsm1<-clm(fem2_anopheles_asp_am ~ inte + T_avg.CDC. + RH_avg.CDC. + roof_t, data = cool, link ="logit")
summary(olsm1)
## formula: fem2_anopheles_asp_am ~ inte + T_avg.CDC. + RH_avg.CDC. + roof_t
## data: cool
##
## link threshold nobs logLik AIC niter max.grad cond.H
## logit flexible 481 -877.83 1813.66 8(3) 6.39e-13 4.9e+06
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## inte1 0.792659 0.234061 3.387 0.000708 ***
## inte2 -0.271435 0.245018 -1.108 0.267941
## inte3 0.271327 0.248025 1.094 0.273977
## T_avg.CDC. 0.014344 0.021548 0.666 0.505613
## RH_avg.CDC. 0.019763 0.006991 2.827 0.004702 **
## roof_t2 -0.061034 0.181420 -0.336 0.736551
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Threshold coefficients:
## Estimate Std. Error z value
## 0|1 1.2597 0.6125 2.057
## 1|2 2.0788 0.6170 3.369
## 2|3 2.6579 0.6208 4.281
## 3|4 3.1174 0.6245 4.992
## 4|5 3.4157 0.6276 5.442
## 5|6 3.5109 0.6288 5.583
## 6|7 3.7944 0.6329 5.996
## 7|8 4.0612 0.6376 6.370
## 8|9 4.2189 0.6410 6.582
## 9|10 4.4016 0.6456 6.818
## 10|11 4.4419 0.6467 6.868
## 11|12 4.4837 0.6480 6.920
## 12|13 4.7740 0.6577 7.258
## 13|14 5.0215 0.6685 7.512
## 14|16 5.1704 0.6762 7.646
## 16|17 5.5493 0.7014 7.912
## 17|18 5.8064 0.7238 8.022
## 18|19 5.9637 0.7401 8.057
## 19|22 6.1489 0.7624 8.065
## 22|23 6.3746 0.7946 8.022
## 23|25 6.6650 0.8455 7.883
## 25|29 7.0729 0.9389 7.533
## 29|36 7.7679 1.1754 6.609