## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup--------------------------------------------------------------------
library(ProfileGLMM)

data("exposure_data")
exp_data = exposure_data$df
head(exp_data)

## -----------------------------------------------------------------------------
covList = {}
covList$FE = c('X')

covList$RE = c('t')
covList$REunit = c('indiv')

covList$Lat = c('X')

covList$Assign$Cont = c('Exp1','Exp2')
covList$Assign$Cat = NULL

covList$Y = c('Y')
dataProfile = profileGLMM_preprocess(regType = 'linear',
                                     covList = covList,
                                     dataframe = exp_data,
                                     nC = 30,
                                     intercept = list(FE = T, RE = F, Lat = T))
print(dataProfile)

## -----------------------------------------------------------------------------
print(dataProfile$prior)

## -----------------------------------------------------------------------------
print(dataProfile$theta)

## -----------------------------------------------------------------------------
# Set the fixed-effect intercept starting value to 10
dataProfile$theta$betaFE[1] = 10

## -----------------------------------------------------------------------------
print(paste("Old FE intercept parameter:", dataProfile$theta$betaFE[1]))

dataProfile$theta = theta_init(dataProfile$prior, dataProfile$params)

print(paste("New FE intercept parameter:", dataProfile$theta$betaFE[1]))

## -----------------------------------------------------------------------------
# Set a stronger penalty on the fixed-effect prior
dataProfile$prior$FE$lambda = 100

# Redraw initial values using the updated prior
dataProfile$theta = theta_init(dataProfile$prior, dataProfile$params)

# Check the updated initial fixed-effect parameters
print(dataProfile$theta$betaFE)

