inst/doc/Cosinor.R

## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup--------------------------------------------------------------------
library(card)

# Using the provide dataset
data("twins")
head(twins)

## -----------------------------------------------------------------------------
library(ggplot2)
ggplot(twins, aes(x = hour, y = rDYX)) +
  geom_smooth(method = "gam")

## -----------------------------------------------------------------------------
# Model
m <- cosinor(rDYX ~ hour, data = twins, tau = 24)

# Summary
summary(m)

# Plot
ggcosinor(m, labels = TRUE)

## -----------------------------------------------------------------------------
# Model
m <- cosinor(rDYX ~ hour, data = twins, tau = c(24, 12))

# Summary
summary(m)

# Plot
ggcosinor(m, labels = TRUE)

## -----------------------------------------------------------------------------
# Model
m <- cosinor(rDYX ~ hour, data = twins, tau = c(24), population = "patid")

# Summary
summary(m)

Try the card package in your browser

Any scripts or data that you put into this service are public.

card documentation built on April 3, 2025, 10:52 p.m.