I was having a problem while running the bayesLife package. For your information, I have successfully installed the package and my Rstudio is the updated version (4.3.2). Nevertheless, the output keeps showing that it could not find the function bayesLife, what should I do? I am really hoping for an answer soon. Because currently, I am working on my final year project.
install.packages("bayesLife")
install.packages("bayesTFR")
install.packages("lubridate")
library("bayesLife")
library("bayesTFR")
library("lubridate")
library(readxl)
le_female <- read_excel("FYP SEM6/le_female.xlsx")
View(le_female)
head(le_female)
country_code <- "Malaysia"
le_data <- le_female[which(le_female$Location == country_code),]
View(le_data)
years <- le_data$Year
life_expectancy <- le_data$Adjusted Life Expectancy
str(le_data)
head(le_data)
"Year" %in% names(le_data)
"Adjusted Life Expectancy" names (le_data)
all(is.numeric(le_data$Adjusted Life Expectancy
))
"Adjusted Life Expectancy" %in% names(le_data)
plot(years, life_expectancy, type = "l", main = paste("Life Expectancy in", country_code),
xlab = "Year", ylab = "Life Expectancy", col = "blue")
model <- bayesLife(years=years, data=life_expectancy, iterations=10000)
fit <- model$fit()