departamento de farm acia t farma céutica facultad de...
TRANSCRIPT
P
Depar
Pharma
develop
tamento
FA
UN
cokineti
pment o
o de Farm
ACULTA
NIVERSID
ic/Pharm
f novel
d
Arianna
macia y T
AD DE F
DAD DE
macodyn
drugs fo
disorder
a Madrid
Tecnolog
FARMAC
E NAVA
namic M
or the tr
rs
d Aispuro
gía Farma
CIA
ARRA
Modellin
reatment
o
acéutica
ng durin
t of slee
ng
ep
P
Trab
Doct
Depar
Pharma
develop
bajo presen
tor en Farm
tamento
FA
UN
cokineti
pment o
ntado por
macia.
Fd
o de Farm
ACULTA
NIVERSID
Te
ic/Pharm
f novel
d
r Arianna
do: Arian
macia y T
AD DE F
DAD DE
esis Doct
macodyn
drugs fo
disorder
Madrid A
nna Mad
Tecnolog
FARMAC
E NAVA
oral
namic M
or the tr
rs
Aispuro p
drid Aisp
gía Farma
CIA
ARRA
Modellin
reatment
para obten
puro
acéutica
ng durin
t of slee
ner el gra
ng
ep
ado de
Dº. JOSÉ IGNACIO FERNÁNDEZ DE TROCÓNIZ FERNÁNDEZ, Doctor
en Farmacia y Profesor Titular en la Universidad de Navarra y Dª. MARIA
DE LA NIEVES VÉLEZ DE MENDIZÁBAL CASTILLO, Doctora en
Ingeniería Informática certifica que: El presente trabajo:
“Pharmacokinetic/Pharmacodynamic Modelling during development of
novel drugs for the treatment of sleep disorders”, presentado por Dª.
Arianna Madrid Aispuro para optar al grado de Doctor ha sido realizado
bajo su dirección y una vez revisado, no encuentran objeciones para que sea
presentado para su lectura y su defensa.
Y para que así conste, firman el presente certificado en Pamplona, a 21 de
Marzo del dos mil trece.
Fdo: José Ignacio Fernández de Trocóniz Fernández
Fdo: María de las Nieves Vélez de Mendizábal Castillo
P
Depar
Pharma
develop
tamento
FA
UN
cokineti
pment o
o de Farm
ACULTA
NIVERSID
ic/Pharm
f novel
d
Ariann
macia y T
AD DE F
DAD DE
macodyn
drugs fo
disorder
na Madrid
Tecnolog
FARMAC
E NAVA
namic M
or the tr
rs
Aispuro
gía Farma
CIA
ARRA
Modellin
reatment
acéutica
ng durin
t of slee
ng
ep
ʺNo amount of experimentation, however many they may be, can ever prove me
right; only a single experiment can prove me wrong ʺ
ʺNingún numero de experimentos, por muchos que sean, podrán demostrar que
tenga razón; Tan solo un experimento puede demostrar que estoy equivocadoʺ
Albert Einstein
Dedicated to my parents
Without your support, I would not be here
ACKNOWLEDGEMENTS
I would like to acknowledge the following persons and institutions:
The University of Navarra, especially the Head of the Department of Pharmacy
and Pharmaceutical Technology, Dr. Maria del Carmen de Dios Viéitez, and the
previous Head of the Department Dr. Conchita Tros de Ilarduya Apaolaza.
Elli Lilly & Company at Erlwood UK and Global PK/PD/Trial Simulation group,
who provided me with financial support, the permission to use the data they were
funding, and providing data for this dissertation. Special acknowledgement to
Kimberley Jackson, for her dedication and contribution to the thesis; Dinesh de
Alwis and some colleges of Elli Lilly Cheryl, Paul, Gemma, Celine, John, Giny
Wood and her husband. I am very thankful for the great time during my
internship. I would like to extend thanks to Discovery Sleep Research (DSR) group
at Erl Wood, for providing the data insight without which this dissertation would
not have been possible.
I would like to acknowledge my supervisor Dr. Iñaki Fernández de Tróconiz, for
his support over the years, his ideas and his contributions to the improvement of
my thesis. To my co‐supervisor, Dr. Nieves Vélez, I would like to extend my
deepest gratitude for his encouragement, guidance, and patience. I would like to
thank a Dr. Lorea Bueno for her patience to teach me the tools to get started in the
world of the pharmacometrics.
I would like to thank all of my coworkers and friends at the Department of
Pharmacy and Pharmaceutical Technology, especially to the pharmacometrics
team (Maria Jesus, Maria, Núria, Álvaro, Sara, Ana and Zinnia). Iʹm grateful for
their ideas and suggestions during these years together.
To all my Pharmaceutical Chemistry Biologist colleagues at the University
Autonomous of Sinaloa, especially to Dr. José Guillermo Romero Navarro for his
advise, guidance, and for motivating me to continue my studies. I would like to
thank Dr. Miriam del Carmen Carrasco Portugal and Dr. Francisco Flores Murrieta
for giving me the opportunity to continue my professional career.
To my dear family in Pamplona, Elba, Marisin, Elena, Ángel and Ignacio thanks a
lot for listening to me in both personal and professional difficult moments. To my
lovely friends Koldo, Melissa, Cesar, Paula, Cristina, Ana, Maria, Judith, Jon, Lara,
Ulrich and my flat housemate Lucia. I am especially thankful to Mexicans group in
Pamplona for giving me great moments and to my friends of Volkswagen. Iʹm
grateful for my friends I have made, for the good times we have shared, and the
wonderful memories that I will carry with me.
Finally, I wish to thank my family (Flor, Renato, Eliana, Keilla and Roxana). Their
unconditional love and understanding gave me the confidence to continue every
day. I will always remember their support and affection during all moments away
from home.
Table of Contents
TABLE OF CONTENTS
PREFACE ...................................................................................................................................... 7
ABBREVIATIONS ...................................................................................................................... 8
INTRODUCTION ..................................................................................................................... 14
1. Sleep ......................................................................................................................................... 15
2. Measurement of sleep ............................................................................................................ 16
2.1. Electroencephalogram (EEG) ......................................................................................... 17
2.2. Electro‐oculography (EOG) ............................................................................................ 18
2.3. Electromyography (EMG) .............................................................................................. 19
3. Physiology of Sleep ................................................................................................................ 20
3.1. Receptors involved in sleep ........................................................................................... 22
4. Neurology of Sleep ................................................................................................................ 25
5. Classification of Sleep Disorders .......................................................................................... 29
6. Mathematical Models Applied to Sleep Data .................................................................... 32
6.1. The “Flip‐Flop” Switch Model ....................................................................................... 34
6.1.1. Mathematical representation of the ʺFlip‐Flopʺ Switch Model .............................. 36
7. Pharmacologic treatment of Sleep Disorders ..................................................................... 40
7.1. Pharmacokinetics of Zolpidem ...................................................................................... 42
7.2. Pharmacodynamics of Zolpidem .................................................................................. 43
8. Futures treatments for sleep disorders ............................................................................... 44
9. Pharmacometrics .................................................................................................................... 47
9.1. Model‐Based Drug Development ................................................................................. 48
10. PK/PD Modelling in Sleep .................................................................................................. 50
REFERENCES ............................................................................................................................. 53
Table of Contents
AIM AND OBJECTIVES ......................................................................................................... 62
Pharmacokinetic/Pharmacodynamic Modelling of the Sleep effects of Zolpidem in
Rats. .............................................................................................................................................. 64
Material and Methods ............................................................................................................... 67
Sleep‐Wake Bioassay ................................................................................................................. 67
Animals and surgical procedure. ............................................................................................... 67
Vehicle and drug administration. .............................................................................................. 68
Study design. ............................................................................................................................. 68
Automated monitoring of EEG ................................................................................................. 69
Data analysis. ............................................................................................................................ 70
Baseline Model Development ................................................................................................... 70
Model for vehicle and drug effects .......................................................................................... 75
Software and model selection ................................................................................................... 78
Model evaluation ....................................................................................................................... 78
External model evaluation. ....................................................................................................... 79
Results ......................................................................................................................................... 80
Discussion ................................................................................................................................... 89
Conclusions ................................................................................................................................ 93
SUPPLEMENTARY MATERIAL ........................................................................................... 95
REFERENCES ............................................................................................................................ 96
APPENDIX ............................................................................................................................... 101
APPENDIX 1 ............................................................................................................................ 102
Table 1. List of the international Classification of Sleep Disorders version 2 of 2005* 102
APPENDIX 2 ............................................................................................................................ 104
SCRIPTS: INPUT FILES FOR NONMEM .......................................................................... 104
Table of Contents
BASELINE MODEL .............................................................................................................. 104
‐ FROM AWAKE .................................................................................................................. 104
‐ FROM NREM ...................................................................................................................... 108
‐ FROM REM ......................................................................................................................... 112
SIMULATION OF BASELINE MODEL ............................................................................ 116
APPENDIX 3 ............................................................................................................................ 125
VEHICLE MODEL ............................................................................................................... 125
SIMULATION OF VEHICLE MODEL .............................................................................. 129
APPENDIX 4 ............................................................................................................................ 138
DRUG EFFECT MODEL ...................................................................................................... 138
SIMULATION OF DRUG EFFECT MODEL .................................................................... 143
APPENDIX 5 ............................................................................................................................ 153
SCRIPTS: INPUT FILES FOR MATLAB ............................................................................ 153
DESCRIPTORS OF SLEEP ................................................................................................... 153
1. PERCENTAGE OF SLEEP STAGES ............................................................................... 153
2. TRANSITIONS PROBABILITIES ................................................................................... 158
2.1. From AWAKE ................................................................................................................ 158
2.2. From NREM ................................................................................................................... 164
2.3. From REM ....................................................................................................................... 170
3. NUMBER OF TRANSITIONS ......................................................................................... 176
4. MAXIMUM TIME CONSECUTIVE ............................................................................... 179
4.1. AWAKE .......................................................................................................................... 179
4.2. NREM .............................................................................................................................. 184
4.3. REM ................................................................................................................................. 189
APPENDIX 6 ............................................................................................................................ 194
Table of Contents
SCRIPTS: VISUAL PREDICTIVE CHECK ........................................................................ 194
1. PERCENTAGE OF SLEEP STAGE ................................................................................. 194
VISUAL PREDICTIVE CHECK .......................................................................................... 197
2. TRANSITIONS PROBABILITIES ................................................................................... 197
‐ Drugs Simulated data from AWAKE .............................................................................. 197
‐ Drugs Observed data from AWAKE ............................................................................... 198
‐ Drugs Simulated data from NREM ................................................................................. 202
‐ Drugs Observed data from NREM .................................................................................. 203
‐ Drugs Simulated data from REM ..................................................................................... 207
‐ Drugs Observed data from REM ..................................................................................... 208
APPENDIX 7 ............................................................................................................................ 212
Table 2 . Summary of Sleep Descriptors * ......................................................................... 212
Preface
PREFACE
This project has been funded by the Global PK/PD and Simulation Department of
Eli Lilly & Co at Erlwood (UK). Data was provided by the Discovery Sleep
Research (DSR) group at Erl Wood at Elli Lilly U.K.
The present work was focused on the Pharmacokinetic/Pharmacodynamic (PK/PD)
modelling aspects of the sleep stage effects of drugs used to treat sleep disorders,
such Zolpidem, in pre‐clinical studies.
The current memory has been organized as follows: (i) in the introduction section
basic information about sleep, and sleep disorders is provided. In addition a
summary of the current pharmacological treatments is presented. A list of
examples in which pharmacokinetic/pharmacodynamic (PK/PD) modelling has
been applied to describe the time course of sleep stages is given also in the
introduction section; (ii) the aims of the current investigation are described
concisely in the section of objectives; (iii) Material and methods provides a detailed
description of type of models required to described the time course of sleep stages,
introduce drug effects, and how to perform model evaluation; section (iv)
describes the results obtained during model development, and in section (v) a brief
overall discussion is presented. Given the complexity of the models developed in
the current investigation appendixes containing examples of dataset organization,
NONMEM codes for parameter estimation, and simulation, as well as Matlab
scripts for summarizing and graphical representation of results are also provided.
Abbreviations
ABBREVIATIONS
Abbreviation Definition
‐2LL
5‐HT
AASM
ACh
AMIN
APSS
ASDA
AUC
BF
BDZ
CIDS
CL
Cmax
CNS
Cp
‐2xlog likelihood
Serotonin
American Academy of Sleep Medicine
Cholinergic
Monoaminergic cell group
Association for the psychophysiological study of sleep
American Sleep Disorders Association
Area under the plasma concentration vs time curve
Basal Forebrain
Benzodiazepines
International Classification of sleep disorders.
Total Plasma Clearance
Maximum Drug Concentration
Central Nervous System
Plasma Drug Concentration
Abbreviations
Cps
CV
DA
DIMS
DOES
DR
DRN
Drugs‐Z
DSR
DV
EC50/IC50
EEG
EMAX
EMG
EOG
ePD
F
FDA
Cycle per Second
Coefficient of Variation
Dopamine
Disorders of Initiating and Maintaining sleep
Disorders of excessive somnolence
Doral Raphe
Dorsal Raphe Nucleus
Zolpidem, Zopiclone and Zaleplon
Discovery Sleep Research
Dependent variable (observations)
Drug concentration that produces half of Emax
Electroencephalogram
Maximum response that the drug can elicit
Electromyography
Electrooculogram
In vivo efficacy
Bioavailability
Food and Drug Administration
Abbreviations
FDA
GABA
Gal
Glu
Gly
Hcrt
His
HOM
Hz
ICSD
ISV
Ka
Kel
Ki
Kpd
LC
LDT
LHA
Food and Drug Administration
Gamma‐Aminobutyric acid
Galanin or galaninergic
Glutamate or glutamatergic
Glinina or Glycinergic
Hypocretinergic
Histamine
Homeostatic
Hertz
International classification of sleep disorders
Inter‐Subject Variability
Firs order rate constant of absorption
Firs order rate constant of elimination
Binding constant
Binding affinity
Locus Coeruleus
Latero dorsal tegmental
Literal Hypothalamus
Abbreviations
LOGIT
LPT
M
MC
MCH
MCM
MnPo
NA
nH
NONMEM
NREM
NRPO
ORX
PAG
PB o PBN
PC
PD
Logistic Regression
Lateral Pentine Tegmentum
Modulator
Methylcellulose
Melanin concentrating hormone
Markov Chain Model
Preoptic Nucleus
Noradrenalin
Hill slope
Non‐linear Mixed Effects Modelling
Non‐Rapid Eyes Movement
Reticularis pontis oralis
Orexin
Periaqueductal gray
Parabrachial Nucleus
Precoeroleus Region
Pharmacodynamic
Abbreviations
PDV
PFP
PK
PK/PD
PM
PO
PPT
PSG
PT
REM
SCN
SEMs
SLD
t1/2
Tanh
tmax
TDW
Previous dependent value
Pontine Reticular Formation
Pharmacokinetic
Pharmacokinetic/Pharmacodynamic
Pharmacometrics
Orally
Pedunculopontine
Polysomnography
Probability of Transition
Rapid Eyes Movement
Suprachiamatic Nucleus
Slow eye movements
Sub‐Laterodorsal Nucleus
Half‐life
Hyperbolic Tangent
Time of maximum observed drug concentration
θ‐dominated wake
Abbreviations
TMN
TP
TST
V
vIPAG
VLPO
vPAG
VPC
VTA
WASO
Zol
α
Tuberomammillary nucleus
Transitions Probabilities
Total Sleep Time
Volume of distribution
Adjacent Ventral Periaqueductal gray matter
Ventrolateral Preoptic Nucleus
Periaqueductal Gray
Visual Predictive Check
Ventral Tegmental Area
Wake time after sleep onset
Zolpidem
Intrinsic activity
INTRODUCTION
Introduction
15
1. Sleep
Sleep can be defined in behavioral terms as a normal, recurring, reversible state of
loss of awareness with inability to perceive and respond to the external
environment. The voluntary motor activity largely ceases and a quiescent posture,
specific to each species, is adopted. Sleep is present in mammal’s species and the
length of sleep is varying between size and species (Table 1).
Table 1. Daily Sleep Quotas in a Sample of Mammalian Species.*
Species Total Daily Sleep Time
(h)
Daily REM Time
(h)
Echidna 9.0 ?
Opossum 18.0 5.0
Hedgehog 10.0 3.5
Mole 8.5 2.0
Bat 19.0 3.0
Baboon 9.5 1.0
Humans 8.0 2.0
Armadillo 17.0 3.0
Rabbit 8.0 1.0
Hamster 14.0 3.0
Rat 12.0 2.5
Squirrel 14.0 3.0
Guinea pig 9.5 1.0
Dolphin 10.0 ?
Seal 6.0 1.5
Cat 12.5 3.0
Dog 10.0 3.0
Horse 3.0 0.5
Giraffe 2.0 0.5
Total daily sleep time includes daily REM time. Values are rounded to the half
hour and exclude prolonged drowsiness. Some values are averages for two or
more members of the same genus. Question marks indicate reported absence of
REM sleep. * (Kryger, Roth et al. 1994, McCarley 2007).
Introduction
16
Sleep is generated by the brain but is associated with profound changes in
physiology elsewhere in the body. Contrary to early belief, the neurophysiology of
sleep involves active and dynamic changes in neural functioning and is far from a
passive process of absence of wakefulness (Silber, Krahn et al. 2010).
2. Measurement of sleep
In 1967, the Association for the Psycho‐physiological Study of Sleep (APSS)
chartered a committee of sleep researchers to establish a standard system for
visually scoring stages of sleep. The result was the “Manual of Standardized
Terminologyʺ, ʺTechniques and Scoring Systems for Sleep Stages of Humans
Subject’sʺ (edited by Alan Rechtschaffen and Anthony Kale). The manual and its
recommendations have been well accepted and the system has spread across the
world (Hori, Sugita et al. 2001). The goal of this was to standardize recording
techniques, to create a standard system for visually scoring stages of sleep and to
establish criteria that could compare the results reported by different investigators
worldwide.
The sleep research is a relatively young discipline that uses a Polysomnography
(PSG) recording, which is a multichannel recording instrument designed to
document a variety of physiological activities captured in humans and in rats that
are necessary for the sleep analysis (Figure 1). The PSG receives three main
physiological signals: Electroencephalography (EEG), electro‐oculography (EOG)
and electromyography (EMG).
Figur
The
Germ
basis
elect
activ
Elect
findi
(Silb
re 1. Bioassay
2.1. El
human sc
many (1929
s of the EE
trodes that
vity from sy
trodes are
ing the co
er, Krahne
y system for s
lectroenc
calp electro
9). Underst
EG and th
t are attach
ynapses in
applied ac
orrect elect
et al. 2010).
sleep analyse
ephalogr
oencephalo
tanding sle
he manner
hed to mu
the upperm
ccording to
trode sites
es in rats. Mo
ram (EEG
ogram wa
eep physio
r in which
ltiple area
most level
o the Inter
measurin
odified (Ueno
G)
as first rec
ology requi
h it is reco
s of the sc
s of the cer
rnational 1
ng from ce
o, Honda et a
corded by
ires some k
orded. EEG
calp. They
rebral corte
0–20 syste
ertain anat
Introd
al. 1983).
Hans Ber
knowledge
G is record
record ele
ex.
em, a meth
tomic land
duction
17
rger in
e of the
ded by
ectrical
hod for
dmarks
Introduction
18
EEG frequency is identified by the number of waves or cycles occurring within a
period of one second, described as cycles per second (cps) or Hertz (Hz). The
standard sleep staging manual provides details for the staging of normal human
sleep. The most common EEG frequency bands used for sleep stage scoring are
Alpha (8‐13 Hz), Beta (greater than 13 Hz), Delta (less than 4 Hz) and Theta (4‐7
Hz). The other EEG parameter is wave amplitude, which is measured from trough
to peak (Butkov, Lee‐Chiong 2007).
In general for the Wake state, the EEG registers low‐amplitude, high frequency
oscillations. The EEG in NREM sleep stages corresponds to high amplitude, high
frequency oscillations. REM was represented by low amplitude, high frequency
oscillations that look like the waking EEG, but are accompanied by other
characteristics for their identification between sleep stages (Crocker, Sehgal 2010).
2.2. Electro‐oculography (EOG)
Eye movement monitoring, is based on recording the potential difference between
the back of the eye and the front on the eye. The retina is electronegative with
respect to the cornea, causing voltage changes to occur when the eye moves in
relation to the EOG electrodes. There are two reasons for recording eye movement
activity during sleep. The first is to record rapid eye movement, a cardinal sign of
REM sleep, and secondly for assessing the onset of sleep that is typically
accompanied by slow eye movements (SEMs) (Butkov, Lee‐Chiong 2007).
Introduction
19
2.3. Electromyography (EMG)
The EMG from muscles groups is used as a criterion for staging REM sleep. The
EMG is very important to evaluate patients, who have periodic movements in
sleep that sometimes are used to monitor respiratory effort. Most EMG recordings
during sleep require taping electrodes to the skin over the muscle group of
interest. In the waking stage, an intense muscular activity is detected. The NREM
sleep is associated to low voltage of EMG. However, the REM sleep is associated
with an absence of EMG activity (Depoortere, Francon et al. 1993, Kryger, Roth et
al. 1994).
Introduction
20
3. Physiology of Sleep
In 1968, Rechtschaffen and Kales published a scoring manual, identifying the
characteristic features of NREM and REM sleep, with NREM divided into 4 stages:
Transitional sleep (stage 1), light sleep (stage 2), slow wake sleep (stages 3 and 4)
and paradoxical sleep (stage REM).
The sleep cycle starts with a period of NREM sleep, REM sleep occurs after a short
period of NREM sleep, this alteration between NREM and REM takes place about
4‐5 times during a normal night’s sleep in adult human. The average length of the
first NREM‐REM sleep cycle is approximately 70 to 100 minutes; the average
length of the second and later cycles is approximately 90 to 120 minutes (Kryger,
Roth et al. 1994).
The REM sleep accounts for 20‐25% of total sleep time (TST). The NREM sleep is
characterized by progressively decreased responsiveness to external stimulation
(See table 2). It is believed that approximately 80% of dreams occur during REM
sleep and 20% occur during NREM sleep (Chokroverty 2010).
The human and animal sleep depends on two major factors: a circadian regulator,
defining the diurnal rhythm, and a homeostatic regulator governing the
relationship between wake and time sleep times.
Introduction
21
The circadian process is a self‐sustained oscillation that is generated in the
suprachiasmatic nuclei (SCN) of the hypothalamus in mammals (Andretic,
Franken et al. 2008).
Table 2. Behavioral and Physiological criteria of wakefulness and sleep.*
Criteria AWAKE NREM sleep REM sleep
Posture Erect, sitting, or
recumbent
Recumbent Recumbent
Mobility
Normal
Slightly reduced or
immobile; postural shifts
Moderately reduced or
immobile; myoclonic jerks
Response to stimulation
Normal
Mild to moderately
Reduced
Moderately reduced to no
Response
Level of alertness
Alert
Unconscious but reversible
Unconscious but
reversible
Eyelids
Open
Closed
Closed
Eye movements
Waking eye movements
Slow rolling eye
movements
Rapid eye movements
EEG
Alpha waves;
desynchronized
Synchronized
Theta or saw tooth waves;
desynchronized
EGM (muscle tone) Normal Mildly reduced Moderately to severely
reduced or absent
EOG
Waking eye movements
Slow rolling eye
movements
Rapid eye movements
* (Chokroverty 2010).
Introduction
22
3.1. Receptors involved in sleep
Pharmacology plays an important role in the therapy of sleep disorders, targeting
several transmitters and peptides, including γ‐aminobutyric acid GABAergic,
Serotonergic, Histaminergic and Hypocretigergic (orexinergic) systems (Winsky‐
Sommerer 2009).
The GABA receptor is a multicomponent transmembrane protein complex with
multiple ligand binding sites. The subtypes of GABA receptors have been
classified into three groups, termed GABAA, GABAB and GABAC, on the basis of
their pharmacological profiles. These receptors have different characteristics:
GABAA and GABAC receptors are ionotropic, while the GABAB receptors are
metabotropic. GABA is an order of magnitude less potent at GABAA than GABAc
receptors (Chebib, Johnston 1999).
GABAA receptors are of particular therapeutic interest because their activity can be
modified with a wide variety of drugs that act upon the benzodiazepine and other
sites (Bateson 2004). GABAA is fundamental to understand the mode of action and
clinical effects of the non‐benzodiazepine GABAA receptor modulators. The
GABAA complex is a major inhibitory receptor in the central nervous system
(CNS), functioning as an ion channel that alters chloride ion conductance across
the cell membrane (Bateson 2004, Ebert, Wafford 2006).
The
serot
medi
antic
The b
speci
num
activ
neur
Figur
comp
GABA
amne
GABA
associ
betwe
spann
neuronal c
toninergic,
iated inhib
convulsant
benzodiaz
ific GABA
mber of sep
vity of G
rosteroids,
re 2. Schema
posed of pen
AA receptors
esic activities
A in two GA
iated chlorid
een α and γ2
ning transme
circuits inf
and nor
bition and
effects of d
epine (BDZ
AA receptors
parate bind
GABA. Th
anesthetics
atic illustrati
ntameric chan
are pluripot
contain reco
ABA binding
de (CL‐) cha
subunits. Ba
embrane regi
fluenced by
radrenergi
also media
drugs such
Z) receptor
s, which h
ding sites
hese inclu
s, channel b
ion of the G
nnel, being c
tent drug tar
ognition sites
g sites at the
annel. The b
arbiturates, e
ons subunits
y GABAer
ic pathwa
ate the sed
h as benzod
r agonists
have a rich
for a vari
ude benz
blockers an
GABAA recep
composed of
rgets mediat
s for a variety
e interface be
benzodiazepi
thanol, and n
s (Reddy 2008
rgic inhibit
ays. They
ative, anxi
diazepines
are known
h pharmaco
iety of dru
odiazepine
nd ionic zin
ptor. It is b
f two α and
ing anxiolyti
y of clinically
etween α an
ine binding
neurosteroid
8).
tion includ
are invo
iolytic, mu
(Nutt, Stah
n as positiv
ology beca
ugs that ca
es, barbit
nc (see figu
built from se
β subunits,
ic, sedative,
y relevant dr
nd β subunit
site is locat
ds bind to site
Introd
de dopamin
olved in
scle relaxa
hl 2010).
ve modula
ause they h
an modula
turates, et
ure 2).
everal subun
and one γ s
anticonvulsa
rugs. The bin
ts open the r
ted at the i
es in the mem
duction
23
nergic,
GABA
ant and
ators of
have a
ate the
thanol,
nits and
subunit.
ant, and
nding of
receptor
nterface
mbrane‐
Introduction
24
The receptor α1 subunit is the most common of the GABAA subunits and is widely
distributed throughout most brain regions, especially throughout the cortex (see
table 3 for the role of this receptor).
The α2 subunits are found primarily in the hippocampus, amygdala and basal
ganglia, as well as in the outer layers of the cerebral cortex. The α3 subtype is
expressed in a limited number of brain regions, such as the reticular thalamic
nucleus and inner layers of the cerebral cortex, and α5 receptors are found
primarily in the limbic system and inner layers of the cerebral cortex. The alpha 1,
2, 3 and 5 subunits appear to be the key determinants of hypnotic drug effects on
sleep, mood and cognition (Silber, Krahn et al. 2010).
Table 3. Distribution and functional effects of GABAA receptor alpha subunits.*
Subunit Regional distribution (Key areas) Putative role
Alpha 1 All brain regions Sedative; anticonvulsant; memory
Alpha 2
Cerebral cortex, hippocampus, amygdala,
basal ganglia, hypothalamus, septal and basal
forebrain
Sleep/wake switch; EEG activity;
anxiolytic.
Alpha 3 Cerebral cortex, reticular thalamic nucleus Sleep; anxiolytic; antidepressant
Alpha 5 Cerebral cortex, hippocampus Learning and memory
*(Chokroverty 2010).
Introduction
25
4. Neurology of Sleep
The information about the neurology of sleep is derived from mammalian models.
Some studies have shown the sleep and wakefulness are controlled by multiple
neuronal systems involving a variety of neurotransmitters like: Glutamate (Glu),
Acetylcholine (Ach), Noradrenaline (NA), Dopamine (DA), Serotonine (5HT),
Histamine (His), Adenosine, GABA, and Orexin (ORX) (Jones 2005, Andretic,
Franken et al. 2008). The hypothalamus has been rediscovered as a key regulator of
sleep and wakefulness cycle (Mignot, Taheri et al. 2002). There are no discrete
sleep‐wake promoting centers but these states are produced by changes in the
interconnecting neuronal systems modulated by neurotransmitters and
neuromodulators.
The wakefulness promoting is mediated by the hypocretins neurons, hat are
peptide neurotransmitters secreted by small group of cells in the posterolateral
hypothalamus. These neurons fire actively in wakefulness but are silent in NREM
and REM sleep (Silber, Krahn et al. 2010).
The role of neurotransmitters like NA is increased during wakefulness activity and
decreased during NREM and REM sleep. 5HT neurons are more active during
wakefulness with an increase in sleep onset latency (the transition from wake to
sleep) and decrease in REM sleep. Also the works of histamine blockers are to
promote sleep onset and increase NREM sleep. The neuroanatomical substrates of
Introduction
26
REM and NREM sleep and wakefulness are located in separate parts of the central
nervous system (figure 3a).
The sleep‐state control is attributed to reciprocal monoaminergic‐cholinergic
interactions (figure 3b, c). The NREM sleep promoting is mediated by the mutual
inhibitory interactions between the preoptic area and the ascending
monoaminergic neurons (figure 3b).
Transitions between wake and sleeps stages are mediated by the mutually
inhibitory interactions involving different types of neurons. These interactions can
be modeled as a ʺflip‐flopʺ switch (figures 4,5), an engineering concept consisting
of two connected poles, each inhibiting the other (Saper, Fuller et al. 2010, Silber,
Krahn et al. 2010).
The REM sleep promoting generator is localized in the pontine tegmentum. During
REM sleep, they experiment GABAergic inhibition; adenosine seems necessary to
induce and increase sleep in specific brain regions such as the basal forebrain (BF)
and the ventrolateral preoptic nucleus (VLPO) area. Also the inhibitory
relationship system can be considered a REM‐NREM ʺflip‐flopʺ switch, promoting
rapid and complete transitions between these stages that allows for sharp
transitions between states of consciousness (Saper, Cano et al. 2005, Nutt, Stahl
2010). Figure 4 represents the complexity of the interaction mechanisms regulating
the sleep.
Figur
neuro
(a) W
the b
pendo
basal
Addit
norad
gray),
input
maint
nucleu
the co
sleep
spina
re 3. Schem
otransmitters
Wakefulness
brainstem (P
onculopontin
forebrain (BF
tionally, mo
drenergic (NA
histaminerg
s, contribute
tained by in
us (VLPO) to
ontrol of cho
atonia is und
l cord (in pur
matic sagittal
s involved in
is maintaine
PRF: pontin
ne tegmentum
F).
onoaminergic
A) (LC: locu
gic (His) (TM
e to the wa
nhibitory inp
o all wakeful
olinergic and
der the contr
rple) (Andret
l view of t
n the regulat
ed by choline
ne reticular
m) to the tha
c [in red; i
us coeruleus)
MN: tuberoma
aking cortic
uts (GABA
lness‐promot
d non‐cholin
rol of the glu
tic, Franken e
the rodent
tion of the vi
ergic (Ach: a
formation,
alamus, whic
.e., serotone
), dopaminer
ammillary nu
al activation
and Galanin
ting brain sit
nergic structu
utamatergic (
et al. 2008).
brain show
igilance state
acetylcholine;
LDT: latero
ch in turn ac
ergic (5HT)
rgic (DA) (vP
ucleus)], and
n. (b) NREM
n; in orange)
tes. (c) REM
ures arising f
(Glu) and gly
wing the ma
es.
; in blue) asc
odorsal tegm
ctivates the c
DRN: dors
PAG: ventra
d hypocretine
M sleep ma
from the ve
sleep cortica
from the bra
ycinergic (Gl
Introd
ajor structur
cending inpu
mentum, an
cortex, and f
sal raphe n
al periaquedu
ergic (Hcrt; i
ay be initiat
entrolateral p
al activation i
ainstem, whi
ly) projection
duction
27
res and
uts from
nd PPT:
rom the
nucleus),
uctal; in
in green)
ted and
preoptic
is under
ile REM
ns to the
Figur
popul
switch
indica
neuro
REM‐
norm
tegme
(TMN
Doral
Sub‐L
pentin
re 4. Summa
lations of wa
h at the upp
ate inhibitor
ons that inhib
‐on and excit
al individua
ental (PPT), L
N); Parabrach
l Raphe (DR)
Laterodorsal
ne tegmentum
ary of the
ake‐ and slee
er left and th
ry projection
bit the ventro
te the REM‐o
als to transit
Laterodorsal
hial nucleus
); Ventral pe
nucleus (SL
m (LPT); Ore
Cascading W
ep‐promotin
he REM‐on a
ns and green
olateral preo
off neurons i
tion directly
l tegmental (L
(PB); Precoe
eriaqueducta
LD); Adjacen
exin (ORX). M
Wake‐Sleep
g neurons ar
and REM‐off
n arrows exc
optic nucleus
in the REM
y from wake
LDT); Locus
eruleus regio
l gray (vPAG
nt ventral pe
Modified from
and REM‐N
re shown as
f populations
citatory one
s (VLPO) dur
switch, thus
efulness to a
Coeruleus (L
on (PC); Me
G); Melanin
eriaqueducta
m Lu et al., 2
NREM Flip‐F
components
s at the lowe
s.) The mon
ring wakeful
making it n
a REM state
LC); Tuberom
edian Preopt
concentratin
al gray matt
2006 (Saper, F
Introd
Flop Switch
s of a counte
er right. (Red
noaminergic
lness also inh
nearly imposs
e. Pedunculo
mammillary
tic nucleus (
ng Hormone
ter (vIPAG);
Fuller et al. 2
duction
28
hes. The
erpoised
d arrows
arousal
hibit the
sible for
opontine
nucleus
(MnPO);
(MCH);
Lateral
010).
Introduction
29
5. Classification of Sleep Disorders
There are more than 100 identified sleep/wake disorders. However, insomnia is the
most prevalent sleep complaint in general population (Kumar 2008). The
prevalence of sleep disorders affects about 10% to 40% of American adult’s
population, the cost estimate for lost productivity and insomnia‐related accidents
exceed $100 billion per year (Dang, Garg et al. 2011).
A classification of sleep disorders is needed due to the varied nature of the
diseases, and because the pathophysiology for many of the disorders is still
unknown. The first attempt to classify sleep disorders had its origin in 1979; this
classification organized the sleep disorders into symptomatic categories (table 4).
The first diagnostic classification of sleep disorder was published by the
Association for the Psychophysiological Study of Sleep (APSS) and remains as the
framework for the study of sleep disorders.
Sleep and arousal disorders were divided into four categories (table 4): the first
two are based on patient complaints and the third and fourth on presumed
pathophysiology. It has been recognized that the harmoniously named DIMS
(disorders of initiating and maintaining sleep) and DOES (disorders of excessive
somnolence) were not clearly separable (Silber, Krahn et al. 2010).
Introduction
30
In 1990, the international classification of sleep disorders (ICSD) was published in
collaboration with American Sleep Disorders Association (ASDA), the European
Sleep Research Society, the Japanese Society of Sleep Research, and the Latin
American Sleep Society under the leadership of Dr. Michael Thorpy (Kryger, Roth
et al. 1994). This classification was developed with research purpose, to improve
the sleep disorder investigation, then the finality of diagnostic and epidemiologic
(Thorpy 2012). The classification comprised 84 disorders and utilized a somewhat
different grouping of topics based on pathophysiologic concepts (see Table 5). The
term “dyssomnia” was introduced to define disorders producing a complaint of
either insomnia or sleepiness.
In 2002 the American Academy of Sleep Medicine, the successor to the ASDA, set
up a committee to; once again, revise the classification of sleep disorders. More
than 10 years had passed since the last major revision, and advances in the field
had again dictated the need for a new approach. (Appendix 1. presents a summary
of the current nosology). In the 2005 the ICSD underwent minor updates [ICSD‐2
(http://www.esst.org/adds/ICSD.pdf)].
Table 4. 1979 Classification of Sleep and Arousal Disorders.*
Clinical Phenomenology
A. DIMS: Disorders of initiating and maintaining sleep (insomnias)
B. DOES: Disorder of excessive somnolence
C. Disorders of the sleep‐wake schedule
D. Dysfunctions associated with sleep, sleep stages, of partial arousals (parasomnias)
Introduction
31
Table 5. The international Classification of Sleep and Arousal Disorders.*
Only some of the disorders in each category have been included *(Silber, Krahn et al. 2010).
Clinical Phenomenology
Dyssomnias
Intrinsic sleep disorders
Extrinsic sleep disorders
Circadian rhythm sleep disorders
Parasomnias
Arousal disorders
Sleep‐wake transition disorders
Parasomnias usually associated with REM sleep
Other parasomnias
Sleep disorders associated
with other medical or
psychiatric disorders
Associated with mental disorders
Associated with neurological disorders
Associated with other medical disorders
Proposed sleep disorders
Introduction
32
6. Mathematical Models Applied to Sleep Data
Models help to delineate the processes involved in the regulation of sleep and offer
a conceptual framework to interpret experimental data. Phillips 2007 developed a
model for the flip‐flop switch between wake and sleep in humans with parameter
values based on experimental sleep data. Various mathematical models have been
proposed to account for aspects of sleep regulation and circadian rhythm (Best,
Behn et al. 2007, McCarley 2007, Nakao 2007). These models consider that sleep
and wakefulness are regulated by two primary biological mechanisms:
Homeostatic and Circadian processes [see figure 6‐7 (Andretic, Franken et al.
2008)]. Table 6 summarizes the most representative models applied to the sleep. In
the following, the model we consider the most representative so far is described in
more detail.
Table 6. Models of sleep regulation*
Designation Assumption Description/Comment
TWO‐PROCESS MODEL AND
RELATED MODELS
Two‐process model
(Borbely 1982, Daan, Beersma et
al. 1984, Daan, Beersma 1984)
Sleep propensity is determined by
a homeostatic Process S and
circadian Process C. The
interaction of S and C determines
the timing of sleep and waking.
Time course of S derived from
EEG slow‐wave activity; phase
position and shape (skewed sine
wave) of C derived from sleep
duration.
Model of ultradian variation of
slow‐wave activity
(Achermann, Borbely 1990,
Achermann, Dijk et al. 1993,
Beersma, Achermann 1995)
Derived from the two‐process
model. The level of S determines
the buildup rate and the
saturation level of slow‐wave
activity within NREM sleep
episodes.
In contrast to the original two‐
process model, the change of S,
not the level of S, corresponds to
slow‐wave activity. A REM
sleep oscillator triggers the
decline of slow‐wave activity
prior to REM sleep.
Three‐process model of the
regulation of sleepiness/alertness
Sleepiness/alertness are simulated
by the combined action of a
homeostatic process, a circadian
Parameters derived from rated
sleepiness during sleep/wake
manipulations.
Introduction
33
(Åkerstedt, Folkard 1996,
Åkerstedt, Folkard 1997)
process, and sleep inertia (Process
W). Extension to include
performance, sleep latency and
sleep length.
Alertness normogram for sleep‐
related safety risks.
Interactive mathematical
models of cognitive throughput
(Jewett, Kronauer 1999)
Alertness and cognitive
throughput are determined by a
nonlinear interaction of a
homeostatic (H) and a circadian
process (C). In addition, sleep
inertia is included. H falls in a
sigmoidal manner during waking
and rises in a saturating
exponential manner at a rate
determined by circadian phase
during sleep.
Parameters derived from sleep
inertia studies, sleep deprivation
studies initiated across all
circadian phases, and 28‐h
forced desynchrony studies.
MODELS OF THE NREM‐
REM SLEEP CYCLE
Reciprocal interaction model
(McCarley, Hobson 1975,
Massaquoi, McCarley 1992)
NREM‐REM sleep cycle
generated by two coupled cell
populations in the brainstem with
self‐excitatory and self‐inhibitory
connections according to the
Lotka‐Volterra model.
Simulation of data: Discharge
rate of cholinergic FTG (or
LDT/PPT) cells in cat.
The roles of postulated cell
populations in the control of
REM sleep, and their
interactions have undergone
revisions (Massaquoi, McCarley
1992, Hobson, Lydic et al. 1986).
Limit cycle reciprocal interaction
model: Original version
(McCarley, Hobson 1975)
NREM‐REM sleep cycle
generated by the reciprocal
interaction of two coupled cell
populations (REM‐on and REM‐
off).
Main features of previous model
maintained, but assumption of a
stable limit cycle oscillation that
is independent of initial
conditions. Introduction of a
circadian term which
determines mode of approach to
limit cycle.
COMBINED MODELS
Composite model of sleep regulation
(Achermann, Borbely 1992)
Combination of elaborated two‐
process model with ultradian
dynamics, limit cycle reciprocal
interaction model, model of the
circadian pace maker, and sleep
inertia.
Different models proposed to
account for processes
underlying the regulation of
sleep and alertness are
considered as ʺmodulesʺ have
been integrated into a combined
model.
Limit cycle reciprocal interaction
model: Extended version
(Massaquoi, McCarley 1992)
As above; incorporation of sleep
homeostasis and arousal events.
Assumption of first‐order decay
dynamics for the arousal system.
Arousal as a stochastic process.
*(Achermann, Borbely 2003)
Introduction
34
6.1. The “Flip‐Flop” Switch Model
One remarkable feature of that state control system is that, both the wake and sleep
promoting neurons, like the ʺREM‐onʺ and ʺREM‐offʺ neurons, appear to be
mutually inhibitory. It has been proposed that the mutually antagonistic
relationship can describe a behavior similar to that seen with a flip‐flop switch
(Saper et al., 2001). Those types of switches are incorporated into electrical circuits
to ensure rapid and complete state transitions. In the brain, the neurons on each
side of the circuit inhibit those on the other side, if either side obtains a small
advantage over the other, it turns the neurons off on the other side, thus causing a
rapid collapse in activity and a switch in state. Flip‐flop switch consists of mutual
inhibition between the wake and sleep promoting groups. However, it is still less
clear how the REM‐NREM cycling occurs. Some ideas are: REM‐on population,
which promotes REM sleep, is mutually inhibitory with the REM‐off neurons that
induce the brief wake activation of following REM sleep (Lu, Sherman et al. 2006).
Although an electronic flip‐flop switch contains a single element on both side and
acts almost instantly, in the brain the mutual antagonism is between large
populations of neurons, numbering in the thousands on each side, which may also
be responding to other inputs. As a result, the transitions occur over seconds to
minutes (depending upon the species being studied), but result in clear‐cut
changes in behavioral and EEG states. The GABAergic neurons in each cluster
innervate and inhibit both the GABAergic and glutamatergic neurons in the other
side of the switch. The result is that transitions into and out of REM sleep are rapid
and complete.
Figur
which
pathw
pedun
indica
coeru
the c
ventro
and g
origin
VLPO
stabili
neuro
axons
inhibi
hypot
amine
and R
descri
(Sape
re 5. A mode
h produces
ways in gree
nculopontine
ates the VLP
uleus (LC) an
cortex and b
olateral preo
galaninergic
nates in the V
O. This inhib
izing the pr
ons. The exten
s innervate i
it REM‐prom
thalamic are
ergic neuron
REM‐promot
ibed in the te
r, Fuller et al
el for recipr
a flip‐flop s
en. The blue
e tegmental
PO. Aminer
nd dorsal rap
by inhibitio
optic nucleus
(GAL) proj
VLPO core, a
bition of the
roduction of
nded VLPO
interneurons
moting cells
ea (LHA) mi
ns, thus maint
ting neuron
ext. Broken b
l. 2010).
rocal interact
switch. Inhib
e circle indic
(PPT); gree
rgic regions
phé nucleus (
n of sleep‐
s VLPO inhib
ections. Mos
and input to
amine‐medi
sleep. The P
(eVLPO) mig
within the
in the PPT–
ight further
taining consi
s in the PP
black lines in
tions betwee
bitory pathw
cates neuron
en boxes in
such as the
(DR) promot
promoting n
bits amine‐m
st innervatio
the LC and D
iated arousa
PPT and LD
ght promote
PPT–LDT, a
–LDT. Orexi
stabilize be
istent inhibit
PT–LDT. Unb
ndicate influe
en sleep and
ways are sho
ns of the late
ndicate amin
e tuberomam
te wakefulne
neurons of
mediated arou
on of the tu
DR predomi
al system dis
DT also cont
REM sleep b
as well as am
in/hypocretin
havioral stat
tion of sleep‐
broken lines
ences of spec
d wake‐prom
own in red,
erodorsal teg
nergic nuclei
mmillary nu
ess by direct
the VLPO.
usal regions
uberomammi
inantly come
sinhibits VLP
ain REM‐pro
by disinhibiti
minergic neu
n neurons (
te by increa
‐promoting n
s represent
cific regions
Introd
moting brain
and the ex
gmental (LD
i; and the r
ucleus (TMN
excitatory ef
During sle
through GA
illary nucleu
es from the ex
PO neurons,
omoting cho
ing the PPT–
urons that n
ORX) in the
asing the act
neurons in th
neuronal pa
on behavior
duction
35
regions
xcitatory
DT); and
red box
N), locus
ffects on
eep, the
BAergic
us TMN
xtended
further
olinergic
–LDT; its
normally
e lateral
tivity of
he VLPO
athways
al states
The
unde
the ʺ
Robi
in hu
value
inhib
mon
neur
and
prev
that
integ
Figur
(Remp
6.1.1. M
M
mathemat
erlying phy
ʺflip‐flopʺ
inson prim
umans for
es based o
bitory inte
oaminergi
rons, and th
circadian
vious mode
also inco
grated them
re 6. Schema
pe, Best et al
Mathema
Model
tical mode
ysiology b
switch m
marily mode
r the “flip‐
on experim
eractions
c populat
he GABAe
influence
el and cou
orporated
m with mod
tic represent
. 2010).
atical rep
els can he
behind of s
model to d
elled sleep
‐flop” swi
mental slee
of differ
ion (AMIN
ergic signa
es (A.J.K.,
upled oscil
both the
dels of circ
ation of the m
presentati
elp to get
sleep patte
describe th
p and wake
tch betwee
ep data. Th
ent neuro
N), the ch
als of the V
Phillips 2
llator equa
wake‐slee
cadian and
model for the
ion of the
t insight i
erns. Many
he Sleep‐W
e transition
en wake a
his model
otransmitte
holinergic
VLPO, and
2007). Rem
ations to im
ep and R
homeosta
e sleep/wake
e ʺFlip‐Fl
into the m
y research
Wake cyclin
ns, they de
and sleep,
is based u
ers: the
populatio
includes b
mpe and
mplement
REM‐NREM
tic influenc
e and REM‐N
Introd
lopʺ Swit
mechanism
works beli
ng. Phillip
veloped a
with para
upon the m
wake‐prom
on of ʺRE
both home
colleagues
a similar
M circuitry
ces (figure
NREM switch
duction
36
tch
ms and
ieve in
ps and
model
ameter
mutual
moting
EM‐onʺ
eostatic
s used
model
y and
6).
hes
Introduction
37
The model includes the sleep‐promoting neurons in the VLPO region of the
hypothalamus, the wake‐promoting monoaminergic cell group, orexin neurons
(ORX), a circadian pacemaker corresponding to activity within the suprachiasmatic
nucleus, and input from cortical areas. It is also assumed that there is a sleep
homeostatic, (HOM), that increases while awake and decreases during sleep. This
model assumes that output of SCN inhibits VLPO. The sleep/wake flip‐flop model,
AMIN receives excitatory input from ORX. The orexin neurons receive excitatory
input from SCN and inhibitory input from VLPO.
The Sleep‐promoting and Wake‐promoting are each modeled as a system of two
ordinary differential equations accounting for the activity of distinct populations of
ʺactive sitesʺ, as follows:
Wake‐Promoting
′ , (1)
′ g ,
Sleep‐Promoting
′ , 2
′ g ,
Introduction
38
Here, and represent the overall population (AMIN, ORX, SCN, VLPO)
activity of the wake‐promoting cells and sleep‐promoting cells, respectively, and
and are constants. The variable ′ and ′ are recovery variables. The
nonlinear functions f and g are of the form.
, 3 2 and g , ∈ /
Where /0.01 is a smooth approximation of the Heaviside step‐
function; that is 0 0 1 0.
Moreover, is a time constant denoting the response time to switch states. This
is a step function that is of the form .
The constants and represent background cortical drives and and are
noise terms included to test the robustness of the model. The terms VLPO, AMIN,
SCN and ORX correspond to inputs of population cells form.
As an example of another application fo the ʺflip‐flopʺ switch, Diniz Behn
developed in rodents, a reduced‐network model including population for wake,
NREM, and REM sleep. The model of the flip‐flop switch produces wake‐sleep
cycling and the reciprocal interaction to create REM‐NREM oscillations. In
summary this study demonstrated the nocturnal rats spend a higher percentage of
time in sleep during the light period and spend more time awake while it is dark
(Behn, Brown et al. 2007, Diniz Behn, Kopell et al. 2008). In contrast the rats have a
poly
solid
The
(figu
(Dini
Figur
latero
mainl
respe
wake
repres
media
ventro
phasic slee
d waking ti
rat model
ure 7), this
iz Behn et
re 7. Model s
odorsal tegm
ly during RE
ctively. Mutu
switch. The
sents inhibit
ated indirec
olateral preo
ep, while h
ime followe
l shows tw
forms the
al. 2008).
sleep: The sl
mental nucleu
EM sleep. Th
ual inhibition
ere are 2 pr
tion from VL
ctly through
optic nucleus
humans ha
ed by 8 hou
wo REM e
basis for f
leep, wake a
us/pedunculo
he circles an
n between th
rojections fro
LPO core to
h LC and D
(eVLPO) act
ave a mono
urs spent m
episodes p
fast transit
and REM pop
opontine teg
nd arrows de
he wake‐ and
om the slee
LDT/PPT; th
DR or inhi
tivity on LDT
ophasic slee
mostly in s
per cycle o
tions betw
pulation is co
gmental nuc
enote inhibit
d sleep‐promo
ep‐ to the R
he other rep
ibitory inter
T/PPT neuron
ep, on ave
leep.
of wake, N
een wakef
omposed of
cleus (LDT/P
tory and exc
oting popula
REM‐promoti
presents the
rneurons in
ns.
Introd
rage, 16 ho
NREM and
fulness and
subpopulati
PPT) that are
citatory conn
ations forms
ing populati
net excitator
LDT of ex
duction
39
ours of
d REM
d sleep
ions like
e active
nections,
a sleep–
ion: one
ry effect
xtended
Introduction
40
7. Pharmacologic treatment of Sleep Disorders
In the early 20th century, Barbiturates were widely used but were largely replaced
by Benzodiazepines (BDZ), developed in the 1960s. The BDZ have long considered
the cornerstone of pharmacologic therapy for insomnia because of their
undisputed efficacy and relative safety compared with other agents such as
barbiturates and chloral hydrate.
Tables 7, 8 and 9 show some pharmacokinetics and pharmacodynamics properties
in humans and rats for the most common drugs currently being used in the
treatment of sleep disorders split between benzodiazepines and non‐
benzodiazepines.
Table 7. Pharmacokinetic parameter of Benzodiazepines.*
CL
ml.min‐1.kg‐1
Q
ml.min‐1.kg‐1
V1
l.kg‐1
V2
l.kg‐1
fU
%
Diazepam 79.5±6.9 125±13 0.36 ±0.10 2.65±0.18 10.0±0.1
Flunitrazepam 58.6±8.3 75.3±12 0.51±0.13 1.81±0.17 26.6±0.3
Clobazam 69.5±4.0 88.9±14 0.23±0.05 1.66±0.18 37.7±3.8
Midazolam 50.4±5.0 80.1±12 0.78±0.07 1.32±0.14 6.6±1.5
Oxazepam 34.0±3.2 172±53 0.42±0.16 2.23±0.31 4.2±0.1
Bretazenil 25.0±3.8 207±19 0.52±0.04 1.15±0.03 11.7±2.1
DMCM 53.3±7.7 158±67 0.37±0.21 0.78±0.15 9.8±0.3
*(Hoogerkamp, Arends et al. 1996, Visser, Wolters et al. 2002)
Introduction
41
Chronic treatment with benzodiazepines results in a number of undesirable effects,
including altered sleep architecture, rebound insomnia, tolerance, dependence,
abuse potential and respiratory depression (Wagner, Wagner 2000). Since late
1980s, four non‐benzodiazepine GABAA receptor modulator (ʺZ‐drugsʺ) have been
developed and introduced to treat insomnia disorders: Zolpidem, Zopiclone,
Zaleplon and Eszopiclone. These drugs represent a new generation of hypnotic
and sedative drugs that are associated with greater selectivity for GABAA
receptors.
In the following more detailed information is provided for the drug which sleep
effects have been characterized in the current investigation.
Table 8. Pharmacodynamic parameters of Benzodiazepines.*
α
μV EC50
ng.ml‐1Hill E0
Diazepam 10.6±1.2 373±97 1.17±0.17 9.9±0.7
Flunitrazepam 9.3±0.7 35.5±10 1.23±0.11 11.8±0.5
Clobazam 7.5±0.5 1080±217 2.35±0.32 12.0±0.6
Midazolam 9.2±1.1 161±33 1.13±0.08 12.1±0.5
Oxazepam 4.9±0.6 612±119 2.74±0.38 11.5±0.9
Bretazenil 1.2±0.5 1.3±0 0.62±0.12 9.8±1.2
DMCM ‐0.8±0.2 0.95±2.3 1.77±0.30 10.3±1.5
Intrinsic activity (α), potency (EC50), Hill slope (nH) and Baseline (E0), fixed at zero.
*(Hoogerkamp, Arends et al. 1996, Visser, Wolters et al. 2002)
Figur
Zolp
N,N,
It is a
(Sang
non‐
drug
appr
mark
Adm
phar
musc
distin
BZD
7.1. Ph
re 8. Chemica
pidem tart
,6‐trimethy
a stable, w
ger, Depoo
‐benzodiaz
gs, of the im
roximately
keted in Eu
ministration
rmacologic
cle relaxan
nct from c
D (Rush, Gr
harmacok
al Structure o
trate (Amb
yl‐2‐p‐tolyl
water solubl
ortere 1998
zepine hyp
midazopyr
70% bou
urope since
n (FDA). In
cal effects o
nt propertie
classic ben
iffiths 1996
kinetics o
of Zolpidem.
bien®, Sti
limidazo [
le, microcr
8). The stru
pnotic agen
ridine class
und to pla
e 1987; in 1
n preclinica
of zolpidem
es (Liappas
nzodiazepin
6, Lau, Sun
of Zolpid
ilnox®, M
1,2‐a] pyri
rystalline s
uctural form
nt belongi
s, with rap
asma prot
1992, it was
al research,
m it is sed
s, Malitas e
ne agonist
n et al. 2002
dem
Myslee®). T
idine‐3‐ace
olid with a
mula is sho
ing to a n
pid absorpt
teins (tabl
s approved
, it has bee
dative, anx
et al. 2003).
ts in that i
2, Chien, Fr
The chem
etamide L‐
a molecula
own figure
new class
tion, high b
e 9). Zolp
d by the US
en shown t
xiolytic, ant
. Zolpidem
it may be
riedrich et
Introd
mical struct
‐(+)‐tartrate
ar weight o
e 8. Zolpide
of psycho
bioavailab
pidem has
S Food and
that the pro
ticonvulsan
m is biochem
selective f
al. 2005).
duction
42
ture is
e (2:1).
of 392.4
em is a
otropic
ility of
s been
d Drug
ofile of
nt and
mically
for the
Introduction
43
The cytochrome P450 enzyme is responsible for the biotransformation of zolpidem
(Hesse, von Moltke et al. 2003). The hypnotic effectiveness of Zolpidem is achieved
at recommended doses between 5 and 10 mg (Wagner, Wagner 2000).
Table 9. Pharmacokinetic parameters of Zolpidem in Humans vs Rats*
ZOLPIDEM
HUMANS
Bioavailability= 70%
CL/F= 0.37 L.h‐1.kg‐1
V/F=1.10 L.kg‐1
Ka=1.4 h‐1
t1/2abs=0.52 h
Kel=0.34 h‐1
t1/2β=2.1 h
Tmax=1.4 h
RATS
Bioavailability= 27%
CL=0.9 L.h‐1.kg‐1
V=1.6 L.kg‐1
t1/2α=0.2 h
t1/2β=1.3 h
CL/F= apparent (ʺoralʺ) clearance; F= Bioavailability; Ka=
absorption rate constant; Kel= elimination rate constant; t1/2abs= half‐
life associated with ka; t1/2β= half‐life associated with kel; tmax= time
of occurrence of Cmax; V/F=apparent volume of distribution.
*(Garrigou‐Gadenne, Burke et al. 1989, Drover, Lemmens et al.
2000, Drover 2004)
7.2. Pharmacodynamics of Zolpidem
Zolpidem binds with high affinity to the α1 containing GABAA receptors complex,
but also activates α2 and α3 receptors (tables 10 and 11).
Introduction
44
Table 10. Pharmacodynamic parameter of Zolpidem.*
ZOLPIDEM
α
EC50
Hill
E0
5.8 μV
290 ng.ml‐1
2.2
10.5 μV
Intrinsic activity (α), potency (EC50),
Hill slope (nH) and Baseline (E0).
Table 11. In vivo and in vitro estimates for affinity and efficacy of Zolpidem.*
ZOLPIDEM
In Vitro
In Vivo
Ki GABA‐shift
30.7 ng.ml‐1 1.64
KPD
120 ng.ml‐1
ePD
0.48
Binding constant (Ki), the intrinsic efficacy of benzodiazepines and
neuroactive steroids in vitro (GABA‐shift (IC50‐GABA/IC50+GABA).
Binding affinity (KPD) and in vivo efficacy (ePD).
*(Visser, Wolters et al. 2002).
8. Futures treatments for sleep disorders
The pharmacology of sleep disorders is a relatively young discipline that has
undergone significant advances in recent years. While a number of drugs are
employed in the treatment of sleep disorders, safety, tolerability, and variable
efficacy limit their utility (DeMartinis, Kamath et al. 2009). Clinical development of
new drugs has been facilitated mainly due to the advances occurred in
neurobiology and neuropharmacology. Table 12 provides an exhaustive list of new
sleep drugs currently under clinical development, and gives an idea of the current
interest and efforts performed in this area.
Introduction
45
Table 12. N
ovel insomnia therap
eutics in at least Phase II development.*
Development Phase
Phase III
Awaiting approval
Phase III
Phase III
Phase III
Phase III
Phase III
Phase III
Phase II
Indication
Sleep Disorders
Sleep Disorders
Sleep Disorders
Sleep Disorders
Sleep Disorders,
Dep
ression
Sleep Disorders,
Hot flushes
Dep
ression,Sleep
Disorders
Sleep Disorders
Sleep Disorders
Company
Somaxon
Pharmaceu
ticals
Neu
rocrine Biosciences
San
ofi‐A
ventis
San
ofi‐A
ventis
Van
da Pharmaceu
ticals
Organon International
Novartis
Actelion
Phase 2 Discovery
Pharmacological
Target
H1/H2 an
tagonist,
muscarinic antagonist
GABAA BZ‐site
modulator
5‐HT2A recep
tor
antagonist
5‐HT2A antagonist
Melatonin recep
tor
agonist
Noradrenergic,
specific serotonergic
antidep
ressan
t
5‐HT2B/5‐H
T2C
antagonist, m
elatonin
agonist
OX
1 an
d OX
2 receptor
antagonist
Melatonin recep
tor
agonist
Drug Name
Silenor
Indiplon IR,
Indiplon M
R
Eplivan
serin,
SR‐46349
Volinan
serin,
M‐1000907
VEC‐162
ORG 50081
Agomelatine
Alm
orexan
t,
ACT‐078573
PD‐6735
Introduction
46
Development Phase
Phase II
Phase II
Phase II
Phase II
Phase II
Phase II
Phase II
Phase II
5‐HT2A/5‐H
T2B/5‐H
T2C, 5‐hydroxytryptamine (serotonin) receptor 2A/2
B/2
C; B
DZ, benzodiazepine; D
2/D
3, dopam
ine receptor 2/3.
GABA
A, ‐aminobutyric acid recep
tor A; H
1/H
2, histamine receptor 1/2; M
1, m
uscarinic recep
tor 1; OX
1/OX
2, orexin recep
tor 1/2.
*(Wafford, E
bert 2008)
Indication
Sleep Disorders
Sleep Disorders
Sleep Disorders,
antipsychotic‐induced
side effects, Parkinson’s
disease
Sleep Disorders
Sleep Disorders
Sleep Disorders
Sleep Disorders
Sleep Disorders
Company
Eli Lilly
Arena
Acadia Pharmaceu
ticals
Pfizer
Eli Lilly
GlaxoSmithKline
Neu
rogen
Evotec
Pharmacological
Target
5‐HT2A antagonist
5‐HT2A inverse agonist
5‐HT2A recep
tor inverse
agonist, dopam
ine
D2/D
3 receptor partial
agonist, acetylcholine
α2δ calcium chan
nel
blocker
5‐HT2A and H
1 receptor
inverse
antagonist
Orexin recep
tor
antagonist
GABA
A BZ‐site
modulator
GABA
A BZ‐site
modulator
Drug Name
Pruvan
serin,
EMD 281014
APD125
ACP‐103
PD 200‐390
HY10275
GW649868
Adipiplon,
NG‐2‐73
EVT‐201
Introduction
47
9. Pharmacometrics
Pharmacometrics (PM) is an emergent science providing quantitative description
and interpretation of longitudinal data by means of population
pharmacokinetic/pharmacodynamic (PK/PD) models. FDA, through its relatively
new initiative http://www.fda.gov/downloads/ScienceResearch/SpecialTopics/Cri‐
ticalPathInitiative/CriticalPathOpportunitiesReports/UCM113411.pdf), encourages
to apply model‐based drug development to make the process of having new
therapeutics more efficient.
Recent publications confirm that application of pharmacometrics principles in all
phases of development will improve both drug development and support rational
pharmacotherapy (Ette, Williams 2007).
A recent definition of pharmacometrics is: the science of developing and applying
mathematical and statistical methods to: (i) characterize, understand, and predict a
drug’s pharmacokinetic and Pharmacodynamic behavior; (ii) quantify uncertainty
of information about that behavior and (iii) rationalize data‐driven decision
making in the drug development process and pharmacotherapy. The major
objectives of early drug development are to select promising compounds and to
identify potentially, safe effective doses and dosing regimens. Integration of
PK/PD in development helps compound selection and guides creation of an
efficient clinical development strategy.
Introduction
48
The preclinical data are used to predict the time course of pharmacologic activity
in humans. The PK/PD predictions then provide a rationale for greater investment
in drugs to move it to the first in humans (Miller, Ewy et al. 2005).
The FDA demands a better set of prognostic tools to improve the efficiency in
developing safe and efficacious drugs. This mathematical and statistical approach
constructs, validates, and utilizes disease models, drug exposure‐response models,
and pharmacometric models to facilitate drug development.
9.1. Model‐Based Drug Development
The Model‐based approach can predict the efficacy and safety of new treatments
that were based on studies ʺin silicoʺ. These kinds of studies must develop PK/PD
models that can best describe the time course of the active substance in the body
and the triggered drug response. Such models incorporate also in its own structure
a fundamental part reflecting the changes in the measured response in absence of
perturbation (presence of drug).
The central focus of model‐based drug is to develop mathematical models to
characterize the input‐output relationship within disease and drug models for
knowledge management and decision making.
Introduction
49
Prior to any modeling activities, efforts have to be spent on identifying the
modeling goals and consequently the best approaches to solve the relevant
questions in achieving the goals (Zhang, Sinha et al. 2006). Model‐based drug
development involves building mathematical and statistical characterizations of
the time course of the disease and drug contributions using available clinical data
to design and validate the model. The relationship between drug dose, plasma
concentration, biophase concentration (pharmacokinetics), and drug effect or side‐
effects (pharmacodynamics) is characterized, and relevant patient covariates are
include in the model. Systematic application of this concept to drug development
has the potential to significantly improve it.
The impact of modeling and simulation on new chemical entity development
depends on the type and amount of prior information available. The computer
simulation is the process of building a mathematical model that simulates a real‐
world situation and then using the model to conduct experiments in order to
describe, explain, investigate, and predict the behavior of the situation (Chien,
Friedrich et al. 2005).
In the preclinical phase it is important to compare the PK/PD properties of
biomarkers that are characteristics that can be objectively measured and evaluated
as an indicator of normal biologic processes, pathogenic processes, or
pharmacologic responses to a therapeutic intervention. Biomarkers are
quantitative measures that allow us to diagnose and assess the disease process and
monitor response to treatment. Biomarkers are also crucial to efficient medical
product development (Biomarkers Definitions Working Group. 2001).
Introduction
50
10. PK/PD Modelling in Sleep
Applying PKP/PD models to pre‐, and clinical data is becoming a routine in drug
research, development and patient care, and therefore the battery of models that
have been proposed and validated is continuous increasing with the consequent
benefit for the modelers.
PK/PD modeling has been used in most therapeutic areas like: Analgesic (Wagner,
OʹHara 1997), anesthesia (Heeremans, Proost et al. 2010), degenerative disease
(Pettigrew, Bieber et al. 1998, Zingmark, Edenius et al. 2004), oncology (Friberg,
Hassan et al. 2005, Soto, Keizer et al. 2010). However, for the case of the
quantitative description of the sleep architecture using population PK/PD models
the number of application is still very low, and there is only one publication
available in which the sleep stage were modeled in rats (Diack, Ackaert et al. 2011).
Current population models dealing with sleep stages data use the following main
assumption: sleep stages are not independent from one time point to another. In
other words the current probability to be in a certain sleep stage depends on the
sleep stage of the previous measurement time. This feature of the data is taken into
account by the Markov modeling framework. As it has been mentioned before in
this section, circadian patterns play an important role in sleep which means that
the time course of sleep stages is not constant and therefore the use of non‐
homogeneous Markov chain models is required.
Introduction
51
A Markovian feature is a stochastic process which is memoryless, and predicts the
future state, assuming that knowing the current state is sufficient and independent
of where the process has been in the past.
A stochastic process can be defined like a random variable that is studied based on
probability theory. The stochastic process has a Markov property that can be used
for modelling sleep stage transitions. This is based on the finding that the sleep
stage data have such stochastic regularities that they can be at least approximately
described even with a simple Markov model. The time intervals of observation of a
process can be used to classify a Markov process. Processes can be observed at
discrete or restricted intervals, or continuously. The process is time independent or
time homogeneous when the transition probabilities are constant regardless of the
time of observation, and the distribution of the number of transitions into a state
follows a homogeneous or stationary Poisson distribution (Ette, Williams 2007). A
more detailed description of the Markov models applied to sleep data is provided
in the next section and in the apprendixes.
The idea to model the sleep stages with a Markov process is not new. The
pioneering work using Markov chain models (MCM) was published in 2000
(Karlsson, Schoemaker et al. 2000). In this work Karlsson developed a first‐order
Markov model that describes the probability of changes in sleep stage as a function
of time after intake of the drug or placebo (figure 9) to determine the clinical effect
of hypnotic drugs.
Figur
hypno
corres
3; 4,
propo
Duri
to de
Kjell
manu
with
turno
sleep
pre‐c
re 9. Average
ograms in h
sponding sta
stage 4.). Th
ortional to th
ing the last
escribe effe
sson, Oue
uscripts th
hout consid
over mech
pd disorde
clinical s
e whole‐nigh
umans. The
age (W. wake
he arrows in
he correspond
t years seve
ects of diffe
ellet et al.
he model f
dering dela
hanisms tha
ers. In add
studies in
ht sleep struc
circle areas
efulness; R. r
ndicate the d
ding transitio
eral public
erent sleep
2011). To
for drug co
ays in drug
at are wel
ition, and
n the s
cture for drug
are proporti
rapid eye mo
directions of
ons probabili
cations hav
drugs (Biz
o the best
ontribution
g effects du
l known to
as it has b
sleep are
g (left) and p
ional to the
ovement (REM
possible sta
ities.
ve appeared
zzotto 2010
of our kn
n was a di
ue to slow
o take pla
been ment
ena are
placebo (righ
percentage o
M). 1, stage 1
age transition
d using the
0, Diack, Ac
nowledge
irect linear
distributio
ce during
tioned brie
currently
Introd
ht) as estimat
of time spen
1; 2, stage 2;
ns. Arrow ar
e Markov m
ckaert et al
in all the
r or EMAX m
on to bioph
treatment
efly before
y very
duction
52
ed from
nt in the
3, stage
reas are
models
l. 2011,
e cited
model,
hase or
of the
PKPD
scarce.
REFERENCES
References
54
1. Association of Sleep Disorders Centers: Diagnostic Classification of Sleep and Arousal Disorders. Prepared by the Sleep Disorders Classification
Committee, Roffwarg HP. Sleep 1979; 2:1‐137.
2. A.J.K., Phillips. and P.A., Robinson., 2007. A Quantitative Model of Sleep‐
Wake Dynamics Based on the Physiology of the Brainstem Ascending
Arousal System. Journal of Biological Rhythms, 22, pp. 167‐179.
3. ACHERMANN, P. and BORBELY, A.A., 2003. Mathematical models of
sleep regulation. Frontiers in bioscience: a journal and virtual library, 8, pp.
s683‐93.
4. ACHERMANN, P. and BORBELY, A.A., 1992. Combining different models
of sleep regulation. Journal of sleep research, 1(2), pp. 144‐147.
5. ACHERMANN, P. and BORBELY, A.A., 1990. Simulation of human sleep:
ultradian dynamics of electroencephalographic slow‐wave activity. Journal
of Biological Rhythms, 5(2), pp. 141‐157.
6. ACHERMANN, P., DIJK, D., BRUNNER, D.P. and BORBÉLY, A.A., 1993. A
model of human sleep homeostasis based on EEG slow‐wave activity:
Quantitative comparison of data and simulations. Brain research bulletin,
31(1–2), pp. 97‐113.
7. ÅKERSTEDT, T. and FOLKARD, S., 1996. Predicting duration of sleep from the three process model of regulation of alertness. Occupational and
environmental medicine, pp. 136‐141.
8. ÅKERSTEDT, T. and FOLKARD, S., 1997. The three‐process model of
alertness and its extension to performance, sleep latency, and sleep length.
Chronobiology international, 14(2), pp. 115‐123.
9. ANDRETIC, R., FRANKEN, P. and TAFTI, M., 2008. Genetics of sleep.
Annual Review of Genetics, 42, pp. 361‐388.
10. BATESON, A.N., 2004. The benzodiazepine site of the GABAA receptor: an
old target with new potential? Sleep medicine, 5 Suppl 1, pp. S9‐15.
References
55
11. BEERSMA, D.G. and ACHERMANN, P., 1995. Changes of sleep EEG slow‐
wave activity in response to sleep manipulations: to what extent are they
related to changes in REM sleep latency? Journal of sleep research, 4(1), pp. 23‐
29.
12. BEHN, C.G.D., BROWN, E.N., SCAMMELL, T.E. and KOPELL, N.J., 2007.
Mathematical model of network dynamics governing mouse sleep–wake
behavior. Journal of neurophysiology, 97(6), pp. 3828‐3840.
13. BIZZOTTO, R., ZAMUNER, S., DE NICOLAO, G., KARLSSON, M.O. and
GOMENI, R., 2010. Multinomial logistic estimation of Markov‐chain models
for modeling sleep architecture in primary insomnia patients. Journal of
pharmacokinetics and pharmacodynamics, 37(2), pp. 137‐155.
14. BUTKOV, N., LEE‐CHIONG and TEOFILO, L., eds, 2007. Overview of Sleep
Medicine. Fundamentals of Sleep Technology: Endorsed by the American
Association of Sleep Technologists (AAST), pp. 1‐9. USA: Lippincott Williams &
Wilkins, a Wolters Kluwer Business.
15. BIOMARKERS DEFINITIONS WORKING GROUP, 2001. Biomarkers and
surrogate endpoints: preferred definitions and conceptual framework.
Clinical pharmacology and therapeutics, 69(3), pp. 89‐95.
16. BORBELY, A.A., 1982. A two process model of sleep regulation. Human
neurobiology, 1(3), pp. 195‐204.
17. CHIEN, J.Y., FRIEDRICH, S., HEATHMAN, M.A., DE ALWIS, D.P. and
SINHA, V., 2005. Pharmacokinetics/Pharmacodynamics and the stages of
drug development: role of modeling and simulation. The AAPS journal, 7(3),
pp. E544‐59.
18. CHEBIB, M. and JOHNSTON, G.A., 1999. The ʹABCʹ of GABA receptors: a
brief review. Clinical and experimental pharmacology & physiology, 26(11), pp.
937‐940.
19. CHOKROVERTY, S., 2010. Overview of sleep & sleep disorders. Indian
Journal of Medical Research, 131, pp. 126‐140.
References
56
20. CROCKER, A. and SEHGAL, A., 2010. Genetic analysis of sleep. Genes &
development, 24(12), pp. 1220‐1235.
21. DAAN, S. and BEERSMA, D., 1984. Circadian gating of human sleep‐wake
cycles. Mathematical models of the circadian sleep‐wake cycle(A 85‐20576 07‐
52).New York, Raven Press, 1984, , pp. 129‐155.
22. DAAN, S., BEERSMA, D.G. and BORBELY, A.A., 1984. Timing of human
sleep: recovery process gated by a circadian pacemaker. The American
Journal of Physiology, 246(2 Pt 2), pp. R161‐83.
23. DANG, A., GARG, A. and RATABOLI, P.V., 2010. Role of zolpidem in the
management of insomnia. CNS neuroscience & therapeutics, 17(5), pp. 387‐397.
24. DEMARTINIS, N.A., KAMATH, J. and WINOKUR, A., 2009. New
approaches for the treatment of sleep disorders. Advances in Pharmacology
(San Diego, Calif.), 57, pp. 187‐235.
25. DEPOORTERE, H., FRANCON, D., GRANGER, P. and TERZANO, M.G.,
1993. Evaluation of the stability and quality of sleep using Hjorthʹs
descriptors. Physiology & Behavior, 54(4), pp. 785‐793.
26. DIACK, C., ACKAERT, O., PLOEGER, B.A., VAN DER GRAAF, P.H.,
GURRELL, R., IVARSSON, M. and FAIRMAN, D., 2011. A hidden Markov
model to assess drug‐induced sleep fragmentation in the telemetered rat.
Journal of pharmacokinetics and pharmacodynamics, 38(6), pp. 697‐711.
27. DINIZ BEHN, C.G., KOPELL, N., BROWN, E.N., MOCHIZUKI, T. and
SCAMMELL, T.E., 2008. Delayed orexin signaling consolidates wakefulness
and sleep: physiology and modeling. Journal of neurophysiology, 99(6), pp.
3090‐3103.
28. DROVER, D., LEMMENS, H., NAIDU, S., CEVALLOS, W., DARWISH, M.
and STANSKI, D., 2000. Pharmacokinetics, pharmacodynamics, and relative
pharmacokinetic/pharmacodynamic profiles of zaleplon and zolpidem.
Clinical therapeutics, 22(12), pp. 1443‐1461.
References
57
29. DROVER, D., 2004. Comparative pharmacokinetics and pharmacodynamics
of short‐acting hypnosedatives ‐ Zaleplon, zolpidem and zopiclone. Clinical
pharmacokinetics, 43(4), pp. 227‐238.
30. EBERT, B. and WAFFORD, K.A., 2006. Benzodiazepine receptor agonists
and insomnia: Is subtype selectivity lost in translation? Drug Discovery
Today: Therapeutic Strategies, 3(4), pp. 547‐554.
31. ETTE, E.I. and WILLIAMS, P.J., 2007. Pharmacometrics: the science of
quantitative pharmacology.United States of America: John Wiley‐Interscience.
32. FRIBERG, L.E., HASSAN, S.B., LINDHAGEN, E., LARSSON, R. and
KARLSSON, M.O., 2005. Pharmacokinetic–pharmacodynamic modelling of
the schedule‐dependent effect of the anti‐cancer agent CHS 828 in a rat
hollow fibre model. European journal of pharmaceutical sciences, 25(1), pp. 163‐
173.
33. GARRIGOU‐GADENNE, D., BURKE, J.T., DURAND, A., DEPOORTERE,
H., THENOT, J.P. and MORSELLI, P.L., 1989. Pharmacokinetics, brain
distribution and pharmaco‐electrocorticographic profile of zolpidem, a new
hypnotic, in the rat. The Journal of pharmacology and experimental therapeutics,
248(3), pp. 1283‐1288.
34. HEEREMANS, E.H., PROOST, J.H., ELEVELD, D.J., ABSALOM, A.R. and
STRUYS, M.M., 2010. Population pharmacokinetics and pharmacodynamics
in anesthesia, intensive care and pain medicine. Current Opinion in
Anesthesiology, 23(4), pp. 479‐484.
35. HESSE, L.M., VON MOLTKE, L.L. and GREENBLATT, D.J., 2003. Clinically
important drug interactions with zopiclone, zolpidem and zaleplon. CNS
drugs, 17(7), pp. 513‐532.
36. HOOGERKAMP, A., ARENDS, R.H., BOMERS, A.M., MANDEMA, J.W.,
VOSKUYL, R.A. and DANHOF, M., 1996.
Pharmacokinetic/pharmacodynamic relationship of benzodiazepines in the
direct cortical stimulation model of anticonvulsant effect. The Journal of
pharmacology and experimental therapeutics, 279(2), pp. 803‐812.
References
58
37. HORI, T., SUGITA, Y., KOGA, E., SHIRAKAWA, S., INOUE, K., UCHIDA,
S., KUWAHARA, H., KOUSAKA, M., KOBAYASHI, T. and TSUJI, Y., 2001.
Proposed supplements and amendments to ‘A Manual of Standardized
Terminology, Techniques and Scoring System for Sleep Stages of Human
Subjects’, the Rechtschaffen & Kales (1968) standard. Psychiatry and clinical
neurosciences, 55(3), pp. 305‐310.
38. JEWETT, M.E. and KRONAUER, R.E., 1999. Interactive mathematical
models of subjective alertness and cognitive throughput in humans. Journal
of Biological Rhythms, 14(6), pp. 588‐597.
39. JONES, B.E., 2005. From waking to sleeping: neuronal and chemical
substrates. Trends in pharmacological sciences, 26(11), pp. 578‐586.
40. KARLSSON, M.O., SCHOEMAKER, R.C., KEMP, B., COHEN, A.F., VAN
GERVEN, J.M., TUK, B., PECK, C.C. and DANHOF, M., 2000. A
pharmacodynamic Markov mixed‐effects model for the effect of temazepam
on sleep. Clinical pharmacology and therapeutics, 68(2), pp. 175‐188.
41. KJELLSSON, M.C., OUELLET, D., CORRIGAN, B. and KARLSSON, M.O.,
2011. Modeling sleep data for a new drug in development using Markov
mixed‐effects models. Pharmaceutical research, 28(10), pp. 2610‐2627.
42. KRYGER, M.H., ROTH, T. and DEMENT, W.C., 1994. Principles and Practice
of Sleep Medicine. Second edn. United States of America: W. B Saunders
Company.
43. KUMAR, V.M., 2008. Sleep and sleep disorders. The Indian journal of chest
diseases & allied sciences, 50(1), pp. 129‐135.
44. LAU, C.E., SUN, L., WANG, Q. and FALK, J.L., 2002. The effect of zolpidem
on operant behavior and its relation to pharmacokinetics after intravenous
and subcutaneous administration: concentration‐effect relations. Behavioural
pharmacology, 13(2), pp. 93‐103.
References
59
45. LIAPPAS, I.A., MALITAS, P.N., DIMOPOULOS, N.P., GITSA, O.E.,
LIAPPAS, A.I., NIKOLAOU, C. and CHRISTODOULOU, G.N., 2003.
Zolpidem dependence case series: possible neurobiological mechanisms and
clinical management. Journal of psychopharmacology (Oxford, England), 17(1),
pp. 131‐135.
46. LU, J., SHERMAN, D., DEVOR, M. and SAPER, C.B., 2006. A putative flip‐
flop switch for control of REM sleep. Nature, 441(7093), pp. 589‐594.
47. MASSAQUOI, S.G. and MCCARLEY, R.W., 1992. Extension of the Limit
Cycle Reciprocal Interaction Model of REM cycle control. An integrated
sleep control model. Journal of sleep research, 1(2), pp. 138‐143.
48. MCCARLEY, R.W. and HOBSON, J.A., 1975. Neuronal excitability
modulation over the sleep cycle: a structural and mathematical model.
Science (New York, N.Y.), 189(4196), pp. 58‐60.
49. MCCARLEY, R.W., 2007. Neurobiology of REM and NREM sleep. Sleep
medicine, 8(4), pp. 302‐330.
50. MIGNOT, E., TAHERI, S. and NISHINO, S., 2002. Sleeping with the
hypothalamus: emerging therapeutic targets for sleep disorders. Nature
neuroscience, 5, pp. 1071‐1075.
51. MILLER, R., EWY, W., CORRIGAN, B.W., OUELLET, D., HERMANN, D.,
KOWALSKI, K.G., LOCKWOOD, P., KOUP, J.R., DONEVAN, S., EL‐
KATTAN, A., LI, C.S., WERTH, J.L., FELTNER, D.E. and LALONDE, R.L.,
2005. How modeling and simulation have enhanced decision making in new
drug development. Journal of pharmacokinetics and pharmacodynamics, 32(2),
pp. 185‐197.
52. NUTT, D.J. and STAHL, S.M., 2010. Searching for perfect sleep: the
continuing evolution of GABAA receptor modulators as hypnotics. Journal
of psychopharmacology (Oxford, England), 24(11), pp. 1601‐1612.
53. NAKAO, M., KARASHIMA, A. and KATAYAMA, N., 2007. Mathematical
models of regulatory mechanisms of sleep‐wake rhythms. Cellular and
molecular life sciences, 64(10), pp. 1236‐1243.
References
60
54. REDDY, D.S., 2008. Mass spectrometric assay and physiological–
pharmacological activity of androgenic neurosteroids. Neurochemistry
international, 52(4–5), pp. 541‐553.
55. REMPE, M.J., BEST, J. and TERMAN, D., 2010. A mathematical model of the
sleep/wake cycle. Journal of mathematical biology, 60(5), pp. 615‐644.
56. RUSH, C.R. and GRIFFITHS, R.R., 1996. Zolpidem, triazolam, and
temazepam: behavioral and subject‐rated effects in normal volunteers.
Journal of clinical psychopharmacology, 16(2), pp. 146‐157.
57. SANGER, D.J. and DEPOORTERE, H., 1998. The pharmacology and
mechanism of action of zolpidem. CNS drug reviews, 4(4), pp. 323‐340.
58. SAPER, C.B., CHOU, T.C. and SCAMMELL, T.E., 2001. The sleep switch:
hypothalamic control of sleep and wakefulness. Trends in neurosciences,
24(12), pp. 726‐731.
59. SAPER, C.B., CANO, G. and SCAMMELL, T.E., 2005. Homeostatic,
circadian, and emotional regulation of sleep. The Journal of comparative
neurology, 493(1), pp. 92‐98.
60. SAPER, C.B., FULLER, P.M., PEDERSEN, N.P., LU, J. and SCAMMELL,
T.E., 2010. Sleep state switching. Neuron, 68(6), pp. 1023‐1042.
61. SILBER, M.H., KRAHN, L.E. and MORGENTHALER, T.I., 2010.
Management of Insomnia. In Sleep Medicine in Clinical Practice. Second
Edition, pp. 200‐212. London: Taylor & Francis Group.
62. SOTO, E., KEIZER, R.J., TROCÓNIZ, I.F., HUITEMA, A.D., BEIJNEN, J.H.,
SCHELLENS, J.H., WANDERS, J., CENDRÓS, J.M., OBACH, R. and
PERAIRE, C., 2011. Predictive ability of a semi‐mechanistic model for
neutropenia in the development of novel anti‐cancer agents: two case
studies. Investigational new drugs, 29(5), pp. 984‐995.
63. THORPY, M.J., 2012. Classification of sleep disorders. Neurotherapeutics : the
journal of the American Society for Experimental NeuroTherapeutics, 9(4), pp.
687‐701.
References
61
64. UENO, R., HONDA, K., INOUE, S. and HAYAISHI, O., 1983. Prostaglandin
D2, a cerebral sleep‐inducing substance in rats. Proceedings of the National
Academy of Sciences of the United States of America, 80(6), pp. 1735‐1737.
65. VISSER, S., WOLTERS, F., VAN DER GRAAF, P., PELETIER, L. and
DANHOF, M., 2002. Dose‐dependent EEG effects of zolpidem provide
evidence for GABA(A) receptor subtype selectivity in vivo. The Journal of
pharmacology and experimental therapeutics, 304(3), pp. 1251‐1257.
66. WAFFORD, K.A. and EBERT, B., 2008. Emerging anti‐insomnia drugs:
tackling sleeplessness and the quality of wake time. Nature Reviews Drug
Discovery, 7(6), pp. 530‐540.
67. WAGNER, B. and OʹHARA, D., 1997. Pharmacokinetics and
pharmacodynamics of sedatives and analgesics in the treatment of agitated
critically ill patients. Clinical pharmacokinetics, 33(6), pp. 426‐453.
68. WAGNER, J. and WAGNER, M.L., 2000. Non‐benzodiazepines for the
treatment of insomnia. Sleep medicine reviews, 4(6), pp. 551‐581.
69. WINSKY‐SOMMERER, R., 2009. Role of GABAA receptors in the
physiology and pharmacology of sleep. The European journal of neuroscience,
29(9), pp. 1779‐1794.
70. ZHANG, L., SINHA, V., FORGUE, S.T., CALLIES, S., NI, L., PECK, R. and
ALLERHEILIGEN, S.R., 2006. Model‐based drug development: the road to
quantitative pharmacology. Journal of pharmacokinetics and pharmacodynamics,
33(3), pp. 369‐393.
71. ZINGMARK, P.H., EDENIUS, C. and KARLSSON, M.O., 2004.
Pharmacokinetic/pharmacodynamic models for the depletion of
Vbeta5.2/5.3 T cells by the monoclonal antibody ATM‐027 in patients with
multiple sclerosis, as measured by FACS. British journal of clinical
pharmacology, 58(4), pp. 378‐389.
AIM AND OBJECTIVES
Aim & Objectives
63
To describe the effects of Zolpidem for a Sleep Disorders treatment using a
Semi‐mechanistic (PK/PD) Markov‐chain model.
To develop (and validate) a robust PK/PD model describing the time course
of sleep stages in conscious healthy rats at baseline conditions.
To describe the sleep architecture in rats using Markov‐chain model (MCM)
and to investigate the impact of placebo/vehicle and Zolpidem on sleep
model parameters.
Pharmacokinetic/Pharmacodynamic Modelling of the
Sleep effects of Zolpidem in Rats.
Nieves Vélez de Mendizábal2, Arianna Madrid‐Aispuro1,
Kimberley Jackson3, Andrew McCarthy3, Dale Edgar3, Iñaki F.
Trocóniz1
1Department of Pharmacy and Pharmaceutical Technology; School of
Pharmacy; University of Navarra; Pamplona 31080; Spain. 2Division of Clinical Pharmacology, Department of Medicine, Indiana
University School of Medicine; Indianapolis, Indiana; USA. 3Eli Lilly and Company; Erl Wood Manor; Windlesham Surrey; GU20
6PH United Kingdom.
(Manuscript in Preparation)
APPENDIX
Appendix 1
102
APPENDIX 1
Table 1. List of the international Classification of Sleep Disorders version 2 of 2005.*
Clinical Phenomenology
Insomnia
Adjustment insomnia (acute insomnia)
Psychophysiological insomnia
Paradoxical insomnia
Inadequate sleep hygiene
Behavioral insomnia of childhood
Idiopathic insomnia
Insomnia due to mental disorder
Insomnia due to drug or substance
Insomnia related to medical condition
Physiological (organic) insomnia
Sleep‐related breathing
disorders
Obstructive sleep apnea
Central sleep apnea
‐ Primary
‐ Due to drug or substance
‐ Cheyne‐stokes breathing pattern
‐ High‐altitude periodic breathing
‐ Primary sleep apnea of infancy
Sleep‐related hypoventilation
‐ Central alveolar hypoventilation syndrome
Idiopathic
Congenital
‐ Due to pulmonary Pathology
Due to neuromuscular and chest wall disorders
Hypersomnias of central
origin not due to a circadian
rhythm disorder of sleep‐
related breathing
Narcolepsy
‐ With cataplexy
‐ Without cataplexy
‐ Due to medical conditions
‐ Unspecified
Idiopathic hypersomnia
‐ With long sleep time
‐ Without long sleep time
Recurrent hypersomnia
‐ Kleine‐Levin Syndrome
‐ Menstrual‐related hypersomnia
Behaviorally induced insufficient sleep syndrome
Hypersomnia related a medical condition
Hypersomnia due to drug or substance
Hypersomnia not due to substance of Know physiological condition
(nonorganic hypersomnia)
Appendix 1
103
Only some of the disorders in each category have been included. *(Silber, Krahn et al. 2010, Thorpy 2012)
Circadian rhythm sleep
disorders
Delayed sleep phase disorders
Advanced sleep phase disorder
Irregular sleep‐wake circadian rhythm sleep disorder
Free‐running circadian rhythm sleep disorder (no entrained type)
Jet lag disorder
Shift work disorder
Parasomnias
Disorders of arousal (from NREM sleep)
‐ Confusional arousals
‐ Sleepwalking
‐ Sleep terrors
Parasomnias associated with REM sleep
‐ REM sleep behavior disorder
‐ Recurrent isolated sleep paralysis
‐ Nightmare disorder
Other parasomnias
‐ Sleep‐related dissociative disorders
‐ Sleep enuresis
‐ Sleep‐related groaning (catathrenia)
‐ Exploding head syndrome
‐ Sleep‐related hallucinations
‐ Sleep‐related eating disorder
‐ Parasomnia, unspecified
Sleep‐related movement
disorder
‐ Restless legs syndrome
‐ Periodic limb movement disorder
‐ Sleep‐related leg cramps
‐ Sleep‐related bruxism
‐ Sleep‐related rhythmic movement disorder
‐ Sleep‐related rhythmic movement unspecified
Isolated symptoms, apparently
normal variants, and
unresolved issues
Long sleeper
Short sleeper
Shoring
Sleep talking
Sleep starts (hypnic jerks)
Other Sleep Disorders
Other physiological (organic) sleep disorder
Other sleep disorder not due to a known substance or physiological
condition
Fibromyalgia Sleep‐related epilepsy
Sleep‐related headaches
Other psychiatric/behavioral
disorders frequently
encountered in the differential
diagnosis of sleep disorders
Mood disorders
Anxiety disorders
Schizophrenia and other psychotic disorders
Isolated symptoms, apparently
normal variants and
unresolved issues
Other sleep disorders
Appendix 2
104
APPENDIX 2
SCRIPTS: INPUT FILES FOR NONMEM
BASELINE MODEL
‐ FROM AWAKE
;$SIZES LTH=40 LVR=30 NO=5000 LNP4=2000 MAXIDS=20000 LIM1=5000 LIM2=5000 LIM3=200 LIM4=50
LIM5=200 LIM6=5000 ; This option is only for implemented in Nonmem 7.2
;========================================================================================
; Description: Nonmem model script for sub‐model P(AWAKE | AWAKE) DAY ONE
;========================================================================================
$PROB Transition from AWAKE
$INPUT ID DV=STT TIME=DROP EPOCH=TIME AWPV NRPV REPV AWK NREM REM
;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ INFORMATION ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
; 1 EPOCH = 10 SEC
; Thus 12 hours= 4320 Epochs
; Hour 4 starts at epoch 1440
; Hour 16 (4+12) finish epoch 5760
;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ STAGE AWAKE=1, NREM=2, REM=3 ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ ; AWPV (Column)
; AWPV= 1 If previous observation (epoch‐1) is AWAKE
; AWPV= 0 Otherwise
; AWK, NREM & REM (Columns)
; AWK = 1 If the state at the epoch is AWAKE
; AWK = 0 Otherwise
; NREM= 1 If the state at the epoch is NREM
; NREM= 0 Otherwise
; REM = 1 If the state at the epoch is REM
; REM = 0 Otherwise
$DATA BASELINE_AWPV_Day1Farmaco.csv
; Dataset contains only observations immediately preceded by AWAKE state
;=================================== BREAKPOINTS ======================================
$PRED
BP1=1440
BP2=1440+360
Appendix 2
105
BP3=BP2+360
BP4=BP3+360
BP5=BP4+360
BP6=BP5+360
BP7=BP6+360
BP8=BP7+360
BP9=BP8+360
BP10=BP9+360
BP11=BP10+360
BP12=BP11+360
;============================= Logit G1 (AWAKEAWAKE) ================================ G11=THETA(1)+ETA(1)
G12=THETA(2)+ETA(2)
G13=THETA(3)+ETA(3)
G14=THETA(4)+ETA(4)
G15=THETA(5)+ETA(5)
G16=THETA(6)+ETA(6)
G17=THETA(7)+ETA(7)
G18=THETA(8)+ETA(8)
G19=THETA(9)+ETA(9)
G110=THETA(10)+ETA(10)
G111=THETA(11)+ETA(11)
G112=THETA(12)+ETA(12)
;============================= Logit G2 (AWAKENREM) ================================= G21=THETA(13)+ETA(13)
G22=THETA(14)+ETA(14)
G23=THETA(15)+ETA(15)
G24=THETA(16)+ETA(16)
G25=THETA(17)+ETA(17)
G26=THETA(18)+ETA(18)
G27=THETA(19)+ETA(19)
G28=THETA(20)+ETA(20)
G29=THETA(21)+ETA(21)
G210=THETA(22)+ETA(22)
G211=THETA(23)+ETA(23)
G212=THETA(24)+ETA(24)
;================ Individual values of the Logits at the specific observation time =================
G1=G11
G2=G21
; === Linear regression of Logit at a specific observation time between the two adjacent break points ===
IF (EPOC.GT.BP1.AND.EPOC.LE.BP2) THEN
G1=G11*(BP2‐EPOC)/(BP2‐BP1)+G12*(EPOC‐BP1)/(BP2‐BP1)
G2=G21*(BP2‐EPOC)/(BP2‐BP1)+G22*(EPOC‐BP1)/(BP2‐BP1)
ENDIF
Appendix 2
106
IF (EPOC.GT.BP2.AND.EPOC.LE.BP3) THEN
G1=G12*(BP3‐EPOC)/(BP3‐BP2)+G13*(EPOC‐BP2)/(BP3‐BP2)
G2=G22*(BP3‐EPOC)/(BP3‐BP2)+G23*(EPOC‐BP2)/(BP3‐BP2)
ENDIF
IF (EPOC.GT.BP3.AND.EPOC.LE.BP4) THEN
G1=G13*(BP4‐EPOC)/(BP4‐BP3)+G14*(EPOC‐BP3)/(BP4‐BP3)
G2=G23*(BP4‐EPOC)/(BP4‐BP3)+G24*(EPOC‐BP3)/(BP4‐BP3)
ENDIF
IF (EPOC.GT.BP4.AND.EPOC.LE.BP5) THEN
G1=G14*(BP5‐EPOC)/(BP5‐BP4)+G15*(EPOC‐BP4)/(BP5‐BP4)
G2=G24*(BP5‐EPOC)/(BP5‐BP4)+G25*(EPOC‐BP4)/(BP5‐BP4)
ENDIF
IF (EPOC.GT.BP5.AND.EPOC.LE.BP6) THEN
G1=G15*(BP6‐EPOC)/(BP6‐BP5)+G16*(EPOC‐BP5)/(BP6‐BP5)
G2=G25*(BP6‐EPOC)/(BP6‐BP5)+G26*(EPOC‐BP5)/(BP6‐BP5)
ENDIF
IF (EPOC.GT.BP6.AND.EPOC.LE.BP7) THEN
G1=G16*(BP7‐EPOC)/(BP7‐BP6)+G17*(EPOC‐BP6)/(BP7‐BP6)
G2=G26*(BP7‐EPOC)/(BP7‐BP6)+G27*(EPOC‐BP6)/(BP7‐BP6)
ENDIF
IF (EPOC.GT.BP7.AND.EPOC.LE.BP8) THEN
G1=G17*(BP8‐EPOC)/(BP8‐BP7)+G18*(EPOC‐BP7)/(BP8‐BP7)
G2=G27*(BP8‐EPOC)/(BP8‐BP7)+G28*(EPOC‐BP7)/(BP8‐BP7)
ENDIF
IF (EPOC.GT.BP8.AND.EPOC.LE.BP9) THEN
G1=G18*(BP9‐EPOC)/(BP9‐BP8)+G19*(EPOC‐BP8)/(BP9‐BP8)
G2=G28*(BP9‐EPOC)/(BP9‐BP8)+G29*(EPOC‐BP8)/(BP9‐BP8)
ENDIF
IF (EPOC.GT.BP9.AND.EPOC.LE.BP10) THEN
G1=G19*(BP10‐EPOC)/(BP10‐BP9)+G110*(EPOC‐BP9)/(BP10‐BP9)
G2=G29*(BP10‐EPOC)/(BP10‐BP9)+G210*(EPOC‐BP9)/(BP10‐BP9)
ENDIF
IF (EPOC.GT.BP10.AND.EPOC.LE.BP11) THEN
G1=G110*(BP11‐EPOC)/(BP11‐BP10)+G111*(EPOC‐BP10)/(BP11‐BP10)
G2=G210*(BP11‐EPOC)/(BP11‐BP10)+G211*(EPOC‐BP10)/(BP11‐BP10)
ENDIF
Appendix 2
107
IF (EPOC.GT.BP11.AND.EPOC.LE.BP12) THEN
G1=G111*(BP12‐EPOC)/(BP12‐BP11)+G112*(EPOC‐BP11)/(BP12‐BP11)
G2=G211*(BP12‐EPOC)/(BP12‐BP11)+G212*(EPOC‐BP11)/(BP12‐BP11)
ENDIF
; ==== Inverse‐Logit in order to calculate de Transition Probability from AWAKE state to another ====
; ‐‐‐‐‐‐‐‐‐‐‐‐> AWAKE: PAW
PAW=EXP(G1)/(1+EXP(G1)+EXP(G2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> NREM: PNR
PNR=EXP(G2)/(1+EXP(G1)+EXP(G2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> REM: PRE
PRE=1/(1+EXP(G1)+EXP(G2))
; Likelihood
; Names in data file AWK NREM REM
Y=PAW*AWK+PNR*NREM+PRE*REM
$THETA 3.70 3.70 3.70 3.70 3.70 3.70 3.70 3.70 3.70 3.70 3.70 3.70
$THETA 3 3 3 3 3 3 3 3 3 3 3 3
$OMEGA 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
$ESTIMATION MAXEVAL=9999 NUMERICAL METHOD=COND LAPLACE LIKE CENTERING
$COVARIANCE MATRIX=R PRINT=E
$TABLE ID EPOC DV PRED PAW PNR PRE ONEHEADER NOPRINT FILE=sdtabAWPV_DAY1Farmaco
Appendix 2
108
BASELINE MODEL
‐ FROM NREM
;$SIZES LTH=40 LVR=30 NO=5000 LNP4=2000 MAXIDS=20000 LIM1=5000 LIM2=5000 LIM3=200 LIM4=50
LIM5=200 LIM6=5000 ; This option is only for implemented in Nonmem 7.2
;========================================================================================
; Description: Nonmem model script for sub‐model P(NREM | AWAKE) DAY ONE
;========================================================================================
$PROB Transition from NREM
$INPUT ID DV=STT TIME=DROP EPOCH=TIME AWPV NRPV REPV AWK NREM REM
;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ INFORMATION ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
; 1 EPOCH = 10 SEC
; Thus 12 hours= 4320 Epochs
; Hour 4 starts at epoch 1440
; Hour 16 (4+12) finish epoch 5760
;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ STAGE AWAKE=1, NREM=2, REM=3 ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ ; NRPV (Column)
; NRPV= 1 If previous observation (epoch‐1) is Awake
; NRPV= 0 Otherwise
; AWK, NREM & REM (Columns)
; AWK = 1 If the state at the epoch is AWAKE
; AWK = 0 Otherwise
; NREM= 1 If the state at the epoch is NREM
; NREM= 0 Otherwise
; REM = 1 If the state at the epoch is REM
; REM = 0 Otherwise
$DATA BASELINE_NRPDV_Day1Farmaco.csv
; Dataset contains only observations immediately preceded by NREM state
;==================================== BREAKPOINTS =====================================
$PRED
BP1=1440
BP2=1440+360
BP3=BP2+360
BP4=BP3+360
BP5=BP4+360
BP6=BP5+360
BP7=BP6+360
Appendix 2
109
BP8=BP7+360
BP9=BP8+360
BP10=BP9+360
BP11=BP10+360
BP12=BP11+360
;=============================== Logit G1 (NREMAWAKE) =============================== G11=THETA(1)+ETA(1)
G12=THETA(2)+ETA(2)
G13=THETA(3)+ETA(3)
G14=THETA(4)+ETA(4)
G15=THETA(5)+ETA(5)
G16=THETA(6)+ETA(6)
G17=THETA(7)+ETA(7)
G18=THETA(8)+ETA(8)
G19=THETA(9)+ETA(9)
G110=THETA(10)+ETA(10)
G111=THETA(11)+ETA(11)
G112=THETA(12)+ETA(12)
;=============================== Logit G2 (NREMNREM) ================================= G21=THETA(13)+ETA(13)
G22=THETA(14)+ETA(14)
G23=THETA(15)+ETA(15)
G24=THETA(16)+ETA(16)
G25=THETA(17)+ETA(17)
G26=THETA(18)+ETA(18)
G27=THETA(19)+ETA(19)
G28=THETA(20)+ETA(20)
G29=THETA(21)+ETA(21)
G210=THETA(22)+ETA(22)
G211=THETA(23)+ETA(23)
G212=THETA(24)+ETA(24)
;================ Individual values of the Logits at the specific observation time =================
G1=G11
G2=G21
; == Linear regression of Logit at a specific observation time between the two adjacent break points ==
IF (EPOC.GT.BP1.AND.EPOC.LE.BP2) THEN
G1=G11*(BP2‐EPOC)/(BP2‐BP1)+G12*(EPOC‐BP1)/(BP2‐BP1)
G2=G21*(BP2‐EPOC)/(BP2‐BP1)+G22*(EPOC‐BP1)/(BP2‐BP1)
ENDIF
IF (EPOC.GT.BP2.AND.EPOC.LE.BP3) THEN
G1=G12*(BP3‐EPOC)/(BP3‐BP2)+G13*(EPOC‐BP2)/(BP3‐BP2)
G2=G22*(BP3‐EPOC)/(BP3‐BP2)+G23*(EPOC‐BP2)/(BP3‐BP2)
ENDIF
Appendix 2
110
IF (EPOC.GT.BP3.AND.EPOC.LE.BP4) THEN
G1=G13*(BP4‐EPOC)/(BP4‐BP3)+G14*(EPOC‐BP3)/(BP4‐BP3)
G2=G23*(BP4‐EPOC)/(BP4‐BP3)+G24*(EPOC‐BP3)/(BP4‐BP3)
ENDIF
IF (EPOC.GT.BP4.AND.EPOC.LE.BP5) THEN
G1=G14*(BP5‐EPOC)/(BP5‐BP4)+G15*(EPOC‐BP4)/(BP5‐BP4)
G2=G24*(BP5‐EPOC)/(BP5‐BP4)+G25*(EPOC‐BP4)/(BP5‐BP4)
ENDIF
IF (EPOC.GT.BP5.AND.EPOC.LE.BP6) THEN
G1=G15*(BP6‐EPOC)/(BP6‐BP5)+G16*(EPOC‐BP5)/(BP6‐BP5)
G2=G25*(BP6‐EPOC)/(BP6‐BP5)+G26*(EPOC‐BP5)/(BP6‐BP5)
ENDIF
IF (EPOC.GT.BP6.AND.EPOC.LE.BP7) THEN
G1=G16*(BP7‐EPOC)/(BP7‐BP6)+G17*(EPOC‐BP6)/(BP7‐BP6)
G2=G26*(BP7‐EPOC)/(BP7‐BP6)+G27*(EPOC‐BP6)/(BP7‐BP6)
ENDIF
IF (EPOC.GT.BP7.AND.EPOC.LE.BP8) THEN
G1=G17*(BP8‐EPOC)/(BP8‐BP7)+G18*(EPOC‐BP7)/(BP8‐BP7)
G2=G27*(BP8‐EPOC)/(BP8‐BP7)+G28*(EPOC‐BP7)/(BP8‐BP7)
ENDIF
IF (EPOC.GT.BP8.AND.EPOC.LE.BP9) THEN
G1=G18*(BP9‐EPOC)/(BP9‐BP8)+G19*(EPOC‐BP8)/(BP9‐BP8)
G2=G28*(BP9‐EPOC)/(BP9‐BP8)+G29*(EPOC‐BP8)/(BP9‐BP8)
ENDIF
IF (EPOC.GT.BP9.AND.EPOC.LE.BP10) THEN
G1=G19*(BP10‐EPOC)/(BP10‐BP9)+G110*(EPOC‐BP9)/(BP10‐BP9)
G2=G29*(BP10‐EPOC)/(BP10‐BP9)+G210*(EPOC‐BP9)/(BP10‐BP9)
ENDIF
IF (EPOC.GT.BP10.AND.EPOC.LE.BP11) THEN
G1=G110*(BP11‐EPOC)/(BP11‐BP10)+G111*(EPOC‐BP10)/(BP11‐BP10)
G2=G210*(BP11‐EPOC)/(BP11‐BP10)+G211*(EPOC‐BP10)/(BP11‐BP10)
ENDIF
IF (EPOC.GT.BP11.AND.EPOC.LE.BP12) THEN
G1=G111*(BP12‐EPOC)/(BP12‐BP11)+G112*(EPOC‐BP11)/(BP12‐BP11)
G2=G211*(BP12‐EPOC)/(BP12‐BP11)+G212*(EPOC‐BP11)/(BP12‐BP11)
ENDIF
Appendix 2
111
; ===== Inverse‐Logit in order to calculate de Transition Probability from NREM state to another =====
; ‐‐‐‐‐‐‐‐‐‐‐‐> AWAKE: PAW
PAW=EXP(G1)/(1+EXP(G1)+EXP(G2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> NREM: PNR
PNR=EXP(G2)/(1+EXP(G1)+EXP(G2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> REM: PRE
PRE=1/(1+EXP(G1)+EXP(G2))
; Likelihood
; Names in data file AWK NREM REM
Y=PAW*AWK+PNR*NREM+PRE*REM
$THETA 3.70 3.70 3.70 3.70 3.70 3.70 3.70 3.70 3.70 3.70 3.70 3.70
$THETA 3 3 3 3 3 3 3 3 3 3 3 3
$OMEGA 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
$ESTIMATION MAXEVAL=9999 NUMERICAL METHOD=COND LAPLACE LIKE CENTERING
$COVARIANCE MATRIX=R PRINT=E
$TABLE ID EPOC DV PRED PAW PNR PRE ONEHEADER NOPRINT FILE=sdtabNRPV_DAY1Farmaco
Appendix 2
112
BASELINE MODEL
‐ FROM REM
;$SIZES LTH=40 LVR=30 NO=5000 LNP4=2000 MAXIDS=20000 LIM1=5000 LIM2=5000 LIM3=200 LIM4=50
LIM5=200 LIM6=5000 ; This option is only for implemented in Nonmem 7.2
;========================================================================================
; Description: Nonmem model script for sub‐model P(REM | AWAKE) DAY ONE
;========================================================================================
$PROB Transition from REM
$INPUT ID DV=STT TIME=DROP EPOCH=TIME AWPV NRPV REPV AWK NREM REM
;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ INFORMATION ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
; 1 EPOCH = 10 SEC
; Thus 12 hours= 4320 Epochs
; Hour 4 starts at epoch 1440
; Hour 16 (4+12) finish epoch 5760
;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ STAGE AWAKE=1, NREM=2, REM=3 ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ ; NRPV (Column)
; NRPV= 1 If previous observation (epoch‐1) is AWAKE
; NRPV= 0 Otherwise
; AWK, NREM & REM (Columns)
; AWK = 1 If the state at the epoch is AWAKE
; AWK = 0 Otherwise
; NREM= 1 If the state at the epoch is NREM
; NREM= 0 Otherwise
; REM = 1 If the state at the epoch is REM
; REM = 0 Otherwise
$DATA BASELINE_REPV_Day1Farmaco.csv
; Dataset contains only observations immediately preceded by REM state
;==================================== BREAKPOINTS =====================================
$PRED
BP1=1440
BP2=1440+360
BP3=BP2+360
BP4=BP3+360
BP5=BP4+360
BP6=BP5+360
BP7=BP6+360
Appendix 2
113
BP8=BP7+360
BP9=BP8+360
BP10=BP9+360
BP11=BP10+360
BP12=BP11+360
;================================ Logit G1 (REMAWAKE) ================================ G11=THETA(1)+ETA(1)
G12=THETA(2)+ETA(2)
G13=THETA(3)+ETA(3)
G14=THETA(4)+ETA(4)
G15=THETA(5)+ETA(5)
G16=THETA(6)+ETA(6)
G17=THETA(7)+ETA(7)
G18=THETA(8)+ETA(8)
G19=THETA(9)+ETA(9)
G110=THETA(10)+ETA(10)
G111=THETA(11)+ETA(11)
G112=THETA(12)+ETA(12)
;================================ Logit G2 (REMNREM) ================================= G21=THETA(13)+ETA(13)
G22=THETA(14)+ETA(14)
G23=THETA(15)+ETA(15)
G24=THETA(16)+ETA(16)
G25=THETA(17)+ETA(17)
G26=THETA(18)+ETA(18)
G27=THETA(19)+ETA(19)
G28=THETA(20)+ETA(20)
G29=THETA(21)+ETA(21)
G210=THETA(22)+ETA(22)
G211=THETA(23)+ETA(23)
G212=THETA(24)+ETA(24)
;================ Individual values of the Logits at the specific observation time =================
G1=G11
G2=G21
; === Linear regression of Logit at a specific observation time between the two adjacent break points ====
IF (EPOC.GT.BP1.AND.EPOC.LE.BP2) THEN
G1=G11*(BP2‐EPOC)/(BP2‐BP1)+G12*(EPOC‐BP1)/(BP2‐BP1)
G2=G21*(BP2‐EPOC)/(BP2‐BP1)+G22*(EPOC‐BP1)/(BP2‐BP1)
ENDIF
IF (EPOC.GT.BP2.AND.EPOC.LE.BP3) THEN
G1=G12*(BP3‐EPOC)/(BP3‐BP2)+G13*(EPOC‐BP2)/(BP3‐BP2)
G2=G22*(BP3‐EPOC)/(BP3‐BP2)+G23*(EPOC‐BP2)/(BP3‐BP2)
ENDIF
Appendix 2
114
IF (EPOC.GT.BP3.AND.EPOC.LE.BP4) THEN
G1=G13*(BP4‐EPOC)/(BP4‐BP3)+G14*(EPOC‐BP3)/(BP4‐BP3)
G2=G23*(BP4‐EPOC)/(BP4‐BP3)+G24*(EPOC‐BP3)/(BP4‐BP3)
ENDIF
IF (EPOC.GT.BP4.AND.EPOC.LE.BP5) THEN
G1=G14*(BP5‐EPOC)/(BP5‐BP4)+G15*(EPOC‐BP4)/(BP5‐BP4)
G2=G24*(BP5‐EPOC)/(BP5‐BP4)+G25*(EPOC‐BP4)/(BP5‐BP4)
ENDIF
IF (EPOC.GT.BP5.AND.EPOC.LE.BP6) THEN
G1=G15*(BP6‐EPOC)/(BP6‐BP5)+G16*(EPOC‐BP5)/(BP6‐BP5)
G2=G25*(BP6‐EPOC)/(BP6‐BP5)+G26*(EPOC‐BP5)/(BP6‐BP5)
ENDIF
IF (EPOC.GT.BP6.AND.EPOC.LE.BP7) THEN
G1=G16*(BP7‐EPOC)/(BP7‐BP6)+G17*(EPOC‐BP6)/(BP7‐BP6)
G2=G26*(BP7‐EPOC)/(BP7‐BP6)+G27*(EPOC‐BP6)/(BP7‐BP6)
ENDIF
IF (EPOC.GT.BP7.AND.EPOC.LE.BP8) THEN
G1=G17*(BP8‐EPOC)/(BP8‐BP7)+G18*(EPOC‐BP7)/(BP8‐BP7)
G2=G27*(BP8‐EPOC)/(BP8‐BP7)+G28*(EPOC‐BP7)/(BP8‐BP7)
ENDIF
IF (EPOC.GT.BP8.AND.EPOC.LE.BP9) THEN
G1=G18*(BP9‐EPOC)/(BP9‐BP8)+G19*(EPOC‐BP8)/(BP9‐BP8)
G2=G28*(BP9‐EPOC)/(BP9‐BP8)+G29*(EPOC‐BP8)/(BP9‐BP8)
ENDIF
IF (EPOC.GT.BP9.AND.EPOC.LE.BP10) THEN
G1=G19*(BP10‐EPOC)/(BP10‐BP9)+G110*(EPOC‐BP9)/(BP10‐BP9)
G2=G29*(BP10‐EPOC)/(BP10‐BP9)+G210*(EPOC‐BP9)/(BP10‐BP9)
ENDIF
IF (EPOC.GT.BP10.AND.EPOC.LE.BP11) THEN
G1=G110*(BP11‐EPOC)/(BP11‐BP10)+G111*(EPOC‐BP10)/(BP11‐BP10)
G2=G210*(BP11‐EPOC)/(BP11‐BP10)+G211*(EPOC‐BP10)/(BP11‐BP10)
ENDIF
IF (EPOC.GT.BP11.AND.EPOC.LE.BP12) THEN
G1=G111*(BP12‐EPOC)/(BP12‐BP11)+G112*(EPOC‐BP11)/(BP12‐BP11)
G2=G211*(BP12‐EPOC)/(BP12‐BP11)+G212*(EPOC‐BP11)/(BP12‐BP11)
ENDIF
Appendix 2
115
; ====== Inverse‐Logit in order to calculate de Transition Probability from REM state to another ======
; ‐‐‐‐‐‐‐‐‐‐‐‐> AWAKE: PAW
PAW=EXP(G1)/(1+EXP(G1)+EXP(G2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> NREM: PNR
PNR=EXP(G2)/(1+EXP(G1)+EXP(G2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> REM: PRE
PRE=1/(1+EXP(G1)+EXP(G2))
; Likelihood
; Names in data file AWK NREM REM
Y=PAW*AWK+PNR*NREM+PRE*REM
$THETA 3.70 3.70 3.70 3.70 3.70 3.70 3.70 3.70 3.70 3.70 3.70 3.70
$THETA 3 3 3 3 3 3 3 3 3 3 3 3
$OMEGA 1 1 1 1 1 1 1 1 1 1 1 1
$ESTIMATION MAXEVAL=9999 NUMERICAL METHOD=COND LAPLACE LIKE CENTERING
$COVARIANCE MATRIX=R PRINT=E
$TABLE ID EPOC DV PRED PAW PNR PRE ONEHEADER NOPRINT FILE=sdtabREPV_DAY1Farmaco
Appendix 2
116
SIMULATION OF BASELINE MODEL
;$SIZES LTH=70 LVR=70 NO=5000 LNP4=2000 MAXIDS=20000 LIM1=5000 LIM2=5000 LIM3=200 LIM4=50
LIM5=200 LIM6=5000 ; This option is only for implemented in Nonmem 7.2
;========================================================================================
; Description: SIMULATION BASELINE MODEL DAY ONE
;========================================================================================
$PROB Simulation Baseline
$INPUT ID DV EPOC
;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ INFORMATION ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
; 1 EPOCH = 10 SEC
; Thus 12 hours= 4320 Epochs
; Hour 4 starts at epoch 1440
; Hour 16 (4+12) finish epoch 5760
$DATA Sim_Day1.csv
;========================= Creation of PDV (Previous Dependent Value) ========================
$PRED
IF (NEWIND.NE.2) PSDV=1
; Update PDV
PDV=PSDV
;=============================== INITIALIZE BREAK POINTS ==============================
BP1=1440
BP2=1440+360
BP3=BP2+360
BP4=BP3+360
BP5=BP4+360
BP6=BP5+360
BP7=BP6+360
BP8=BP7+360
BP9=BP8+360
BP10=BP9+360
BP11=BP10+360
BP12=BP11+360
;========================= Logit AG1 (AWAKEAWAKE); +ETA(1) ========================= AG11=THETA(1)
AG12=THETA(2)+ETA(1)
AG13=THETA(3)+ETA(2)
AG14=THETA(4)+ETA(3)
AG15=THETA(5)+ETA(4)
AG16=THETA(6)+ETA(5)
Appendix 2
117
AG17=THETA(7)+ETA(6)
AG18=THETA(8)+ETA(7)
AG19=THETA(9)+ETA(8)
AG110=THETA(10)
AG111=THETA(11)
AG112=THETA(12)+ETA(9)
;========================= Logit AG2 (AWAKENREM); +ETA(1) =========================== AG21=THETA(12)+ETA(10)
AG22=THETA(13)
AG23=THETA(14)
AG24=THETA(15)
AG25=THETA(16)+ETA(11)
AG26=THETA(17)
AG27=THETA(18)+ETA(12)
AG28=THETA(19)
AG29=THETA(20)
AG210=THETA(21)
AG211=THETA(22)
AG212=THETA(23)+ETA(13)
;========================== Logit NG1 (NREMAWAKE); +ETA(1) ========================== NG11=1.75
NG12=3.34+ETA(14)
NG13=2.19+ETA(15)
NG14=2.05+ETA(16)
NG15=2.23+ETA(17)
NG16=1.84+ETA(18)
NG17=2.05+ETA(19)
NG18=4.06+ETA(20)
NG19=2.86+ETA(21)
NG110=0.974+ETA(22)
NG111=1.10
NG112=1.25+ETA(23)
;========================== Logit NG2 (NREMNREM); +ETA(1) =========================== NG21=3.51
NG22=4.37
NG23=3.71
NG24=3.47
NG25=3.74
NG26=3.26
NG27=3.56
NG28=4.91
NG29=4.51
NG210=3.69
NG211=3.39
NG212=3.02
Appendix 2
118
;=========================== Logit RG1 (REMAWAKE); +ETA(1) =========================== RG11=‐1.46
RG12=‐0.973
RG13=‐1.25
RG14=‐1.04
RG15=‐1.17
RG16=‐1.27
RG17=‐0.821
RG18=‐1.01
RG19=‐0.899
RG110=‐1.57+ETA(24)
RG111=‐1.28
RG112=‐1.14
;============================ Logit RG2 (REMNREM); +ETA(1) ============================ RG21=‐3.09+ETA(25)
RG22=‐2.87+ETA(26)
RG23=‐3.63
RG24=‐3.29
RG25=‐3.43
RG26=‐2.86
RG27=‐3.56+ETA(27)
RG28=‐2.29+ETA(28)
RG29=‐3.97
RG210=‐2.86
RG211=‐2.92+ETA(29)
RG212=‐3+ETA(30)
;================ Individual Value of the Logits at the specific observation EPOC ===============
AG1=AG11
AG2=AG21
NG1=NG11
NG2=NG21
RG1=RG11
RG2=RG21
;= Linear Regression of Logit at specific observation EPOC between the two adjacent BREAK‐POINTS =
IF (EPOC.GT.BP1.AND.EPOC.LE.BP2) THEN
AG1=AG11*(BP2‐EPOC)/(BP2‐BP1)+AG12*(EPOC‐BP1)/(BP2‐BP1)
AG2=AG21*(BP2‐EPOC)/(BP2‐BP1)+AG22*(EPOC‐BP1)/(BP2‐BP1)
ENDIF
IF (EPOC.GT.BP2.AND.EPOC.LE.BP3) THEN
AG1=AG12*(BP3‐EPOC)/(BP3‐BP2)+AG13*(EPOC‐BP2)/(BP3‐BP2)
Appendix 2
119
AG2=AG22*(BP3‐EPOC)/(BP3‐BP2)+AG23*(EPOC‐BP2)/(BP3‐BP2)
ENDIF
IF (EPOC.GT.BP3.AND.EPOC.LE.BP4) THEN
AG1=AG13*(BP4‐EPOC)/(BP4‐BP3)+AG14*(EPOC‐BP3)/(BP4‐BP3)
AG2=AG23*(BP4‐EPOC)/(BP4‐BP3)+AG24*(EPOC‐BP3)/(BP4‐BP3)
ENDIF
IF (EPOC.GT.BP4.AND.EPOC.LE.BP5) THEN
AG1=AG14*(BP5‐EPOC)/(BP5‐BP4)+AG15*(EPOC‐BP4)/(BP5‐BP4)
AG2=AG24*(BP5‐EPOC)/(BP5‐BP4)+AG25*(EPOC‐BP4)/(BP5‐BP4)
ENDIF
IF (EPOC.GT.BP5.AND.EPOC.LE.BP6) THEN
AG1=AG15*(BP6‐EPOC)/(BP6‐BP5)+AG16*(EPOC‐BP5)/(BP6‐BP5)
AG2=AG25*(BP6‐EPOC)/(BP6‐BP5)+AG26*(EPOC‐BP5)/(BP6‐BP5)
ENDIF
IF (EPOC.GT.BP6.AND.EPOC.LE.BP7) THEN
AG1=AG16*(BP7‐EPOC)/(BP7‐BP6)+AG17*(EPOC‐BP6)/(BP7‐BP6)
AG2=AG26*(BP7‐EPOC)/(BP7‐BP6)+AG27*(EPOC‐BP6)/(BP7‐BP6)
ENDIF
IF (EPOC.GT.BP7.AND.EPOC.LE.BP8) THEN
AG1=AG17*(BP8‐EPOC)/(BP8‐BP7)+AG18*(EPOC‐BP7)/(BP8‐BP7)
AG2=AG27*(BP8‐EPOC)/(BP8‐BP7)+AG28*(EPOC‐BP7)/(BP8‐BP7)
ENDIF
IF (EPOC.GT.BP8.AND.EPOC.LE.BP9) THEN
AG1=AG18*(BP9‐EPOC)/(BP9‐BP8)+AG19*(EPOC‐BP8)/(BP9‐BP8)
AG2=AG28*(BP9‐EPOC)/(BP9‐BP8)+AG29*(EPOC‐BP8)/(BP9‐BP8)
ENDIF
IF (EPOC.GT.BP9.AND.EPOC.LE.BP10) THEN
AG1=AG19*(BP10‐EPOC)/(BP10‐BP9)+AG110*(EPOC‐BP9)/(BP10‐BP9)
AG2=AG29*(BP10‐EPOC)/(BP10‐BP9)+AG210*(EPOC‐BP9)/(BP10‐BP9)
ENDIF
IF (EPOC.GT.BP10.AND.EPOC.LE.BP11) THEN
AG1=AG110*(BP11‐EPOC)/(BP11‐BP10)+AG111*(EPOC‐BP10)/(BP11‐BP10)
AG2=AG210*(BP11‐EPOC)/(BP11‐BP10)+AG211*(EPOC‐BP10)/(BP11‐BP10)
ENDIF
IF (EPOC.GT.BP11.AND.EPOC.LE.BP12) THEN
AG1=AG111*(BP12‐EPOC)/(BP12‐BP11)+AG112*(EPOC‐BP11)/(BP12‐BP11)
Appendix 2
120
AG2=AG211*(BP12‐EPOC)/(BP12‐BP11)+AG212*(EPOC‐BP11)/(BP12‐BP11)
ENDIF
;=Linear Regression of Logit at specific observation EPOC between the two adjacent BREAK‐POINTS=
IF (EPOC.GT.BP1.AND.EPOC.LE.BP2) THEN
NG1=NG11*(BP2‐EPOC)/(BP2‐BP1)+NG12*(EPOC‐BP1)/(BP2‐BP1)
NG2=NG21*(BP2‐EPOC)/(BP2‐BP1)+NG22*(EPOC‐BP1)/(BP2‐BP1)
ENDIF
IF (EPOC.GT.BP2.AND.EPOC.LE.BP3) THEN
NG1=NG12*(BP3‐EPOC)/(BP3‐BP2)+NG13*(EPOC‐BP2)/(BP3‐BP2)
NG2=NG22*(BP3‐EPOC)/(BP3‐BP2)+NG23*(EPOC‐BP2)/(BP3‐BP2)
ENDIF
IF (EPOC.GT.BP3.AND.EPOC.LE.BP4) THEN
NG1=NG13*(BP4‐EPOC)/(BP4‐BP3)+NG14*(EPOC‐BP3)/(BP4‐BP3)
NG2=NG23*(BP4‐EPOC)/(BP4‐BP3)+NG24*(EPOC‐BP3)/(BP4‐BP3)
ENDIF
IF (EPOC.GT.BP4.AND.EPOC.LE.BP5) THEN
NG1=NG14*(BP5‐EPOC)/(BP5‐BP4)+NG15*(EPOC‐BP4)/(BP5‐BP4)
NG2=NG24*(BP5‐EPOC)/(BP5‐BP4)+NG25*(EPOC‐BP4)/(BP5‐BP4)
ENDIF
IF (EPOC.GT.BP5.AND.EPOC.LE.BP6) THEN
NG1=NG15*(BP6‐EPOC)/(BP6‐BP5)+NG16*(EPOC‐BP5)/(BP6‐BP5)
NG2=NG25*(BP6‐EPOC)/(BP6‐BP5)+NG26*(EPOC‐BP5)/(BP6‐BP5)
ENDIF
IF (EPOC.GT.BP6.AND.EPOC.LE.BP7) THEN
NG1=NG16*(BP7‐EPOC)/(BP7‐BP6)+NG17*(EPOC‐BP6)/(BP7‐BP6)
NG2=NG26*(BP7‐EPOC)/(BP7‐BP6)+NG27*(EPOC‐BP6)/(BP7‐BP6)
ENDIF
IF (EPOC.GT.BP7.AND.EPOC.LE.BP8) THEN
NG1=NG17*(BP8‐EPOC)/(BP8‐BP7)+NG18*(EPOC‐BP7)/(BP8‐BP7)
NG2=NG27*(BP8‐EPOC)/(BP8‐BP7)+NG28*(EPOC‐BP7)/(BP8‐BP7)
ENDIF
IF (EPOC.GT.BP8.AND.EPOC.LE.BP9) THEN
NG1=NG18*(BP9‐EPOC)/(BP9‐BP8)+NG19*(EPOC‐BP8)/(BP9‐BP8)
NG2=NG28*(BP9‐EPOC)/(BP9‐BP8)+NG29*(EPOC‐BP8)/(BP9‐BP8)
ENDIF
Appendix 2
121
IF (EPOC.GT.BP9.AND.EPOC.LE.BP10) THEN
NG1=NG19*(BP10‐EPOC)/(BP10‐BP9)+NG110*(EPOC‐BP9)/(BP10‐BP9)
NG2=NG29*(BP10‐EPOC)/(BP10‐BP9)+NG210*(EPOC‐BP9)/(BP10‐BP9)
ENDIF
IF (EPOC.GT.BP10.AND.EPOC.LE.BP11) THEN
NG1=NG110*(BP11‐EPOC)/(BP11‐BP10)+NG111*(EPOC‐BP10)/(BP11‐BP10)
NG2=NG210*(BP11‐EPOC)/(BP11‐BP10)+NG211*(EPOC‐BP10)/(BP11‐BP10)
ENDIF
IF (EPOC.GT.BP11.AND.EPOC.LE.BP12) THEN
NG1=NG111*(BP12‐EPOC)/(BP12‐BP11)+NG112*(EPOC‐BP11)/(BP12‐BP11)
NG2=NG211*(BP12‐EPOC)/(BP12‐BP11)+NG212*(EPOC‐BP11)/(BP12‐BP11)
ENDIF
;= Linear Regression of Logit at specific observation EPOC between the two adjacent BREAK‐POINTS =
IF (EPOC.GT.BP1.AND.EPOC.LE.BP2) THEN
RG1=RG11*(BP2‐EPOC)/(BP2‐BP1)+RG12*(EPOC‐BP1)/(BP2‐BP1)
RG2=RG21*(BP2‐EPOC)/(BP2‐BP1)+RG22*(EPOC‐BP1)/(BP2‐BP1)
ENDIF
IF (EPOC.GT.BP2.AND.EPOC.LE.BP3) THEN
RG1=RG12*(BP3‐EPOC)/(BP3‐BP2)+RG13*(EPOC‐BP2)/(BP3‐BP2)
RG2=RG22*(BP3‐EPOC)/(BP3‐BP2)+RG23*(EPOC‐BP2)/(BP3‐BP2)
ENDIF
IF (EPOC.GT.BP3.AND.EPOC.LE.BP4) THEN
RG1=RG13*(BP4‐EPOC)/(BP4‐BP3)+RG14*(EPOC‐BP3)/(BP4‐BP3)
RG2=RG23*(BP4‐EPOC)/(BP4‐BP3)+RG24*(EPOC‐BP3)/(BP4‐BP3)
ENDIF
IF (EPOC.GT.BP4.AND.EPOC.LE.BP5) THEN
RG1=RG14*(BP5‐EPOC)/(BP5‐BP4)+RG15*(EPOC‐BP4)/(BP5‐BP4)
RG2=RG24*(BP5‐EPOC)/(BP5‐BP4)+RG25*(EPOC‐BP4)/(BP5‐BP4)
ENDIF
IF (EPOC.GT.BP5.AND.EPOC.LE.BP6) THEN
RG1=RG15*(BP6‐EPOC)/(BP6‐BP5)+RG16*(EPOC‐BP5)/(BP6‐BP5)
RG2=RG25*(BP6‐EPOC)/(BP6‐BP5)+RG26*(EPOC‐BP5)/(BP6‐BP5)
ENDIF
IF (EPOC.GT.BP6.AND.EPOC.LE.BP7) THEN
RG1=RG16*(BP7‐EPOC)/(BP7‐BP6)+RG17*(EPOC‐BP6)/(BP7‐BP6)
RG2=RG26*(BP7‐EPOC)/(BP7‐BP6)+RG27*(EPOC‐BP6)/(BP7‐BP6)
ENDIF
Appendix 2
122
IF (EPOC.GT.BP7.AND.EPOC.LE.BP8) THEN
RG1=RG17*(BP8‐EPOC)/(BP8‐BP7)+RG18*(EPOC‐BP7)/(BP8‐BP7)
RG2=RG27*(BP8‐EPOC)/(BP8‐BP7)+RG28*(EPOC‐BP7)/(BP8‐BP7)
ENDIF
IF (EPOC.GT.BP8.AND.EPOC.LE.BP9) THEN
RG1=RG18*(BP9‐EPOC)/(BP9‐BP8)+RG19*(EPOC‐BP8)/(BP9‐BP8)
RG2=RG28*(BP9‐EPOC)/(BP9‐BP8)+RG29*(EPOC‐BP8)/(BP9‐BP8)
ENDIF
IF (EPOC.GT.BP9.AND.EPOC.LE.BP10) THEN
RG1=RG19*(BP10‐EPOC)/(BP10‐BP9)+RG110*(EPOC‐BP9)/(BP10‐BP9)
RG2=RG29*(BP10‐EPOC)/(BP10‐BP9)+RG210*(EPOC‐BP9)/(BP10‐BP9)
ENDIF
IF (EPOC.GT.BP10.AND.EPOC.LE.BP11) THEN
RG1=RG110*(BP11‐EPOC)/(BP11‐BP10)+RG111*(EPOC‐BP10)/(BP11‐BP10)
RG2=RG210*(BP11‐EPOC)/(BP11‐BP10)+RG211*(EPOC‐BP10)/(BP11‐BP10)
ENDIF
IF (EPOC.GT.BP11.AND.EPOC.LE.BP12) THEN
RG1=RG111*(BP12‐EPOC)/(BP12‐BP11)+RG112*(EPOC‐BP11)/(BP12‐BP11)
RG2=RG211*(BP12‐EPOC)/(BP12‐BP11)+RG212*(EPOC‐BP11)/(BP12‐BP11)
ENDIF
;======== Inverse‐Logit in order to calculate the transition probability from AWAKE state to =======
; ‐‐‐‐‐‐‐‐‐‐‐‐> AWAKE: PAW
APAW=EXP(AG1)/(1+EXP(AG1)+EXP(AG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> NREM: PNR
APNR=EXP(AG2)/(1+EXP(AG1)+EXP(AG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> REM: PRE
APRE=1/(1+EXP(AG1)+EXP(AG2))
;========= Inverse‐Logit in order to calculate the transition probability from NREM state to ========
; ‐‐‐‐‐‐‐‐‐‐‐‐> AWAKE: PAW
NPAW=EXP(NG1)/(1+EXP(NG1)+EXP(NG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> NREM: PNR
NPNR=EXP(NG2)/(1+EXP(NG1)+EXP(NG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> REM: PRE
NPRE=1/(1+EXP(NG1)+EXP(NG2))
;========== Inverse‐Logit in order to calculate the transition probability from REM state to =========
Appendix 2
123
; ‐‐‐‐‐‐‐‐‐‐‐‐> AWAKE: PAW
RPAW=EXP(RG1)/(1+EXP(RG1)+EXP(RG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> NREM: PNR
RPNR=EXP(RG2)/(1+EXP(RG1)+EXP(RG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> REM: PRE
RPRE=1/(1+EXP(RG1)+EXP(RG2))
;============================= LIMITES OF DISCRETIZATION =============================
;================= From AWAKE at limit_AWtoAW(1) will be used for the hour 1 ================
AL1=APAW;
AL2=APAW+APNR;
;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ NOTE: AWAKEtoAWAKE+AWAKEtoNR+AWAKEtoRE=1 ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
; From NREM
NL1=NPAW;
NL2=NPAW+NPNR;
; From REM.
RL1=RPAW;
RL2=RPAW+RPNR;
;================================= SIMULATION BLOCK =================================
IF (ICALL.EQ.4) THEN ; Beginning of the simulation
CALL RANDOM (2,R) ; Rand number in[0,1[
IF (PDV.EQ.1) THEN
IF (R.LT.AL1) THEN
DV=1
ELSEIF (R.LT.AL2) THEN
DV=2
ELSE
DV=3
ENDIF
ELSEIF (PDV.EQ.2) THEN
IF (R.LT.NL1) THEN
DV=1
ELSEIF (R.LT.NL2) THEN
DV=2
ELSE
DV=3
ENDIF
ELSEIF (PDV.EQ.3) THEN
IF (R.LT.RL1) THEN
DV=1
ELSEIF (R.LT.RL2) THEN
Appendix 2
124
DV=2
ELSE
DV=3
ENDIF
ENDIF
ENDIF
PSDV=DV
NSIM=IREP
$THETA 4.58 5.68 4.87 5.20 4.94 4.74 4.96 6.34 5.43 2.47 3.29 4.04 2.67 2.93 3.31 2.81 3.05 2.83 2.94
3.99 2.90 2.18 2.33 2.20 ; From AWAKE
;$THETA ; From NREM
;$THETA ; From REM
$OMEGA 0.287 0.642 1.12 0.512 0.687 0.748 0.315 1.06 3.82 0.225 0.209 0.337 0.791 ; From AWAKE
$OMEGA 0.258 0.397 0.317 0.557 0.235 0.374 0.301 0.288 0.270 0.279 ; From NREM
$OMEGA 0.436 0.378 0.481 0.565 3.15 0.613 1.62 ; From REM
$SIMULATION (55555) SUBPROBLEMS=1000 (678910 UNIFORM) ONLYSIM NOPRED
$TABLE NSIM ID EPOC DV PDV PSDV APAW APNR APRE NPAW NPNR NPRE RPAW RPNR RPRE
NOHEADER NOAPPEND NOPRINT FILE=SIM_DAY1_Base
Appendix 3
125
APPENDIX 3
VEHICLE MODEL
‐ FROM NREM
;$SIZES LTH=40 LVR=30 NO=5000 LNP4=2000 MAXIDS=20000 LIM1=5000 LIM2=5000 LIM3=200 LIM4=50
LIM5=200 LIM6=5000 ; This option is only for implemented in Nonmem 7.2
;========================================================================================
; Description: Nonmem model script for sub‐model P(NREM | AWAKE) DAY TWO
;========================================================================================
$PROB Transition from NREM
$INPUT ID DV=STT EPOC AWPV NRPV REPV AWK NREM REM
;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ INFORMATION ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
; 1 EPOCH = 10 SEC
; Thus 12 hours= 4320 Epochs
; Hour 4 starts at epoch 1440
; Hour 16 (4+12) finish epoch 5760
;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ STAGE AWAKE=1, NREM=2, REM=3 ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ ; AWPV (Column)
; AWPV= 1 If previous observation (epoch‐1) is awake
; AWPV= 0 Otherwise
; AWK, NREM & REM (Columns)
; AWK = 1 If the state at the epoch is AWAKE
; AWK = 0 Otherwise
; NREM= 1 If the state at the epoch is NREM
; NREM= 0 Otherwise
; REM = 1 If the state at the epoch is REM
; REM = 0 Otherwise
$DATA Vehicle_NRPDV_Day2Placebo.csv
; Dataset contains only observations immediately preceded by NREM state
;================================== BREAK POINTS ======================================
$PRED
BP1=10080
BP2=BP1+360
BP3=BP2+360
BP4=BP3+360
BP5=BP4+360
Appendix 3
126
BP6=BP5+360
BP7=BP6+360
BP8=BP7+360
BP9=BP8+360
BP10=BP9+360
BP11=BP10+360
BP12=BP11+360
===================================== PARAMETERS =====================================
B1=THETA(1)
KON1=THETA(2)
KRE1=THETA(3)
MET1=0
MET2=0
IF (EPOC.GE.BP3) THEN
MET1=‐B1*(EXP(‐KON1*(EPOC‐BP3))‐EXP(‐KRE1*(EPOC‐BP3)))
MET2=0
ENDIF
EFF1=1+MET1
EFF2=1+MET2
;============================== Logit NG1 (NREMAWAKE) ============================== NG11=1.80*EFF1
NG12=3.80*EFF1
NG13=(2.99+ETA(1))*EFF1
NG14=2.33*EFF1
NG15=3.80*EFF1
NG16=(2.50+ETA(2))*EFF1
NG17=(2.96+ETA(3))*EFF1
NG18=3.44*EFF1
NG19=1.83*EFF1
NG110=(0.764+ETA(4))*EFF1
NG111=1.19*EFF1
NG112=1.43*EFF1
;=============================== Logit NG2 (NREMNREM) =============================== NG21=3.48*EFF2
NG22=4.67*EFF2
NG23=4.25*EFF2
NG24=3.57*EFF2
NG25=4.94*EFF2
NG26=3.70*EFF2
NG27=4.12*EFF2
NG28=4.32*EFF2
NG29=3.98*EFF2
NG210=3.48*EFF2
NG211=3.27*EFF2
NG212=(3.13+ETA(5))*EFF2
Appendix 3
127
;================ Individual values of the Logits at the specific observation time =================
NG1=NG11
NG2=NG21
;= Linear Regression of Logits at a specific observation EPOC between the two adjacent Break‐Points =
IF (EPOC.GT.BP1.AND.EPOC.LE.BP2) THEN
NG1=NG11*(BP2‐EPOC)/(BP2‐BP1)+NG12*(EPOC‐BP1)/(BP2‐BP1)
NG2=NG21*(BP2‐EPOC)/(BP2‐BP1)+NG22*(EPOC‐BP1)/(BP2‐BP1)
ENDIF
IF (EPOC.GT.BP2.AND.EPOC.LE.BP3) THEN
NG1=NG12*(BP3‐EPOC)/(BP3‐BP2)+NG13*(EPOC‐BP2)/(BP3‐BP2)
NG2=NG22*(BP3‐EPOC)/(BP3‐BP2)+NG23*(EPOC‐BP2)/(BP3‐BP2)
ENDIF
IF (EPOC.GT.BP3.AND.EPOC.LE.BP4) THEN
NG1=NG13*(BP4‐EPOC)/(BP4‐BP3)+NG14*(EPOC‐BP3)/(BP4‐BP3)
NG2=NG23*(BP4‐EPOC)/(BP4‐BP3)+NG24*(EPOC‐BP3)/(BP4‐BP3)
ENDIF
IF (EPOC.GT.BP4.AND.EPOC.LE.BP5) THEN
NG1=NG14*(BP5‐EPOC)/(BP5‐BP4)+NG15*(EPOC‐BP4)/(BP5‐BP4)
NG2=NG24*(BP5‐EPOC)/(BP5‐BP4)+NG25*(EPOC‐BP4)/(BP5‐BP4)
ENDIF
IF (EPOC.GT.BP5.AND.EPOC.LE.BP6) THEN
NG1=NG15*(BP6‐EPOC)/(BP6‐BP5)+NG16*(EPOC‐BP5)/(BP6‐BP5)
NG2=NG25*(BP6‐EPOC)/(BP6‐BP5)+NG26*(EPOC‐BP5)/(BP6‐BP5)
ENDIF
IF (EPOC.GT.BP6.AND.EPOC.LE.BP7) THEN
NG1=NG16*(BP7‐EPOC)/(BP7‐BP6)+NG17*(EPOC‐BP6)/(BP7‐BP6)
NG2=NG26*(BP7‐EPOC)/(BP7‐BP6)+NG27*(EPOC‐BP6)/(BP7‐BP6)
ENDIF
IF (EPOC.GT.BP7.AND.EPOC.LE.BP8) THEN
NG1=NG17*(BP8‐EPOC)/(BP8‐BP7)+NG18*(EPOC‐BP7)/(BP8‐BP7)
NG2=NG27*(BP8‐EPOC)/(BP8‐BP7)+NG28*(EPOC‐BP7)/(BP8‐BP7)
ENDIF
IF (EPOC.GT.BP8.AND.EPOC.LE.BP9) THEN
NG1=NG18*(BP9‐EPOC)/(BP9‐BP8)+NG19*(EPOC‐BP8)/(BP9‐BP8)
NG2=NG28*(BP9‐EPOC)/(BP9‐BP8)+NG29*(EPOC‐BP8)/(BP9‐BP8)
ENDIF
Appendix 3
128
IF (EPOC.GT.BP9.AND.EPOC.LE.BP10) THEN
NG1=NG19*(BP10‐EPOC)/(BP10‐BP9)+NG110*(EPOC‐BP9)/(BP10‐BP9)
NG2=NG29*(BP10‐EPOC)/(BP10‐BP9)+NG210*(EPOC‐BP9)/(BP10‐BP9)
ENDIF
IF (EPOC.GT.BP10.AND.EPOC.LE.BP11) THEN
NG1=NG110*(BP11‐EPOC)/(BP11‐BP10)+NG111*(EPOC‐BP10)/(BP11‐BP10)
NG2=NG210*(BP11‐EPOC)/(BP11‐BP10)+NG211*(EPOC‐BP10)/(BP11‐BP10)
ENDIF
IF (EPOC.GT.BP11.AND.EPOC.LE.BP12) THEN
NG1=NG111*(BP12‐EPOC)/(BP12‐BP11)+NG112*(EPOC‐BP11)/(BP12‐BP11)
NG2=NG211*(BP12‐EPOC)/(BP12‐BP11)+NG212*(EPOC‐BP11)/(BP12‐BP11)
ENDIF
;========= Inverse‐Logit in order to calculate de Transition Probability from NREM state to ========
; ‐‐‐‐‐‐‐‐‐‐‐‐> AWAKE: PAW
NPAW=EXP(NG1)/(1+EXP(NG1)+EXP(NG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> NREM: PNR
NPNR=EXP(NG2)/(1+EXP(NG1)+EXP(NG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> REM: PRE
NPRE=1/(1+EXP(NG1)+EXP(NG2))
; Likelihood
; Names in data file AWK NREM REM
Y=NPAW*AWK+NPNR*NREM+NPRE*REM
$THETA (0,2,20) ;B1
$THETA (0,0.00283) ;KON1
$THETA (0,0.00214) ;KRE1
$OMEGA 0.3 FIX
$OMEGA 0.107 FIX
$OMEGA 0.191 FIX
$OMEGA 0.182 FIX
$OMEGA 0.391 FIX ; From NREM
$ESTIMATION MAXEVAL=9999 NUMERICAL METHOD=COND LAPLACE LIKE CENTERING
MSFO=msfo1
$COVARIANCE MATRIX=R PRINT=E
$TABLE ID EPOC DV PRED NPAW NPNR NPRE ONEHEADER NOPRINT
FILE=sdtabNRPV_DAY2Placebo
Appendix 3
129
SIMULATION OF VEHICLE MODEL
;$SIZES LTH=70 LVR=70 NO=5000 LNP4=2000 MAXIDS=20000 LIM1=5000 LIM2=5000 LIM3=200 LIM4=50
LIM5=200 LIM6=5000 ; This option is only for implemented in Nonmem 7.2
;========================================================================================
; Description: SIMULATION METHYLCELLULOSE DAY TWO
;========================================================================================
$PROB Simulation Methylcellulose
$INPUT ID DV EPOC=TIME
;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ INFORMATION ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
; 1 EPOCH = 10 SEC
; Thus 12 hours= 4320 Epochs
; Hour 28 starts at epoch 10080
; Hour 40 (28+12) finish epoch 14400
$DATA Sim_Day2.csv
;======================= Creation of PDV (Previous Dependent Value) ==========================
$PRED
IF (NEWIND.NE.2) PSDV=1
; Update PDV
PDV=PSDV
;==================================== BREAKPOINTS =====================================
BP1=10080
BP2=BP1+360
BP3=BP2+360
BP4=BP3+360
BP5=BP4+360
BP6=BP5+360
BP7=BP6+360
BP8=BP7+360
BP9=BP8+360
BP10=BP9+360
BP11=BP10+360
BP12=BP11+360‐1
;==================================== PARAMETERS =====================================
B1=THETA(1)
KON1=THETA(2)
KRE1=THETA(3)
MET1=0
MET2=0
IF (EPOC.GE.BP3) THEN
Appendix 3
130
MET1=‐B1*(EXP(‐KON1*(EPOC‐BP3))‐EXP(‐KRE1*(EPOC‐BP3)))
MET2=0
ENDIF
EFF1=1+MET1
EFF2=1+MET2
;========================= Logit AG1 (AWAKEAWAKE); +ETA(1) ========================== AG11=3.86+ETA(1)
AG12=7.41+ETA(2)
AG13=5.74
AG14=5.06+ETA(3)
AG15=5.47+ETA(4)
AG16=5.28
AG17=6.36
AG18=6.68
AG19=3.81+ETA(5)
AG110=2.03
AG111=2.89+ETA(6)
AG112=4.36+ETA(7)
;========================= Logit AG2 (AWAKENREM); +ETA(1) =========================== AG21=2.32+ETA(8)
AG22=4.95
AG23=3.81+ETA(9)
AG24=3.00
AG25=3.45
AG26=3.35+ETA(10)
AG27=4.59
AG28=4.31+ETA(11)
AG29=2.07
AG210=1.53
AG211=2.09
AG212=2.68
;========================== Logit NG1 (NREMAWAKE); +ETA(1) ========================== NG11=1.80*EFF1
NG12=3.80*EFF1
NG13=(2.99+ETA(12))*EFF1
NG14=2.33*EFF1
NG15=3.80*EFF1
NG16=(2.50+ETA(13))*EFF1
NG17=(2.96+ETA(14))*EFF1
NG18=3.44*EFF1
NG19=1.83*EFF1
NG110=(0.764+ETA(15))*EFF1
NG111=1.19*EFF1
NG112=1.43*EFF1
Appendix 3
131
;=========================== Logit NG2 (NREMNREM); +ETA(1) =========================== NG21=3.48*EFF2
NG22=4.67*EFF2
NG23=4.25*EFF2
NG24=3.57*EFF2
NG25=4.94*EFF2
NG26=3.70*EFF2
NG27=4.12*EFF2
NG28=4.32*EFF2
NG29=3.98*EFF2
NG210=3.48*EFF2
NG211=3.27*EFF2
NG212=(3.13+ETA(16))*EFF2
;========================= Logit RG1 (REMAWAKE); +ETA(1) ============================= RG11=‐1.35+ETA(17)
RG12=‐1.22
RG13=‐1.41+ETA(18)
RG14=‐0.598+ETA(19)
RG15=‐1.08+ETA(20)
RG16=‐1.5
RG17=‐0.902+ETA(21)
RG18=‐0.625
RG19=‐1.48
RG110=‐1.13
RG111=‐1.45
RG112=‐1.48
;========================== Logit RG2 (REMNREM) +ETA(1) ============================== RG21=‐3.12+ETA(22)
RG22=‐6.11+ETA(23)
RG23=‐3.15
RG24=‐3.61
RG25=‐3.24
RG26=‐3.63+ETA(24)
RG27=‐2.89+ETA(25)
RG28=‐2.63
RG29=‐2.82
RG210=‐3.59+ETA(26)
RG211=‐3.09+ETA(27)
RG212=‐2.72
;=============== Individual values of the Logits at the specific observation EPOC ================
AG1=AG11
AG2=AG21
NG1=NG11
NG2=NG21
Appendix 3
132
RG1=RG11
RG2=RG21
;= Linear Regression of Logit at specific observation EPOC between the two adjacent BREAK‐POINTS =
IF (EPOC.GT.BP1.AND.EPOC.LE.BP2) THEN
AG1=AG11*(BP2‐EPOC)/(BP2‐BP1)+AG12*(EPOC‐BP1)/(BP2‐BP1)
AG2=AG21*(BP2‐EPOC)/(BP2‐BP1)+AG22*(EPOC‐BP1)/(BP2‐BP1)
ENDIF
IF (EPOC.GT.BP2.AND.EPOC.LE.BP3) THEN
AG1=AG12*(BP3‐EPOC)/(BP3‐BP2)+AG13*(EPOC‐BP2)/(BP3‐BP2)
AG2=AG22*(BP3‐EPOC)/(BP3‐BP2)+AG23*(EPOC‐BP2)/(BP3‐BP2)
ENDIF
IF (EPOC.GT.BP3.AND.EPOC.LE.BP4) THEN
AG1=AG13*(BP4‐EPOC)/(BP4‐BP3)+AG14*(EPOC‐BP3)/(BP4‐BP3)
AG2=AG23*(BP4‐EPOC)/(BP4‐BP3)+AG24*(EPOC‐BP3)/(BP4‐BP3)
ENDIF
IF (EPOC.GT.BP4.AND.EPOC.LE.BP5) THEN
AG1=AG14*(BP5‐EPOC)/(BP5‐BP4)+AG15*(EPOC‐BP4)/(BP5‐BP4)
AG2=AG24*(BP5‐EPOC)/(BP5‐BP4)+AG25*(EPOC‐BP4)/(BP5‐BP4)
ENDIF
IF (EPOC.GT.BP5.AND.EPOC.LE.BP6) THEN
AG1=AG15*(BP6‐EPOC)/(BP6‐BP5)+AG16*(EPOC‐BP5)/(BP6‐BP5)
AG2=AG25*(BP6‐EPOC)/(BP6‐BP5)+AG26*(EPOC‐BP5)/(BP6‐BP5)
ENDIF
IF (EPOC.GT.BP6.AND.EPOC.LE.BP7) THEN
AG1=AG16*(BP7‐EPOC)/(BP7‐BP6)+AG17*(EPOC‐BP6)/(BP7‐BP6)
AG2=AG26*(BP7‐EPOC)/(BP7‐BP6)+AG27*(EPOC‐BP6)/(BP7‐BP6)
ENDIF
IF (EPOC.GT.BP7.AND.EPOC.LE.BP8) THEN
AG1=AG17*(BP8‐EPOC)/(BP8‐BP7)+AG18*(EPOC‐BP7)/(BP8‐BP7)
AG2=AG27*(BP8‐EPOC)/(BP8‐BP7)+AG28*(EPOC‐BP7)/(BP8‐BP7)
ENDIF
IF (EPOC.GT.BP8.AND.EPOC.LE.BP9) THEN
AG1=AG18*(BP9‐EPOC)/(BP9‐BP8)+AG19*(EPOC‐BP8)/(BP9‐BP8)
AG2=AG28*(BP9‐EPOC)/(BP9‐BP8)+AG29*(EPOC‐BP8)/(BP9‐BP8)
ENDIF
Appendix 3
133
IF (EPOC.GT.BP9.AND.EPOC.LE.BP10) THEN
AG1=AG19*(BP10‐EPOC)/(BP10‐BP9)+AG110*(EPOC‐BP9)/(BP10‐BP9)
AG2=AG29*(BP10‐EPOC)/(BP10‐BP9)+AG210*(EPOC‐BP9)/(BP10‐BP9)
ENDIF
IF (EPOC.GT.BP10.AND.EPOC.LE.BP11) THEN
AG1=AG110*(BP11‐EPOC)/(BP11‐BP10)+AG111*(EPOC‐BP10)/(BP11‐BP10)
AG2=AG210*(BP11‐EPOC)/(BP11‐BP10)+AG211*(EPOC‐BP10)/(BP11‐BP10)
ENDIF
IF (EPOC.GT.BP11.AND.EPOC.LE.BP12) THEN
AG1=AG111*(BP12‐EPOC)/(BP12‐BP11)+AG112*(EPOC‐BP11)/(BP12‐BP11)
AG2=AG211*(BP12‐EPOC)/(BP12‐BP11)+AG212*(EPOC‐BP11)/(BP12‐BP11)
ENDIF
;= Linear Regression of Logit at specific observation EPOC between the two adjacent BREAK‐POINTS =
IF (EPOC.GT.BP1.AND.EPOC.LE.BP2) THEN
NG1=NG11*(BP2‐EPOC)/(BP2‐BP1)+NG12*(EPOC‐BP1)/(BP2‐BP1)
NG2=NG21*(BP2‐EPOC)/(BP2‐BP1)+NG22*(EPOC‐BP1)/(BP2‐BP1)
ENDIF
IF (EPOC.GT.BP2.AND.EPOC.LE.BP3) THEN
NG1=NG12*(BP3‐EPOC)/(BP3‐BP2)+NG13*(EPOC‐BP2)/(BP3‐BP2)
NG2=NG22*(BP3‐EPOC)/(BP3‐BP2)+NG23*(EPOC‐BP2)/(BP3‐BP2)
ENDIF
IF (EPOC.GT.BP3.AND.EPOC.LE.BP4) THEN
NG1=NG13*(BP4‐EPOC)/(BP4‐BP3)+NG14*(EPOC‐BP3)/(BP4‐BP3)
NG2=NG23*(BP4‐EPOC)/(BP4‐BP3)+NG24*(EPOC‐BP3)/(BP4‐BP3)
ENDIF
IF (EPOC.GT.BP4.AND.EPOC.LE.BP5) THEN
NG1=NG14*(BP5‐EPOC)/(BP5‐BP4)+NG15*(EPOC‐BP4)/(BP5‐BP4)
NG2=NG24*(BP5‐EPOC)/(BP5‐BP4)+NG25*(EPOC‐BP4)/(BP5‐BP4)
ENDIF
IF (EPOC.GT.BP5.AND.EPOC.LE.BP6) THEN
NG1=NG15*(BP6‐EPOC)/(BP6‐BP5)+NG16*(EPOC‐BP5)/(BP6‐BP5)
NG2=NG25*(BP6‐EPOC)/(BP6‐BP5)+NG26*(EPOC‐BP5)/(BP6‐BP5)
ENDIF
IF (EPOC.GT.BP6.AND.EPOC.LE.BP7) THEN
NG1=NG16*(BP7‐EPOC)/(BP7‐BP6)+NG17*(EPOC‐BP6)/(BP7‐BP6)
NG2=NG26*(BP7‐EPOC)/(BP7‐BP6)+NG27*(EPOC‐BP6)/(BP7‐BP6)
ENDIF
Appendix 3
134
IF (EPOC.GT.BP7.AND.EPOC.LE.BP8) THEN
NG1=NG17*(BP8‐EPOC)/(BP8‐BP7)+NG18*(EPOC‐BP7)/(BP8‐BP7)
NG2=NG27*(BP8‐EPOC)/(BP8‐BP7)+NG28*(EPOC‐BP7)/(BP8‐BP7)
ENDIF
IF (EPOC.GT.BP8.AND.EPOC.LE.BP9) THEN
NG1=NG18*(BP9‐EPOC)/(BP9‐BP8)+NG19*(EPOC‐BP8)/(BP9‐BP8)
NG2=NG28*(BP9‐EPOC)/(BP9‐BP8)+NG29*(EPOC‐BP8)/(BP9‐BP8)
ENDIF
IF (EPOC.GT.BP9.AND.EPOC.LE.BP10) THEN
NG1=NG19*(BP10‐EPOC)/(BP10‐BP9)+NG110*(EPOC‐BP9)/(BP10‐BP9)
NG2=NG29*(BP10‐EPOC)/(BP10‐BP9)+NG210*(EPOC‐BP9)/(BP10‐BP9)
ENDIF
IF (EPOC.GT.BP10.AND.EPOC.LE.BP11) THEN
NG1=NG110*(BP11‐EPOC)/(BP11‐BP10)+NG111*(EPOC‐BP10)/(BP11‐BP10)
NG2=NG210*(BP11‐EPOC)/(BP11‐BP10)+NG211*(EPOC‐BP10)/(BP11‐BP10)
ENDIF
IF (EPOC.GT.BP11.AND.EPOC.LE.BP12) THEN
NG1=NG111*(BP12‐EPOC)/(BP12‐BP11)+NG112*(EPOC‐BP11)/(BP12‐BP11)
NG2=NG211*(BP12‐EPOC)/(BP12‐BP11)+NG212*(EPOC‐BP11)/(BP12‐BP11)
ENDIF
;= Linear Regression of Logit at specific observation EPOC between the two adjacent BREAK‐POINTS =
IF (EPOC.GT.BP1.AND.EPOC.LE.BP2) THEN
RG1=RG11*(BP2‐EPOC)/(BP2‐BP1)+RG12*(EPOC‐BP1)/(BP2‐BP1)
RG2=RG21*(BP2‐EPOC)/(BP2‐BP1)+RG22*(EPOC‐BP1)/(BP2‐BP1)
ENDIF
IF (EPOC.GT.BP2.AND.EPOC.LE.BP3) THEN
RG1=RG12*(BP3‐EPOC)/(BP3‐BP2)+RG13*(EPOC‐BP2)/(BP3‐BP2)
RG2=RG22*(BP3‐EPOC)/(BP3‐BP2)+RG23*(EPOC‐BP2)/(BP3‐BP2)
ENDIF
IF (EPOC.GT.BP3.AND.EPOC.LE.BP4) THEN
RG1=RG13*(BP4‐EPOC)/(BP4‐BP3)+RG14*(EPOC‐BP3)/(BP4‐BP3)
RG2=RG23*(BP4‐EPOC)/(BP4‐BP3)+RG24*(EPOC‐BP3)/(BP4‐BP3)
ENDIF
IF (EPOC.GT.BP4.AND.EPOC.LE.BP5) THEN
RG1=RG14*(BP5‐EPOC)/(BP5‐BP4)+RG15*(EPOC‐BP4)/(BP5‐BP4)
RG2=RG24*(BP5‐EPOC)/(BP5‐BP4)+RG25*(EPOC‐BP4)/(BP5‐BP4)
ENDIF
Appendix 3
135
IF (EPOC.GT.BP5.AND.EPOC.LE.BP6) THEN
RG1=RG15*(BP6‐EPOC)/(BP6‐BP5)+RG16*(EPOC‐BP5)/(BP6‐BP5)
RG2=RG25*(BP6‐EPOC)/(BP6‐BP5)+RG26*(EPOC‐BP5)/(BP6‐BP5)
ENDIF
IF (EPOC.GT.BP6.AND.EPOC.LE.BP7) THEN
RG1=RG16*(BP7‐EPOC)/(BP7‐BP6)+RG17*(EPOC‐BP6)/(BP7‐BP6)
RG2=RG26*(BP7‐EPOC)/(BP7‐BP6)+RG27*(EPOC‐BP6)/(BP7‐BP6)
ENDIF
IF (EPOC.GT.BP7.AND.EPOC.LE.BP8) THEN
RG1=RG17*(BP8‐EPOC)/(BP8‐BP7)+RG18*(EPOC‐BP7)/(BP8‐BP7)
RG2=RG27*(BP8‐EPOC)/(BP8‐BP7)+RG28*(EPOC‐BP7)/(BP8‐BP7)
ENDIF
IF (EPOC.GT.BP8.AND.EPOC.LE.BP9) THEN
RG1=RG18*(BP9‐EPOC)/(BP9‐BP8)+RG19*(EPOC‐BP8)/(BP9‐BP8)
RG2=RG28*(BP9‐EPOC)/(BP9‐BP8)+RG29*(EPOC‐BP8)/(BP9‐BP8)
ENDIF
IF (EPOC.GT.BP9.AND.EPOC.LE.BP10) THEN
RG1=RG19*(BP10‐EPOC)/(BP10‐BP9)+RG110*(EPOC‐BP9)/(BP10‐BP9)
RG2=RG29*(BP10‐EPOC)/(BP10‐BP9)+RG210*(EPOC‐BP9)/(BP10‐BP9)
ENDIF
IF (EPOC.GT.BP10.AND.EPOC.LE.BP11) THEN
RG1=RG110*(BP11‐EPOC)/(BP11‐BP10)+RG111*(EPOC‐BP10)/(BP11‐BP10)
RG2=RG210*(BP11‐EPOC)/(BP11‐BP10)+RG211*(EPOC‐BP10)/(BP11‐BP10)
ENDIF
IF (EPOC.GT.BP11.AND.EPOC.LE.BP12) THEN
RG1=RG111*(BP12‐EPOC)/(BP12‐BP11)+RG112*(EPOC‐BP11)/(BP12‐BP11)
RG2=RG211*(BP12‐EPOC)/(BP12‐BP11)+RG212*(EPOC‐BP11)/(BP12‐BP11)
ENDIF
;==== Inverse‐Logit in order to calculate de Transition Probability from AWAKE state to another ====
; ‐‐‐‐‐‐‐‐‐‐‐‐> AWAKE: PAW
APAW=EXP(AG1)/(1+EXP(AG1)+EXP(AG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐‐> NREM: PNR
APNR=EXP(AG2)/(1+EXP(AG1)+EXP(AG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐‐> REM: PRE
APRE=1/(1+EXP(AG1)+EXP(AG2))
Appendix 3
136
;======== Inverse‐Logit in order to calculate the transition probability from NREM state to ========
; ‐‐‐‐‐‐‐‐‐‐‐‐> AWAKE: PAW
NPAW=EXP(NG1)/(1+EXP(NG1)+EXP(NG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> NREM: PNR
NPNR=EXP(NG2)/(1+EXP(NG1)+EXP(NG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> REM: PRE
NPRE=1/(1+EXP(NG1)+EXP(NG2))
;========== Inverse‐Logit in order to calculate the transition probability from REM state to =========
; ‐‐‐‐‐‐‐‐‐‐‐‐> AWAKE: PAW
RPAW=EXP(RG1)/(1+EXP(RG1)+EXP(RG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> NREM: PNR
RPNR=EXP(RG2)/(1+EXP(RG1)+EXP(RG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> REM: PRE
RPRE=1/(1+EXP(RG1)+EXP(RG2))
;============================== LIMITES OF DISCRETIZATION ============================
;================= From AWAKE at limit_AWtoAW(1) will be used for the hour 1 ================
AL1=APAW;
AL2=APAW+APNR;
;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ NOTE: AWAKEtoAWAKE+AWAKEtoNR+AWAKEtoRE=1 ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
; From NREM
NL1=NPAW;
NL2=NPAW+NPNR;
; From NREM.
RL1=RPAW;
RL2=RPAW+RPNR;
;================================= SIMULATION BLOCK =================================
IF (ICALL.EQ.4) THEN ; Beginning of the simulation
CALL RANDOM (2,R) ; Rand number in[0,1[
IF (PDV.EQ.1) THEN
IF (R.LT.AL1) THEN
DV=1
ELSEIF (R.LT.AL2) THEN
DV=2
ELSE
DV=3
ENDIF
ELSEIF (PDV.EQ.2) THEN
IF (R.LT.NL1) THEN
DV=1
Appendix 3
137
ELSEIF (R.LT.NL2) THEN
DV=2
ELSE
DV=3
ENDIF
ELSEIF (PDV.EQ.3) THEN
IF (R.LT.RL1) THEN
DV=1
ELSEIF (R.LT.RL2) THEN
DV=2
ELSE
DV=3
ENDIF
ENDIF
ENDIF
PSDV=DV
NSIM=IREP
$THETA 15.5 ; B1
$THETA 0.00242 ; KON
$THETA 0.00251 ; KRE
$OMEGA 0.384 0.425 0.282 0.363 0.186 0.290 0.825 0.249 0.352 0.150 0.143 ; From AWAKE
$OMEGA 0.3 0.107 0.191 0.182 0.391 ; From NREM
$OMEGA 0.107 0.183 0.541 0.438 0.263 0.391 6.10 1.36 1.17 2.17 0.25 ; From REM
$SIMULATION (55555) SUBPROBLEMS=200 (678910 UNIFORM) ONLYSIM NOPRED
$TABLE NSIM ID EPOC DV PDV PSDV APAW APNR APRE NPAW NPNR NPRE RPAW RPNR RPRE
NOHEADER NOAPPEND NOPRINT FILE=SIM_DAY2Placebo
Appendix 4
138
APPENDIX 4
DRUG EFFECT MODEL
‐ FROM NREM
;$SIZES LTH=40 LVR=30 NO=5000 LNP4=2000 MAXIDS=20000 LIM1=5000 LIM2=5000 LIM3=200 LIM4=50
LIM5=200 LIM6=5000 ; This option is only for implemented in Nonmem 7.2
;========================================================================================
; Description: Nonmem model script for sub‐model P(NREM | AWAKE) DAY TWO
;========================================================================================
$PROB Transitions from NREM Zolpidem Effect
$INPUT ID DV=STT EPOC=TIME AWPV NRPV REPV AWK NREM REM DOSE CP
;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ INFORMATION ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
; 1 EPOCH = 10 SEC
; Thus 12 hours= 4320 Epochs
; Hour 4 starts at epoch 1440
; Hour 16 (4+12) finish epoch 5760
;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ STAGE AWAKE=1, NREM=2, REM=3‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ ; AWPV (Column)
; AWPV= 1 If previous observation (epoch‐1) is awake
; AWPV= 0 Otherwise
; AWK, NREM & REM (Columns)
; AWK = 1 If the state at the epoch is AWAKE
; AWK = 0 Otherwise
; NREM= 1 If the state at the epoch is NREM
; NREM= 0 Otherwise
; REM = 1 If the state at the epoch is REM
; REM = 0 Otherwise
$DATA data_NRPDV_Day2FarmacoCP.csv
; Dataset contains only observations immediately preceded by NREM state
$SUBS ADVAN6 TOL=5
$MODEL
COMP(REC) ;Receptor
COMP(FDB) ;Feedback
Appendix 4
139
$PK
;========================= Parameters, Variables & Initial Conditions =========================
KREI=THETA(1)
KFBI=THETA(2)
E1=THETA(3)
KCP=THETA(4)
CPEF=KCP/(KCP+CP)
REC0=1
FDB0=1
KREO=KREI*FDB0/REC0 ;KREO=KREI since REC0=FDB0=1
KFBO=KFBI*REC0/FDB0 ;KFBO=KFBI since REC0=FDB0=1
A_0(1)=1
A_0(2)=1
;======================================== MODEL =======================================
$DES
DADT(1)=A(2)*KREI*CPEF‐KREO*A(1)
DADT(2)=KFBI*(1/A(1))‐KFBO*A(2)
$ERROR (OBSERVATION ONLY)
;==================================== BREAKPOINTS =====================================
BP1=10080
BP2=BP1+360
BP3=BP2+360
BP4=BP3+360
BP5=BP4+360
BP6=BP5+360
BP7=BP6+360
BP8=BP7+360
BP9=BP8+360
BP10=BP9+360
BP11=BP10+360
BP12=BP11+360
REC= A(1)
FDB= A(2)
EFFZ=A(1)**E1
B1=THETA(5)
KON1=THETA(6)
KRE1=THETA(7)
MET1=0
IF (EPOC.GE.BP3) THEN
MET1=‐B1*(EXP(‐KON1*(EPOC‐BP3))‐EXP(‐KRE1*(EPOC‐BP3)))
ENDIF
EFFM=1+MET1
Appendix 4
140
;============================= Logit NG1 (NREMAWAKE) =============================== NG11=(EFFZ*EFFM)*(1.75)
NG12=(EFFZ*EFFM)*(3.34+ETA(1))
NG13=(EFFZ*EFFM)*(2.19+ETA(2))
NG14=(EFFZ*EFFM)*(2.05+ETA(3))
NG15=(EFFZ*EFFM)*(2.23+ETA(4))
NG16=(EFFZ*EFFM)*(1.84+ETA(5))
NG17=(EFFZ*EFFM)*(2.05+ETA(6))
NG18=(EFFZ*EFFM)*(4.06+ETA(7))
NG19=(EFFZ*EFFM)*(2.86+ETA(8))
NG110=(EFFZ*EFFM)*(0.974+ETA(9))
NG111=(EFFZ*EFFM)*(1.10)
NG112=(EFFZ*EFFM)*(1.25+ETA(10))
;=============================== Logit NG2 (NREMNREM) =============================== NG21=(3.51)
NG22=(4.37)
NG23=(3.71)
NG24=(3.47)
NG25=(3.74)
NG26=(3.26)
NG27=(3.56)
NG28=(4.91)
NG29=(4.51)
NG210=(3.69)
NG211=(3.39)
NG212=(3.02)
;================ Individual Value of the Logits at the specific observation EPOC ================
NG1=NG11
NG2=NG21
;= Linear Regression of Logits at a specific observation EPOC between the two adjacent Break‐Points =
IF (EPOC.GT.BP1.AND.EPOC.LE.BP2) THEN
NG1=NG11*(BP2‐EPOC)/(BP2‐BP1)+NG12*(EPOC‐BP1)/(BP2‐BP1)
NG2=NG21*(BP2‐EPOC)/(BP2‐BP1)+NG22*(EPOC‐BP1)/(BP2‐BP1)
ENDIF
IF (EPOC.GT.BP2.AND.EPOC.LE.BP3) THEN
NG1=NG12*(BP3‐EPOC)/(BP3‐BP2)+NG13*(EPOC‐BP2)/(BP3‐BP2)
NG2=NG22*(BP3‐EPOC)/(BP3‐BP2)+NG23*(EPOC‐BP2)/(BP3‐BP2)
ENDIF
IF (EPOC.GT.BP3.AND.EPOC.LE.BP4) THEN
NG1=NG13*(BP4‐EPOC)/(BP4‐BP3)+NG14*(EPOC‐BP3)/(BP4‐BP3)
NG2=NG23*(BP4‐EPOC)/(BP4‐BP3)+NG24*(EPOC‐BP3)/(BP4‐BP3)
ENDIF
Appendix 4
141
IF (EPOC.GT.BP4.AND.EPOC.LE.BP5) THEN
NG1=NG14*(BP5‐EPOC)/(BP5‐BP4)+NG15*(EPOC‐BP4)/(BP5‐BP4)
NG2=NG24*(BP5‐EPOC)/(BP5‐BP4)+NG25*(EPOC‐BP4)/(BP5‐BP4)
ENDIF
IF (EPOC.GT.BP5.AND.EPOC.LE.BP6) THEN
NG1=NG15*(BP6‐EPOC)/(BP6‐BP5)+NG16*(EPOC‐BP5)/(BP6‐BP5)
NG2=NG25*(BP6‐EPOC)/(BP6‐BP5)+NG26*(EPOC‐BP5)/(BP6‐BP5)
ENDIF
IF (EPOC.GT.BP6.AND.EPOC.LE.BP7) THEN
NG1=NG16*(BP7‐EPOC)/(BP7‐BP6)+NG17*(EPOC‐BP6)/(BP7‐BP6)
NG2=NG26*(BP7‐EPOC)/(BP7‐BP6)+NG27*(EPOC‐BP6)/(BP7‐BP6)
ENDIF
IF (EPOC.GT.BP7.AND.EPOC.LE.BP8) THEN
NG1=NG17*(BP8‐EPOC)/(BP8‐BP7)+NG18*(EPOC‐BP7)/(BP8‐BP7)
NG2=NG27*(BP8‐EPOC)/(BP8‐BP7)+NG28*(EPOC‐BP7)/(BP8‐BP7)
ENDIF
IF (EPOC.GT.BP8.AND.EPOC.LE.BP9) THEN
NG1=NG18*(BP9‐EPOC)/(BP9‐BP8)+NG19*(EPOC‐BP8)/(BP9‐BP8)
NG2=NG28*(BP9‐EPOC)/(BP9‐BP8)+NG29*(EPOC‐BP8)/(BP9‐BP8)
ENDIF
IF (EPOC.GT.BP9.AND.EPOC.LE.BP10) THEN
NG1=NG19*(BP10‐EPOC)/(BP10‐BP9)+NG110*(EPOC‐BP9)/(BP10‐BP9)
NG2=NG29*(BP10‐EPOC)/(BP10‐BP9)+NG210*(EPOC‐BP9)/(BP10‐BP9)
ENDIF
IF (EPOC.GT.BP10.AND.EPOC.LE.BP11) THEN
NG1=NG110*(BP11‐EPOC)/(BP11‐BP10)+NG111*(EPOC‐BP10)/(BP11‐BP10)
NG2=NG210*(BP11‐EPOC)/(BP11‐BP10)+NG211*(EPOC‐BP10)/(BP11‐BP10)
ENDIF
IF (EPOC.GT.BP11.AND.EPOC.LE.BP12) THEN
NG1=NG111*(BP12‐EPOC)/(BP12‐BP11)+NG112*(EPOC‐BP11)/(BP12‐BP11)
NG2=NG211*(BP12‐EPOC)/(BP12‐BP11)+NG212*(EPOC‐BP11)/(BP12‐BP11)
ENDIF
;========= Inverse‐Logit in order to calculate de Transition Probability from NREM state to ========
; ‐‐‐‐‐‐‐‐‐‐‐‐> AWAKE: PAW
NPAW=EXP(NG1)/(1+EXP(NG1)+EXP(NG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> NREM: PNR
NPNR=EXP(NG2)/(1+EXP(NG1)+EXP(NG2))
Appendix 4
142
; ‐‐‐‐‐‐‐‐‐‐‐‐> REM: PRE
NPRE=1/(1+EXP(NG1)+EXP(NG2))
; Likelihood
; Names in data file AWK NREM REM
Y=NPAW*AWK+NPNR*NREM+NPRE*REM
$THETA (0,0.00442,0.01) ;KREI
$THETA (0,0.0001,0.005) ;KFBI
$THETA 0.1 ;E1
$THETA (0,0.508) ;KCP
$THETA 14.1 ;B1
$THETA (0,0.00241) ;KON1
$THETA (0,0.00250) ;KRE1
$OMEGA 0.258 FIX
$OMEGA 0.397 FIX
$OMEGA 0.317 FIX
$OMEGA 0.557 FIX
$OMEGA 0.235 FIX
$OMEGA 0.374 FIX
$OMEGA 0.301 FIX
$OMEGA 0.288 FIX
$OMEGA 0.270 FIX
$OMEGA 0.279 FIX ;From NREM
$ESTIMATION MAXEVAL=9999 NUMERICAL METHOD=COND LAPLACE LIKE CENTERING PRINT=2
MSFO=msfocp
$COVARIANCE MATRIX=R PRINT=E
$TABLE ID EPOC NPAW NPNR NPRE EFFZ EFFM REC FDB DOSE ONEHEADER NOPRINT
FILE=sdtabNRPV_DAY2FarmacoCP
Appendix 4
143
SIMULATION OF DRUG EFFECT MODEL
;$SIZES LTH=70 LVR=70 NO=5000 LNP4=2000 MAXIDS=20000 LIM1=5000 LIM2=5000 LIM3=200
LIM4=50 LIM5=200 LIM6=5000 ; This option is only for implemented in Nonmem 7.2
;========================================================================================
; Description: SIMULATION ZOLPIDEM DAY TWO
;========================================================================================
$PROB Simulation Drug
$INPUT ID DV EPOC=TIME CP
;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ INFORMATION ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
; 1 EPOCH = 10 SEC
; Thus 12 hours= 4320 Epochs
; Hour 28 starts at epoch 10080
; Hour 40 (28+12) finish epoch 14400
$DATA Sim_Day2CP.csv
$SUBS ADVAN6 TOL=5
$MODEL
COMP(REC) ;Receptor
COMP(FDB) ;Feedback
$PK
;========================= Parameters, Variables & Initial Conditions ========================
KREI=THETA(1)
KFBI=THETA(2)
E1=THETA(3)
KCP=THETA(4)
CPEF=KCP/(KCP+CP)
REC0=1
FDB0=1
KREO=KREI*FDB0/REC0 ;KREO=KREI since REC0=FDB0=1
KFBO=KFBI*REC0/FDB0 ;KFBO=KFBI since REC0=FDB0=1
A_0(1)=1
A_0(2)=1
;===================================== MODEL ==========================================
$DES
DADT(1)=A(2)*KREI*CPEF‐KREO*A(1)
DADT(2)=KFBI*(1/A(1))‐KFBO*A(2)
Appendix 4
144
$ERROR (OBSERVATION ONLY)
; ======================== Creation of PDV (Previous Dependent Value) =======================
IF (NEWIND.NE.2) PSDV=1
;Update PDV
PDV=PSDV
REC=A(1)
FDB=A(2)
EFF1=A(1)**E1
EFF2=1
;==================================== BREAKPOINTS =====================================
BP1=10080
BP2=BP1+360
BP3=BP2+360
BP4=BP3+360
BP5=BP4+360
BP6=BP5+360
BP7=BP6+360
BP8=BP7+360
BP9=BP8+360
BP10=BP9+360
BP11=BP10+360
BP12=BP11+360‐1
;======================== Logit AG1 (AWAKEAWAKE); +ETA(1) =========================== AG11=4.58
AG12=5.68+ETA(1)
AG13=4.87+ETA(2)
AG14=5.20+ETA(3)
AG15=4.94+ETA(4)
AG16=4.74+ETA(5)
AG17=4.96+ETA(6)
AG18=6.34+ETA(7)
AG19=5.43+ETA(8)
AG110=2.47
AG111=3.29
AG112=4.04+ETA(9)
;========================= Logit AG2 (AWAKENREM); +ETA(1) =========================== AG21=2.67+ETA(10)
AG22=2.93
AG23=3.31
AG24=2.81
AG25=3.05+ETA(11)
AG26=2.83
AG27=2.94+ETA(12)
AG28=3.99
Appendix 4
145
AG29=2.90
AG210=2.18
AG211=2.33
AG212=2.20+ETA(13)
;======================== Logit NG1 (NREMAWAKE); +ETA(1) ============================ NG11=EFF1*(1.75)
NG12=EFF1*(3.34+ETA(14))
NG13=EFF1*(2.19+ETA(15))
NG14=EFF1*(2.05+ETA(16))
NG15=EFF1*(2.23+ETA(17))
NG16=EFF1*(1.84+ETA(18))
NG17=EFF1*(2.05+ETA(19))
NG18=EFF1*(4.06+ETA(20))
NG19=EFF1*(2.86+ETA(21))
NG110=EFF1*(0.974+ETA(22))
NG111=EFF1*(1.10)
NG112=EFF1*(1.25+ETA(23))
;========================== Logit NG2 (NREMNREM); +ETA(1) ============================ NG21=EFF2*(3.51)
NG22=EFF2*(4.37)
NG23=EFF2*(3.71)
NG24=EFF2*(3.47)
NG25=EFF2*(3.74)
NG26=EFF2*(3.26)
NG27=EFF2*(3.56)
NG28=EFF2*(4.91)
NG29=EFF2*(4.51)
NG210=EFF2*(3.69)
NG211=EFF2*(3.39)
NG212=EFF2*(3.02)
;========================== Logit RG1 (REMAWAKE); +ETA(1) ============================ RG11=‐1.46
RG12=‐0.973
RG13=‐1.25
RG14=‐1.04
RG15=‐1.17
RG16=‐1.27
RG17=‐0.821
RG18=‐1.01
RG19=‐0.899
RG110=‐1.57+ETA(24)
RG111=‐1.28
RG112=‐1.14
;=========================== Logit RG2 (REMNREM); +ETA(1) ============================= RG21=‐3.09+ETA(25)
RG22=‐2.87+ETA(26)
Appendix 4
146
RG23=‐3.63
RG24=‐3.29
RG25=‐3.43
RG26=‐2.86
RG27=‐3.56+ETA(27)
RG28=‐2.29+ETA(28)
RG29=‐3.97
RG210=‐2.86
RG211=‐2.92+ETA(29)
RG212=‐3+ETA(30)
;================= Individual Value of the Logits at the specific observation EPOC ===============
AG1=AG11
AG2=AG21
NG1=NG11
NG2=NG21
RG1=RG11
RG2=RG21
;= Linear Regression of Logits at a specific observation EPOC between the two adjacent Break‐Points =
IF (EPOC.GT.BP1.AND.EPOC.LE.BP2) THEN
AG1=AG11*(BP2‐EPOC)/(BP2‐BP1)+AG12*(EPOC‐BP1)/(BP2‐BP1)
AG2=AG21*(BP2‐EPOC)/(BP2‐BP1)+AG22*(EPOC‐BP1)/(BP2‐BP1)
ENDIF
IF (EPOC.GT.BP2.AND.EPOC.LE.BP3) THEN
AG1=AG12*(BP3‐EPOC)/(BP3‐BP2)+AG13*(EPOC‐BP2)/(BP3‐BP2)
AG2=AG22*(BP3‐EPOC)/(BP3‐BP2)+AG23*(EPOC‐BP2)/(BP3‐BP2)
ENDIF
IF (EPOC.GT.BP3.AND.EPOC.LE.BP4) THEN
AG1=AG13*(BP4‐EPOC)/(BP4‐BP3)+AG14*(EPOC‐BP3)/(BP4‐BP3)
AG2=AG23*(BP4‐EPOC)/(BP4‐BP3)+AG24*(EPOC‐BP3)/(BP4‐BP3)
ENDIF
IF (EPOC.GT.BP4.AND.EPOC.LE.BP5) THEN
AG1=AG14*(BP5‐EPOC)/(BP5‐BP4)+AG15*(EPOC‐BP4)/(BP5‐BP4)
AG2=AG24*(BP5‐EPOC)/(BP5‐BP4)+AG25*(EPOC‐BP4)/(BP5‐BP4)
ENDIF
IF (EPOC.GT.BP5.AND.EPOC.LE.BP6) THEN
AG1=AG15*(BP6‐EPOC)/(BP6‐BP5)+AG16*(EPOC‐BP5)/(BP6‐BP5)
AG2=AG25*(BP6‐EPOC)/(BP6‐BP5)+AG26*(EPOC‐BP5)/(BP6‐BP5)
ENDIF
Appendix 4
147
IF (EPOC.GT.BP6.AND.EPOC.LE.BP7) THEN
AG1=AG16*(BP7‐EPOC)/(BP7‐BP6)+AG17*(EPOC‐BP6)/(BP7‐BP6)
AG2=AG26*(BP7‐EPOC)/(BP7‐BP6)+AG27*(EPOC‐BP6)/(BP7‐BP6)
ENDIF
IF (EPOC.GT.BP7.AND.EPOC.LE.BP8) THEN
AG1=AG17*(BP8‐EPOC)/(BP8‐BP7)+AG18*(EPOC‐BP7)/(BP8‐BP7)
AG2=AG27*(BP8‐EPOC)/(BP8‐BP7)+AG28*(EPOC‐BP7)/(BP8‐BP7)
ENDIF
IF (EPOC.GT.BP8.AND.EPOC.LE.BP9) THEN
AG1=AG18*(BP9‐EPOC)/(BP9‐BP8)+AG19*(EPOC‐BP8)/(BP9‐BP8)
AG2=AG28*(BP9‐EPOC)/(BP9‐BP8)+AG29*(EPOC‐BP8)/(BP9‐BP8)
ENDIF
IF (EPOC.GT.BP9.AND.EPOC.LE.BP10) THEN
AG1=AG19*(BP10‐EPOC)/(BP10‐BP9)+AG110*(EPOC‐BP9)/(BP10‐BP9)
AG2=AG29*(BP10‐EPOC)/(BP10‐BP9)+AG210*(EPOC‐BP9)/(BP10‐BP9)
ENDIF
IF (EPOC.GT.BP10.AND.EPOC.LE.BP11) THEN
AG1=AG110*(BP11‐EPOC)/(BP11‐BP10)+AG111*(EPOC‐BP10)/(BP11‐BP10)
AG2=AG210*(BP11‐EPOC)/(BP11‐BP10)+AG211*(EPOC‐BP10)/(BP11‐BP10)
ENDIF
IF (EPOC.GT.BP11.AND.EPOC.LE.BP12) THEN
AG1=AG111*(BP12‐EPOC)/(BP12‐BP11)+AG112*(EPOC‐BP11)/(BP12‐BP11)
AG2=AG211*(BP12‐EPOC)/(BP12‐BP11)+AG212*(EPOC‐BP11)/(BP12‐BP11)
ENDIF
;= Linear Regression of Logits at a specific observation EPOC between the two adjacent Break‐Points =
IF (EPOC.GT.BP1.AND.EPOC.LE.BP2) THEN
NG1=NG11*(BP2‐EPOC)/(BP2‐BP1)+NG12*(EPOC‐BP1)/(BP2‐BP1)
NG2=NG21*(BP2‐EPOC)/(BP2‐BP1)+NG22*(EPOC‐BP1)/(BP2‐BP1)
ENDIF
IF (EPOC.GT.BP2.AND.EPOC.LE.BP3) THEN
NG1=NG12*(BP3‐EPOC)/(BP3‐BP2)+NG13*(EPOC‐BP2)/(BP3‐BP2)
NG2=NG22*(BP3‐EPOC)/(BP3‐BP2)+NG23*(EPOC‐BP2)/(BP3‐BP2)
ENDIF
IF (EPOC.GT.BP3.AND.EPOC.LE.BP4) THEN
NG1=NG13*(BP4‐EPOC)/(BP4‐BP3)+NG14*(EPOC‐BP3)/(BP4‐BP3)
NG2=NG23*(BP4‐EPOC)/(BP4‐BP3)+NG24*(EPOC‐BP3)/(BP4‐BP3)
ENDIF
Appendix 4
148
IF (EPOC.GT.BP4.AND.EPOC.LE.BP5) THEN
NG1=NG14*(BP5‐EPOC)/(BP5‐BP4)+NG15*(EPOC‐BP4)/(BP5‐BP4)
NG2=NG24*(BP5‐EPOC)/(BP5‐BP4)+NG25*(EPOC‐BP4)/(BP5‐BP4)
ENDIF
IF (EPOC.GT.BP5.AND.EPOC.LE.BP6) THEN
NG1=NG15*(BP6‐EPOC)/(BP6‐BP5)+NG16*(EPOC‐BP5)/(BP6‐BP5)
NG2=NG25*(BP6‐EPOC)/(BP6‐BP5)+NG26*(EPOC‐BP5)/(BP6‐BP5)
ENDIF
IF (EPOC.GT.BP6.AND.EPOC.LE.BP7) THEN
NG1=NG16*(BP7‐EPOC)/(BP7‐BP6)+NG17*(EPOC‐BP6)/(BP7‐BP6)
NG2=NG26*(BP7‐EPOC)/(BP7‐BP6)+NG27*(EPOC‐BP6)/(BP7‐BP6)
ENDIF
IF (EPOC.GT.BP7.AND.EPOC.LE.BP8) THEN
NG1=NG17*(BP8‐EPOC)/(BP8‐BP7)+NG18*(EPOC‐BP7)/(BP8‐BP7)
NG2=NG27*(BP8‐EPOC)/(BP8‐BP7)+NG28*(EPOC‐BP7)/(BP8‐BP7)
ENDIF
IF (EPOC.GT.BP8.AND.EPOC.LE.BP9) THEN
NG1=NG18*(BP9‐EPOC)/(BP9‐BP8)+NG19*(EPOC‐BP8)/(BP9‐BP8)
NG2=NG28*(BP9‐EPOC)/(BP9‐BP8)+NG29*(EPOC‐BP8)/(BP9‐BP8)
ENDIF
IF (EPOC.GT.BP9.AND.EPOC.LE.BP10) THEN
NG1=NG19*(BP10‐EPOC)/(BP10‐BP9)+NG110*(EPOC‐BP9)/(BP10‐BP9)
NG2=NG29*(BP10‐EPOC)/(BP10‐BP9)+NG210*(EPOC‐BP9)/(BP10‐BP9)
ENDIF
IF (EPOC.GT.BP10.AND.EPOC.LE.BP11) THEN
NG1=NG110*(BP11‐EPOC)/(BP11‐BP10)+NG111*(EPOC‐BP10)/(BP11‐BP10)
NG2=NG210*(BP11‐EPOC)/(BP11‐BP10)+NG211*(EPOC‐BP10)/(BP11‐BP10)
ENDIF.
IF (EPOC.GT.BP11.AND.EPOC.LE.BP12) THEN
NG1=NG111*(BP12‐EPOC)/(BP12‐BP11)+NG112*(EPOC‐BP11)/(BP12‐BP11)
NG2=NG211*(BP12‐EPOC)/(BP12‐BP11)+NG212*(EPOC‐BP11)/(BP12‐BP11)
ENDIF
;= Linear Regression of Logits at a specific observation EPOC between the two adjacent Break‐Points =
IF (EPOC.GT.BP1.AND.EPOC.LE.BP2) THEN
RG1=RG11*(BP2‐EPOC)/(BP2‐BP1)+RG12*(EPOC‐BP1)/(BP2‐BP1)
RG2=RG21*(BP2‐EPOC)/(BP2‐BP1)+RG22*(EPOC‐BP1)/(BP2‐BP1)
ENDIF
Appendix 4
149
IF (EPOC.GT.BP2.AND.EPOC.LE.BP3) THEN
RG1=RG12*(BP3‐EPOC)/(BP3‐BP2)+RG13*(EPOC‐BP2)/(BP3‐BP2)
RG2=RG22*(BP3‐EPOC)/(BP3‐BP2)+RG23*(EPOC‐BP2)/(BP3‐BP2)
ENDIF
IF (EPOC.GT.BP3.AND.EPOC.LE.BP4) THEN
RG1=RG13*(BP4‐EPOC)/(BP4‐BP3)+RG14*(EPOC‐BP3)/(BP4‐BP3)
RG2=RG23*(BP4‐EPOC)/(BP4‐BP3)+RG24*(EPOC‐BP3)/(BP4‐BP3)
ENDIF
IF (EPOC.GT.BP4.AND.EPOC.LE.BP5) THEN
RG1=RG14*(BP5‐EPOC)/(BP5‐BP4)+RG15*(EPOC‐BP4)/(BP5‐BP4)
RG2=RG24*(BP5‐EPOC)/(BP5‐BP4)+RG25*(EPOC‐BP4)/(BP5‐BP4)
ENDIF
IF (EPOC.GT.BP5.AND.EPOC.LE.BP6) THEN
RG1=RG15*(BP6‐EPOC)/(BP6‐BP5)+RG16*(EPOC‐BP5)/(BP6‐BP5)
RG2=RG25*(BP6‐EPOC)/(BP6‐BP5)+RG26*(EPOC‐BP5)/(BP6‐BP5)
ENDIF
IF (EPOC.GT.BP6.AND.EPOC.LE.BP7) THEN
RG1=RG16*(BP7‐EPOC)/(BP7‐BP6)+RG17*(EPOC‐BP6)/(BP7‐BP6)
RG2=RG26*(BP7‐EPOC)/(BP7‐BP6)+RG27*(EPOC‐BP6)/(BP7‐BP6)
ENDIF
IF (EPOC.GT.BP7.AND.EPOC.LE.BP8) THEN
RG1=RG17*(BP8‐EPOC)/(BP8‐BP7)+RG18*(EPOC‐BP7)/(BP8‐BP7)
RG2=RG27*(BP8‐EPOC)/(BP8‐BP7)+RG28*(EPOC‐BP7)/(BP8‐BP7)
ENDIF
IF (EPOC.GT.BP8.AND.EPOC.LE.BP9) THEN
RG1=RG18*(BP9‐EPOC)/(BP9‐BP8)+RG19*(EPOC‐BP8)/(BP9‐BP8)
RG2=RG28*(BP9‐EPOC)/(BP9‐BP8)+RG29*(EPOC‐BP8)/(BP9‐BP8)
ENDIF
IF (EPOC.GT.BP9.AND.EPOC.LE.BP10) THEN
RG1=RG19*(BP10‐EPOC)/(BP10‐BP9)+RG110*(EPOC‐BP9)/(BP10‐BP9)
RG2=RG29*(BP10‐EPOC)/(BP10‐BP9)+RG210*(EPOC‐BP9)/(BP10‐BP9)
ENDIF
IF (EPOC.GT.BP10.AND.EPOC.LE.BP11) THEN
RG1=RG110*(BP11‐EPOC)/(BP11‐BP10)+RG111*(EPOC‐BP10)/(BP11‐BP10)
RG2=RG210*(BP11‐EPOC)/(BP11‐BP10)+RG211*(EPOC‐BP10)/(BP11‐BP10)
ENDIF
Appendix 4
150
IF (EPOC.GT.BP11.AND.EPOC.LE.BP12) THEN
RG1=RG111*(BP12‐EPOC)/(BP12‐BP11)+RG112*(EPOC‐BP11)/(BP12‐BP11)
RG2=RG211*(BP12‐EPOC)/(BP12‐BP11)+RG212*(EPOC‐BP11)/(BP12‐BP11)
ENDIF
;======== Inverse‐Logit in order to calculate de Transition Probability from AWAKE state to =======
; ‐‐‐‐‐‐‐‐‐‐‐‐> AWAKE: PAW
APAW=EXP(AG1)/(1+EXP(AG1)+EXP(AG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> NREM: PNR
APNR=EXP(AG2)/(1+EXP(AG1)+EXP(AG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> REM: PRE
APRE=1/(1+EXP(AG1)+EXP(AG2))
;======== Inverse‐Logit in order to calculate de Transition Probability from NREM state to ========
; ‐‐‐‐‐‐‐‐‐‐‐‐> AWAKE: PAW
NPAW=EXP(NG1)/(1+EXP(NG1)+EXP(NG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> NREM: PNR
NPNR=EXP(NG2)/(1+EXP(NG1)+EXP(NG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> REM: PRE
NPRE=1/(1+EXP(NG1)+EXP(NG2))
;========= Inverse‐Logit in order to calculate de Transition Probability from REM state to ========
; ‐‐‐‐‐‐‐‐‐‐‐‐> AWAKE: PAW
RPAW=EXP(RG1)/(1+EXP(RG1)+EXP(RG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> NREM: PNR
RPNR=EXP(RG2)/(1+EXP(RG1)+EXP(RG2))
; ‐‐‐‐‐‐‐‐‐‐‐‐> REM: PRE
RPRE=1/(1+EXP(RG1)+EXP(RG2))
;============================== LIMITES OF DISCRETIZATION ============================
;================= From AWAKE at limit_AWtoAW(1) will be used for the hour 1 ================
AL1=APAW;
AL2=APAW+APNR;
;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ NOTE: AWAKEtoAWAKE+AWAKEtoNR+AWAKEtoRE=1 ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
; From NREM
NL1=NPAW;
NL2=NPAW+NPNR;
; From REM.
RL1=RPAW;
RL2=RPAW+RPNR;
;=================================== SIMULATION BLOCK ===============================
IF (ICALL.EQ.4) THEN ; Begining of the simulation
Appendix 4
151
CALL RANDOM (2,R) ; Rand number in[0,1[
IF (PDV.EQ.1) THEN
IF (R.LT.AL1) THEN
DV=1
ELSEIF (R.LT.AL2) THEN
DV=2
ELSE
DV=3
ENDIF
ELSEIF (PDV.EQ.2) THEN
IF (R.LT.NL1) THEN
DV=1
ELSEIF (R.LT.NL2) THEN
DV=2
ELSE
DV=3
ENDIF
ELSEIF (PDV.EQ.3) THEN
IF (R.LT.RL1) THEN
DV=1
ELSEIF (R.LT.RL2) THEN
DV=2
ELSE
DV=3
ENDIF
ENDIF
ENDIF
PSDV=DV
NSIM=IREP
$THETA 0.00436 ;KREI
$THETA 0.000069 ;KFBI
$THETA 0.146 ;E1
$THETA 0.566 ;KCP
Appendix 4
152
$OMEGA 0.287 0.642 1.12 0.512 0.687 0.748 0.315 1.06 3.82 0.225 0.209 0.337 0.791 ;From AWAKE
$OMEGA 0.258 0.397 0.317 0.557 0.235 0.374 0.301 0.288 0.270 0.279 ;From NREM
$OMEGA 0.436 0.378 0.481 0.565 3.15 0.613 1.62 ;From REM
$SIMULATION (55555) SUBPROBLEMS=200 (678910 UNIFORM) ONLYSIM NOPRED
$TABLE NSIM ID EPOC DV PDV PSDV APAW APNR APRE NPAW NPNR NPRE RPAW RPNR RPRE CP
EFF1 NOHEADER NOAPPEND NOPRINT FILE=SIM_DAY2Farmaco2
Appendix 5
153
APPENDIX 5
SCRIPTS: INPUT FILES FOR MATLAB
DESCRIPTORS OF SLEEP
1. PERCENTAGE OF SLEEP STAGES
‐ All groups
%Load data set
%Rename of datasets
Bas_data=Name of dataset; % Baseline Dataset Vec_data=Name of dataset; % Methylcellulose Dataset
Drug1_data=Name of dataset; % Zolpidem 10 mg Dataset
Drug2_data=Name of dataset; % Zolpidem 20 mg Dataset
Drug3_data=Name of dataset; % Zolpidem 30 mg Dataset
%COLUMNS OF DATASET
%STD=ID STT=DV TIME EPOCH AWPV NRPV REPV AWK NREM REM
ListRatsBas=unique(Bas_data(:,1)); % Select the number of the ID for each rats.
ListRatsVec=unique(Vec_data(:,1));
ListRatsDrug1=unique(Drug1_data(:,1));
ListRatsDrug2=unique(Drug2_data(:,1));
ListRatsDrug3=unique(Drug3_data(:,1));
numObs=360; % 60min=3600sec, 360 observations per window.
studyTime=4320; % 12hrs=43200sec, 4320 observations in 12 hours.
for i=1:length(ListRatsBas) % For each rata
% Load rat i
Bas_rat=Bas_data(find(Bas_data(:,1)==ListRatsBas(i)),:);
Vec_rat=Vec_data(find(Vec_data(:,1)==ListRatsVec (i)),:);
Drug1_rat= Drug1_data(find(Drug1_data(:,1)==ListRatsDrug1(i)),:);
Drug2_rat= Drug2_data(find(Drug2_data(:,1)==ListRatsDrug2(i)),:);
Drug3_rat= Drug3_data(find(Drug3_data(:,1)==ListRatsDrug3(i)),:);
k=1; % Initialization k (K identifies the window)
for c=1:numObs:(4320‐numObs) % Load the states of the corresponding window of the animal i.
Appendix 5
154
Bas_windo=Bas_rat(c:(c+360‐1),2); % BASELINE PERIOD Bas_perc1(i,k)=numel(find(Bas_windo==1))*100/numObs; % Percentage of Percentile for AWAKE=1
Bas_perc2(i,k)=numel(find(Bas_windo==2))*100/numObs; % Percentage of Percentile for NREM=2
Bas_perc3(i,k)=numel(find(Bas_windo==3))*100/numObs; % Percentage of Percentile for REM=3
Vec_windo=Vec_rat(c:(c+360‐1),2); % VEHICLE‐METHYLCELLULOSE PERIOD Vec_perc1(i,k)=numel(find(Vec_windo==1))*100/numObs; % Percentage of Percentile for AWAKE=1
Vec_perc2(i,k)=numel(find(Vec_windo==2))*100/numObs; % Percentage of Percentile for NREM=2
Vec _perc3(i,k)=numel(find(Vec_windo==3))*100/numObs; % Percentage of Percentile for REM=3
Drug1_windo= Drug1_rat(c:(c+360‐1),2); % DRUG 1 PERIOD Drug1_perc1(i,k)=numel(find(Drug1_windo==1))*100/numObs;
% Percentage of Percentile for AWAKE=1
Drug1_perc2(i,k)=numel(find(Drug1_windo==2))*100/numObs;
% Percentage of Percentile for NREM=2
Drug1_perc3(i,k)=numel(find(Drug1_windo==3))*100/numObs;
% Percentage of Percentile for REM=3
Drug2_windo= Drug2_rat(c:(c+360‐1),2); % DRUG2 PERIOD Drug2_perc1(i,k)=numel(find(Drug2_windo==1))*100/numObs;
% Percentage of Percentile for AWAKE=1
Drug2_perc2(i,k)=numel(find(Drug2_windo==2))*100/numObs;
% Percentage of Percentile for NREM=2
Drug2_perc3(i,k)=numel(find(Drug2_windo==3))*100/numObs;
% Percentage of Percentile for REM=3
Drug3_windo= Drug3_rat(c:(c+360‐1),2); % DRUG3 PERIOD Drug3_perc1(i,k)=numel(find(Drug3_windo==1))*100/numObs;
% Percentage of Percentile for AWAKE=1
Drug3_perc2(i,k)=numel(find(Drug3_windo==2))*100/numObs;
% Percentage of Percentile for NREM=2
Drug3_perc3(i,k)=numel(find(Drug3_windo==3))*100/numObs;
% Percentage of Percentile for REM=3
k=k+1;
end
end
Bas_mean1=mean(Bas_perc1); % Calculated the mean
Bas_mean2=mean(Bas_perc2);
Bas_mean3=mean(Bas_perc3);
Vec_mean1=mean(Vec_perc1);
Vec_mean2=mean(Vec_perc2);
Vec_mean3=mean(Vec_perc3);
Appendix 5
155
Drug1_mean1=mean(Drug1_perc1);
Drug1_mean2=mean(Drug1_perc2);
Drug1_mean3=mean(Drug3_perc3);
Drug2_mean1=mean(Drug2_perc1);
Drug2_mean2=mean(Drug2_perc2);
Drug2_mean3=mean(Drug2_perc3);
Drug3_mean1=mean(Drug3_perc1);
Drug3_mean2=mean(Drug3_perc2);
Drug3_mean3=mean(Drug3_perc3);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PLOTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Xaxis=[4:16] Axis % plot x,y,ʹLineWidthʹ,2 Line sizes number 2
%ʹ‐‐ʹ Dashed line % ʹColorʹ,[0 0.60 0] Color Codices
subplot(1,3,1) % 1 indicated the number of row, 3 indicated the
number of columns and 1 indicated the position of plot.
Xaxis=[4:16];
ylim([0,100]) % Limited of Y axis
xlim([4,15]) % Limited of X axis
plot(Xaxis,Bas_mean1,ʹ‐kʹ,ʹLineWidthʹ,2)
hold on % Plot mean of Baseline for AWAKE.
plot(Xaxis,Vec_mean1,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
hold on % Plot mean of Methylcellulose for AWAKE.
plot(Xaxis,Drug1_mean1,ʹ‐‐ʹ,ʹColorʹ,[1 0.800000011920929 0.800000011920929], ʹLineWidthʹ,2)
hold on % Plot mean of Zolpidem(10 mg) for AWAKE.
plot(Xaxis,Drug2_mean1,ʹ‐‐ʹ,ʹColorʹ,[0.400000005960464 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Zolpidem(20 mg) for AWAKE.
plot(Xaxis,Drug3_mean1,ʹ‐‐ʹ,ʹColorʹ,[1 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Zolpidem(30 mg) for AWAKE.
plot(Xaxis,Bas_perc1,ʹokʹ,ʹMarkerFaceColorʹ,ʹkʹ,ʹMarkerSizeʹ,2)
hold on % Plot percentile of Baseline for AWAKE.
plot(Xaxis,Vec_perc1,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 1],ʹMarkerSizeʹ,2)
% Plot percentile of Methylcellulose for AWAKE.
Appendix 5
156
plot(Xaxis,Drug1_perc1,ʹokʹ,ʹMarkerFaceColorʹ,[1 0.800000011920929 0.800000011920929] ,ʹMarkerSizeʹ ,2)
hold on % Plot percentile of Zolpidem(10 mg) for AWAKE.
plot(Xaxis,Drug2_perc1,ʹokʹ,ʹMarkerFaceColorʹ, [0.400000005960464 0 0],ʹMarkerSizeʹ,2)
hold on % Plot percentile of Zolpidem (20 mg) for AWAKE.
plot(Xaxis,Drug3_perc1,ʹokʹ,ʹMarkerFaceColorʹ, [1 0 0],ʹMarkerSizeʹ,2)
hold on % Plot percentile of Zolpidem (30 mg) for AWAKE.
subplot(1,3,2) % Second plot, position 2. ylim([0,100])
xlim([4,16])
plot(Xaxis,Bas_mean2,ʹ‐kʹ,ʹLineWidthʹ,2)
hold on % Plot mean of Baseline for NREM.
plot(Xaxis,Vec_mean2,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
hold on % Plot mean of Methylcellulose for NREM.
plot(Xaxis,Drug1_mean2,ʹ‐‐ʹ,ʹColorʹ,[1 0.800000011920929 0.800000011920929],ʹLineWidthʹ,2)
hold on % Plot mean of Drug1 for NREM.
plot(Xaxis,Drug2_mean2,ʹ‐‐ʹ,ʹColorʹ, [0.400000005960464 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug2 for NREM.
plot(Xaxis,Drug3_mean2,ʹ‐‐ʹ,ʹColorʹ, [1 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug3 for NREM.
plot(Xaxis,Bas_perc2,ʹokʹ,ʹMarkerFaceColorʹ,ʹkʹ,ʹMarkerSizeʹ,2)
hold on % Plot percentile of Baseline for NREM.
plot(Xaxis,Vec_perc2,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 1],ʹMarkerSizeʹ,2)
hold on % Plot percentile of Methylcellulose for NREM.
plot(Xaxis,Drug1_perc2,ʹokʹ,ʹMarkerFaceColorʹ,[1 0.800000011920929 0.800000011920929] ,ʹMarkerSizeʹ,2)
hold on % Plot percentile of Zolpidem(10 mg) for NREM.
plot(Xaxis,Drug2_perc2,ʹokʹ,ʹMarkerFaceColorʹ,[0.400000005960464 0 0],ʹMarkerSizeʹ,2)
hold on % Plot percentile of Zolpidem(20 mg) for NREM.
plot(Xaxis,Drug3_perc2,ʹokʹ,ʹMarkerFaceColorʹ,[1 0 0],ʹMarkerSizeʹ,2)
hold on % Plot percentile of Zolpidem(30 mg) for NREM.
Xlabel(ʹCircadian Timeʹ) % Label in X axis.
Appendix 5
157
subplot(1,3,3) % Third plot, position 3. ylim([0,100])
xlim([4,16])
plot(Xaxis,Bas_mean3,ʹ‐kʹ,ʹLineWidthʹ,2) % Plot mean of Baseline for REM.
hold on
plot(Xaxis,Vec_mean3,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
hold on % Plot mean of Methylcellulose for REM.
plot(Xaxis,Drug1_mean3,ʹ‐‐ʹ,ʹColorʹ,[1 0.800000011920929 0.800000011920929],ʹLineWidthʹ,2)
hold on % Plot mean of Zolpidem (10 mg) for REM.
plot(Xaxis,Drug2_mean3,ʹ‐‐ʹ,ʹColorʹ,[0.400000005960464 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Zolpidem (20 mg) for REM.
plot(Xaxis,Drug3_mean3,ʹ‐‐ʹ,ʹColorʹ,[1 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Zolpidem (30 mg) for REM.
plot(Xaxis,Bas_perc3,ʹokʹ,ʹMarkerFaceColorʹ,ʹkʹ,ʹMarkerSizeʹ,2)
hold on % Plot percentile of Baseline for REM.
plot(Xaxis,Vec_perc3,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 1],ʹMarkerSizeʹ,2)
hold on % Plot percentile of Methylcellulose for REM.
plot(Xaxis,Drug1_perc3,ʹokʹ,ʹMarkerFaceColorʹ,[1 0.800000011920929 0.800000011920929] ,ʹMarkerSizeʹ,2)
hold on % Plot percentile of Zolpidem(10 mg) for REM.
plot(Xaxis,Drug2_perc3,ʹokʹ,ʹMarkerFaceColorʹ,[0.400000005960464 0 0],ʹMarkerSizeʹ,2)
hold on % Plot percentile of Zolpidem(20 mg) REM.
plot(Xaxis,Drug3_perc3,ʹokʹ,ʹMarkerFaceColorʹ,[1 0 0],ʹMarkerSizeʹ,2)
% Plot percentile of Zolpidem(30 mg) REM.
Appendix 5
158
DESCRIPTORS OF SLEEP
2. TRANSITIONS PROBABILITIES
2.1. From AWAKE
‐ All groups
%Load data set
%Rename of datasets
Bas_data=Name of dataset; % Baseline Dataset Vec_data=Name of dataset; % Vehicle‐Methylcellulose Dataset
Drug1_data= Name of dataset; % Zolpidem(10 mg) Dataset
Drug2_data= Name of dataset; % Zolpidem(20 mg) Dataset
Drug3_data= Name of dataset; % Zolpidem(30 mg) Dataset
%COLUMNS OF DATASET
%STD=ID STT=DV TIME EPOCH AWPV NRPV REPV AWK NREM REM
ListRatsBas=unique(Bas_data(:,1)); % Select the number of the ID for each rats.
ListRatsVec=unique(Vec_data(:,1));
ListRatsDrug1=unique(Drug1_data(:,1));
ListRatsDrug2=unique(Drug2_data(:,1));
ListRatsDrug3=unique(Drug3_data(:,1));
numObs=360; % 60min=3600sec, 360 observations per window.
studyTime=4320; % 12hrs=43200sec, 4320 observations in 12 hours.
%%%Initialization of Baseline Bas_numelAWtoAW=zeros(length(ListRatsBas),4320/numObs);
Bas_numelAWtoNR=zeros(length(ListRatsBas), 4320/numObs);
Bas_numelAWtoRE=zeros(length(ListRatsBas), 4320/numObs);
%%%Initialization of Vehicle‐Methylcellulose Vec_numelAWtoAW=zeros(length(ListRatsVec), 4320/numObs);
Vec_numelAWtoNR=zeros(length(ListRatsVec), 4320/numObs);
Vec_numelAWtoRE=zeros(length(ListRatsVec), 4320/numObs);
%%%Initialization of Drug 1 Drug1_numelAWtoAW=zeros(length(ListRatsDrug1),4320/numObs);
Drug1_numelAWtoNR=zeros(length(ListRatsDrug1), 4320/numObs);
Drug1_numelAWtoRE=zeros(length(ListRatsDrug1), 4320/numObs);
Appendix 5
159
%%%Initialization of Drug 2 Drug2_numelAWtoAW=zeros(length(ListRatsDrug2),4320/numObs);
Drug2_numelAWtoNR=zeros(length(ListRatsDrug2), 4320/numObs);
Drug2_numelAWtoRE=zeros(length(ListRatsDrug2), 4320/numObs);
%%%Initialization of Drug 3 Drug3_numelAWtoAW=zeros(length(ListRatsDrug3),4320/numObs);
Drug3_numelAWtoNR=zeros(length(ListRatsDrug3), 4320/numObs);
Drug3_numelAWtoRE=zeros(length(ListRatsDrug3), 4320/numObs);
% Transitions probabilities
for i=1:length(listRatsBas) % For each rata
% Load rat i
Bas_rat=Bas_data(find(Bas_data(:,1)== ListRatsBas(i)),:);
Vec_rat=Vec_data(find(Vec_data(:,1)== ListRatsVec(i)),:);
Drug1_rat=Drug1_data(find(Drug1_data(:,1)== ListRatsDrug1(i)),:);
Drug2_rat=Drug2_data(find(Drug2_data(:,1)== ListRatsDrug2(i)),:);
Drug3_rat=Drug3_data(find(Drug3_data(:,1)== ListRatsDrug3(i)),:);
k=1; % Initialization k (K identifies the window)
for c=1:numObs:(4320‐numObs+1)
% If the window have 360 observations4320/360=12 window
% Calculation of Nº of transitions for all groups
Bas_windo=Bas_rat(c:(c+360‐1),2);
Vec_windo=Vec_rat(c:(c+360‐1),2);
Drug1_windo=Drug1_rat(c:(c+360‐1),2);
Drug2_windo=Drug2_rat(c:(c+360‐1),2);
Drug3_windo=Drug3_rat(c:(c+360‐1),2);
Bas_numelAWAKE=numel(find(Bas_windo==1)); % All observations of AWAKE
Vec_numelAWAKE=numel(find(Vec_windo==1)); % All observations of AWAKE
Drug1_numelAWAKE=numel(find(Drug1_windo==1));
Drug2_numelAWAKE=numel(find(Drug2_windo==1));
Drug2_numelAWAKE=numel(find(Drug2_windo==1));
for j=1:numObs‐1
if Bas_windo(j)==1
if Bas_windo(j+1)==1
Bas_numelAWtoAW(i,k)=nansum([Bas_numelAWtoAW(i,k) 1],2);
elseif Bas_windo(j+1)==2
Appendix 5
160
Bas_numelAWtoNR(i,k)=nansum([Bas_numelAWtoNR(i,k) 1],2);
elseif Bas_windo(j+1)==3
Bas_numelAWtoRE(i,k)= nansum([Bas_numelAWtoRE(i,k) 1],2);
end
end
if Vec_windo(j)==1
if Vec_windo(j+1)==1
Vec_numelAWtoAW(i,k)=nansum([Vec_numelAWtoAW(i,k) 1],2);
elseif Vec_windo(j+1)==2
Vec_numelAWtoNR(i,k)=nansum([Vec_numelAWtoNR(i,k) 1],2);
elseif Vec_windo(j+1)==3
Vec_numelAWtoRE(i,k)= nansum([Vec_numelAWtoRE(i,k) 1],2);
end
end
if Drug1_windo(j)==1
if Drug1_windo(j+1)==1
Drug1_numelAWtoAW(i,k)=nansum([Drug1_numelAWtoAW(i,k) 1],2);
elseif Drug1_windo(j+1)==2
Drug1_numelAWtoNR(i,k)=nansum([Drug1_numelAWtoNR(i,k) 1],2);
elseif Drug1_windo(j+1)==3
Drug1_numelAWtoRE(i,k)= nansum([Drug1_numelAWtoRE(i,k) 1],2);
end
end
if Drug2_windo(j)==1
if Drug2_windo(j+1)==1
Drug2_numelAWtoAW(i,k)=nansum([Drug2_numelAWtoAW(i,k) 1],2);
elseif Drug2_windo(j+1)==2
Drug2_numelAWtoNR(i,k)=nansum([Drug2_numelAWtoNR(i,k) 1],2);
elseif Drug2_windo(j+1)==3
Drug2_numelAWtoRE(i,k)= nansum([Drug2_numelAWtoRE(i,k) 1],2);
end
end
if Drug3_windo(j)==1
if Drug3_windo(j+1)==1
Drug3_numelAWtoAW(i,k)=nansum([Drug3_numelAWtoAW(i,k) 1],2);
elseif Drug3_windo(j+1)==2
Drug3_numelAWtoNR(i,k)=nansum([Drug3 _numelAWtoNR(i,k) 1],2);
elseif Drug3 _windo(j+1)==3
Drug3_numelAWtoRE(i,k)= nansum([Drug3_numelAWtoRE(i,k) 1],2);
end
end
Appendix 5
161
end
Bas_prob_fromAWtoAW(i,k)=Bas_numelAWtoAW(i,k)/Bas_numelAWAKE;
Bas_prob_fromAWtoNR(i,k)=Bas_numelAWtoNR(i,k)/Bas_numelAWAKE;
Bas_prob_fromAWtoRE(i,k)=Bas_numelAWtoRE(i,k)/Bas_numelAWAKE;
Vec_prob_fromAWtoAW(i,k)=Vec_numelAWtoAW(i,k)/Vec_numelAWAKE;
Vec_prob_fromAWtoNR(i,k)=Vec_numelAWtoNR(i,k)/Vec_numelAWAKE;
Vec_prob_fromAWtoRE(i,k)=Vec_numelAWtoRE(i,k)/Vec_numelAWAKE;
Drug1_prob_fromAWtoAW(i,k)=Drug1_numelAWtoAW(i,k)/Drug1_numelAWAKE;
Drug1_prob_fromAWtoNR(i,k)=Drug1_numelAWtoNR(i,k)/Drug1_numelAWAKE;
Drug1_prob_fromAWtoRE(i,k)=Drug1_numelAWtoRE(i,k)/Drug1_numelAWAKE;
Drug2_prob_fromAWtoAW(i,k)=Drug2_numelAWtoAW(i,k)/Drug2_numelAWAKE;
Drug2_prob_fromAWtoNR(i,k)=Drug2_numelAWtoNR(i,k)/Drug2_numelAWAKE;
Drug2_prob_fromAWtoRE(i,k)=Drug2_numelAWtoRE(i,k)/Drug2_numelAWAKE;
Drug3_prob_fromAWtoAW(i,k)=Drug3_numelAWtoAW(i,k)/Drug3_numelAWAKE;
Drug3_prob_fromAWtoNR(i,k)=Drug3_numelAWtoNR(i,k)/Drug3_numelAWAKE;
Drug3_prob_fromAWtoRE(i,k)=Drug3_numelAWtoRE(i,k)/Drug3_numelAWAKE;
k=k+1;
end
end
% Calculation the mean of the transition probability from Awake to different sleep stages.
mean_Bas_prob_fromAWtoAW=nanmean(Bas_prob_fromAWtoAW);
mean_Bas_prob_fromAWtoNR=nanmean(Bas_prob_fromAWtoNR);
mean_Bas_prob_fromAWtoRE=nanmean(Bas_prob_fromAWtoRE);
mean_Vec_prob_fromAWtoAW=nanmean(Vec_prob_fromAWtoAW);
mean_Vec_prob_fromAWtoNR=nanmean(Vec_prob_fromAWtoNR);
mean_Vec_prob_fromAWtoRE=nanmean(Vec_prob_fromAWtoRE);
mean_Drug1_prob_fromAWtoAW=nanmean(Drug1_prob_fromAWtoAW);
mean_Drug1_prob_fromAWtoNR=nanmean(Drug1_prob_fromAWtoNR);
mean_Drug1_prob_fromAWtoRE=nanmean(Drug1_prob_fromAWtoRE);
mean_Drug2_prob_fromAWtoAW=nanmean(Drug2_prob_fromAWtoAW);
mean_Drug2_prob_fromAWtoNR=nanmean(Drug2_prob_fromAWtoNR);
mean_Drug2_prob_fromAWtoRE=nanmean(Drug2_prob_fromAWtoRE);
mean_Drug3_prob_fromAWtoAW=nanmean(Drug3_prob_fromAWtoAW);
mean_Drug3_prob_fromAWtoNR=nanmean(Drug3_prob_fromAWtoNR);
mean_Drug3_prob_fromAWtoRE=nanmean(Drug3_prob_fromAWtoRE);
Appendix 5
162
pp_Bas=mean_Bas_prob_fromAWtoAW+mean_Bas_prob_fromAWtoNR+mean_Bas_prob_fromAWtoRE
pp_Vec=mean_Vec_prob_fromAWtoAW+mean_Vec_prob_fromAWtoNR+mean_Vec_prob_fromAWtoRE
pp_Drug1=mean_Drug1_prob_fromAWtoAW+mean_Drug1_prob_fromAWtoNR+mean_Drug1_prob_from
AWtoRE
pp_Drug2=mean_Drug2_prob_fromAWtoAW+mean_Drug2_prob_fromAWtoNR+mean_Drug2_prob_from
AWtoRE
pp_Drug3=mean_Drug3_prob_fromAWtoAW+mean_Drug3_prob_fromAWtoNR+mean_Drug3_prob_from
AWtoRE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PLOTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Xaxis=[4:16] Axis % plot x,y,ʹLineWidthʹ,2 Line sizes number 2
%ʹ‐‐ʹ Dashed line % ʹColorʹ,[0 0.60 0] Color Codices
subplot(3,3,1) % 3 indicated the number of row, 3 indicated the
number of columns and 1indicated the position of plot.
Xaxis=[4:16]
xlim([4,15]) % Limited of Y axis
ylim([0,1]) % Limited of X axis
plot(Xaxis,mean_Bas_prob_fromAWtoAW,ʹ‐‐ʹ,ʹColorʹ, [0 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Baseline TP AW‐AW
plot(Xaxis,mean_Vec_prob_fromAWtoAW,ʹʹ‐‐ʹ,ʹColorʹ, [0 0 1],ʹLineWidthʹ,2)
hold on % Plot mean of Methylcellulose TP AW‐AW
plot(Xaxis,mean_Drug1_prob_fromAWtoAW,ʹ‐‐ʹ,ʹColorʹ, [1 0.800000011920929 0.800000011920929
],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 1 TP AW‐AW
plot(Xaxis,mean_Drug2_prob_fromAWtoAW,ʹ‐‐ʹ,ʹColorʹ, [0.400000005960464 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 2 TP AW‐AW
plot(Xaxis,mean_Drug3_prob_fromAWtoAW, ʹ‐‐ʹ,ʹColorʹ, [1 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 3 TP AW‐AW
subplot(3,3,2) % Third plot, position 2. Xaxis=[4:16]
xlim([4,15]) % Limited of Y axis
Appendix 5
163
ylim([0,1]) % Limited of X axis
plot(Xaxis,mean_Bas_prob_fromAWtoNR,ʹ‐‐ʹ,ʹColorʹ, [0 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Baseline TP AW‐NR
plot(Xaxis,mean_Vec_prob_fromAWtoNR,ʹʹ‐‐ʹ,ʹColorʹ, [0 0 1],ʹLineWidthʹ,2)
hold on % Plot mean of Methylcellulose TP AW‐NR
plot(Xaxis,mean_Drug1_prob_fromAWtoNR,ʹ‐‐ʹ,ʹColorʹ, [1 0.800000011920929 0.800000011920929
],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 1 TP AW‐NR
plot(Xaxis,mean_Drug2_prob_fromAWtoNR,ʹ‐‐ʹ,ʹColorʹ, [0.400000005960464 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 2 TP AW‐NR
plot(Xaxis,mean_Drug3_prob_fromAWtoNR, ʹ‐‐ʹ,ʹColorʹ, [1 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 3 TP AW‐NR
subplot(3,3,3) % Third plot, position 3 Xaxis=[4:16]
xlim([4,15]) % Limited of Y axis
ylim([0,1]) % Limited of X axis
plot(Xaxis,mean_Bas_prob_fromAWtoRE,ʹ‐‐ʹ,ʹColorʹ, [0 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Baseline TP AW‐RE
plot(Xaxis,mean_Vec_prob_fromAWtoRE,ʹʹ‐‐ʹ,ʹColorʹ, [0 0 1],ʹLineWidthʹ,2)
hold on % Plot mean of Methylcellulose TP AW‐RE
plot(Xaxis,mean_Drug1_prob_fromAWtoRE,ʹ‐‐ʹ,ʹColorʹ, [1 0.800000011920929 0.800000011920929
],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 1 TP AW‐RE
plot(Xaxis,mean_Drug2_prob_fromAWtoRE,ʹ‐‐ʹ,ʹColorʹ, [0.400000005960464 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 2 TP AW‐RE
plot(Xaxis,mean_Drug3_prob_fromAWtoRE,ʹ‐‐ʹ,ʹColorʹ, [1 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 3 TP AW‐RE
Appendix 5
164
DESCRIPTORS OF SLEEP
2. TRANSITIONS PROBABILITIES
2.2. From NREM
‐ All groups
%Load data set
%Rename of datasets
Bas_data=Name of dataset; % Baseline Dataset Vec_data=Name of dataset; % Vehicle‐Methylcellulose Dataset
Drug1_data= Name of dataset; % Zolpidem(10 mg) Dataset
Drug2_data= Name of dataset; % Zolpidem(20 mg) Dataset
Drug3_data= Name of dataset; % Zolpidem(30 mg) Dataset
%COLUMNS OF DATASET
%STD=ID STT=DV TIME EPOCH AWPV NRPV REPV AWK NREM REM
ListRatsBas=unique(Bas_data(:,1)); % Select the number of the ID for each rats.
ListRatsVec=unique(Vec_data(:,1));
ListRatsDrug1=unique(Drug1_data(:,1));
ListRatsDrug2=unique(Drug2_data(:,1));
ListRatsDrug3=unique(Drug3_data(:,1));
numObs=360; % 60min=3600sec, 360 observations per window.
studyTime=4320; % 12hrs=43200sec, 4320 observations in 12 hours. %%%Initialization of Baseline Bas_numelNRtoAW=zeros(length(ListRatsBas),4320/numObs);
Bas_numelNRtoNR=zeros(length(ListRatsBas), 4320/numObs);
Bas_numelNRtoRE=zeros(length(ListRatsBas), 4320/numObs);
%%%Initialization of Vehicle‐Methylcellulose Vec_numelNRtoAW=zeros(length(ListRatsVec), 4320/numObs);
Vec_numelNRtoNR=zeros(length(ListRatsVec), 4320/numObs);
Vec_numelNRtoRE=zeros(length(ListRatsVec), 4320/numObs);
%%%Initialization of Drug 1 Drug1_numelNRtoAW=zeros(length(ListRatsDrug1),4320/numObs);
Drug1_numelNRtoNR=zeros(length(ListRatsDrug1), 4320/numObs);
Drug1_numelNRtoRE=zeros(length(ListRatsDrug1), 4320/numObs);
Appendix 5
165
%%%Initialization of Drug 2 Drug2_numelNRtoAW=zeros(length(ListRatsDrug2),4320/numObs);
Drug2_numelNRtoNR=zeros(length(ListRatsDrug2),4320/numObs);
Drug2_numelNRtoRE=zeros(length(ListRatsDrug2),4320/numObs);
%%%Initialization of Drug 3 Drug3_numelNRtoAW=zeros(length(ListRatsDrug3),4320/numObs);
Drug3_numelNRtoNR=zeros(length(ListRatsDrug3), 4320/numObs);
Drug3_numelNRtoRE=zeros(length(ListRatsDrug3), 4320/numObs);
% Transitions probabilities
for i=1:length(listRatsBas) % For each rata
% Load rat i
Bas_rat=Bas_data(find(Bas_data(:,1)==ListRatsBas(i)),:);
Vec_rat=Vec_data(find(Vec_data(:,1)==ListRatsVec(i)),:);
Drug1_rat=Drug1_data(find(Drug1_data(:,1)==ListRatsDrug1(i)),:);
Drug2_rat=Drug2_data(find(Drug2_data(:,1)==ListRatsDrug2(i)),:);
Drug3_rat=Drug3_data(find(Drug3_data(:,1)==ListRatsDrug3(i)),:);
k=1; % Initialization k (K identifies the window)
for c=1:numObs:(4320‐numObs+1)
% If the window have 360 observations4320/360=12 window
% Calculation of Nº of transitions for all groups
Bas_windo=Bas_rat(c:(c+360‐1),2);
Vec_windo=Vec_rat(c:(c+360‐1),2);
Drug1_windo=Drug1_rat(c:(c+360‐1),2);
Drug2_windo=Drug2_rat(c:(c+360‐1),2);
Drug3_windo=Drug3_rat(c:(c+360‐1),2);
Bas_numelNREM=numel(find(Bas_windo==2)); % All observations of NREM
Vec_numelNREM=numel(find(Vec_windo==2)); % All observations of NREM
Drug1_numelNREM=numel(find(Drug1_windo==2));
Drug2_numelNREM=numel(find(Drug2_windo==2));
Drug2_numelNREM=numel(find(Drug2_windo==2));
for j=1:numObs‐1
if Bas_windo(j)==2
Appendix 5
166
if Bas_windo(j+1)==1
Bas_numelNRtoAW(i,k)=nansum([Bas_numelNRtoAW(i,k) 1],2);
elseif Bas_windo(j+1)==2
Bas_numelNRtoNR(i,k)=nansum([Bas_numelNRtoNR(i,k) 1],2);
elseif Bas_windo(j+1)==3
Bas_numelNRtoRE(i,k)= nansum([Bas_numelNRtoRE(i,k) 1],2);
end
end
if Vec_windo(j)==2
if Vec_windo(j+1)==1
Vec_numelNRtoAW(i,k)=nansum([Vec_numelNRtoAW(i,k) 1],2);
elseif Vec_windo(j+1)==2
Vec_numelNRtoNR(i,k)=nansum([Vec_numelNRtoNR(i,k) 1],2);
elseif Vec_windo(j+1)==3
Vec_numelNRtoRE(i,k)= nansum([Vec_numelNRtoRE(i,k) 1],2);
end
end
if Drug1_windo(j)==2
if Drug1_windo(j+1)==1
Drug1_numelNRtoAW(i,k)=nansum([Drug1_numelNRtoAW(i,k) 1],2);
elseif Drug1_windo(j+1)==2
Drug1_numelNRtoNR(i,k)=nansum([Drug1_numelNRtoNR(i,k) 1],2);
elseif Drug1_windo(j+1)==3
Drug1_numelNRtoRE(i,k)= nansum([Drug1_numelNRtoRE(i,k) 1],2);
end
end
if Drug2_windo(j)==2
if Drug2_windo(j+1)==1
Drug2_numelNRtoAW(i,k)=nansum([Drug2_numelNRtoAW(i,k) 1],2);
elseif Drug2_windo(j+1)==2
Drug2_numelNRtoNR(i,k)=nansum([Drug2_numelNRtoNR(i,k) 1],2);
elseif Drug2_windo(j+1)==3
Drug2_numelNRtoRE(i,k)= nansum([Drug2_numelNRtoRE(i,k) 1],2);
end
end
if Drug3_windo(j)==2
if Drug3_windo(j+1)==1
Drug3_numelNRtoAW(i,k)=nansum([Drug3_numelNRtoAW(i,k) 1],2);
Appendix 5
167
elseif Drug3_windo(j+1)==2
Drug3_numelNRtoNR(i,k)=nansum([Drug3 _numelNRtoNR(i,k) 1],2);
elseif Drug3 _windo(j+1)==3
Drug3_numelNRtoRE(i,k)= nansum([Drug3_numelNRtoRE(i,k) 1],2);
end
end
end
Bas_prob_fromNRtoAW(i,k)=Bas_numelNRtoAW(i,k)/Bas_numelNREM;
Bas_prob_fromNRtoNR(i,k)=Bas_numelNRtoNR(i,k)/Bas_numelNREM;
Bas_prob_fromNRtoRE(i,k)=Bas_numelNRtoRE(i,k)/Bas_numelNREM;
Vec_prob_fromNRtoAW(i,k)=Vec_numelNRtoAW(i,k)/Vec_numelNREM;
Vec_prob_fromNRtoNR(i,k)=Vec_numelNRtoNR(i,k)/Vec_numelNREM;
Vec_prob_fromNRtoRE(i,k)=Vec_numelNRtoRE(i,k)/Vec_numelNREM;
Drug1_prob_fromNRtoAW(i,k)=Drug1_numelNRtoAW(i,k)/Drug1_numelNREM;
Drug1_prob_fromNRtoNR(i,k)=Drug1_numelNRtoNR(i,k)/Drug1_numelNREM;
Drug1_prob_fromNRtoRE(i,k)=Drug1_numelNRtoRE(i,k)/Drug1_numelNREM;
Drug2_prob_fromNRtoAW(i,k)=Drug2_numelNRtoAW(i,k)/Drug2_numelNREM;
Drug2_prob_fromNRtoNR(i,k)=Drug2_numelNRtoNR(i,k)/Drug2_numelNREM;
Drug2_prob_fromNRtoRE(i,k)=Drug2_numelNRtoRE(i,k)/Drug2_numelNREM;
Drug3_prob_fromNRtoAW(i,k)=Drug3_numelNRtoAW(i,k)/Drug3_numelNREM;
Drug3_prob_fromNRtoNR(i,k)=Drug3_numelNRtoNR(i,k)/Drug3_numelNREM;
Drug3_prob_fromNRtoRE(i,k)=Drug3_numelNRtoRE(i,k)/Drug3_numelNREM;
k=k+1;
end
end
% Calculation the mean of the transition probability from NREM to different sleep stages.
mean_Bas_prob_fromNRtoAW=nanmean(Bas_prob_fromNRtoAW);
mean_Bas_prob_fromNRtoNR=nanmean(Bas_prob_fromNRtoNR);
mean_Bas_prob_fromNRtoRE=nanmean(Bas_prob_fromNRtoRE);
mean_Vec_prob_fromNRtoAW=nanmean(Vec_prob_fromNRtoAW);
mean_Vec_prob_fromNRtoNR=nanmean(Vec_prob_fromNRtoNR);
mean_Vec_prob_fromNRtoRE=nanmean(Vec_prob_fromNRtoRE);
mean_Drug1_prob_fromNRtoAW=nanmean(Drug1_prob_fromNRtoAW);
mean_Drug1_prob_fromNRtoNR=nanmean(Drug1_prob_fromNRtoNR);
mean_Drug1_prob_fromNRtoRE=nanmean(Drug1_prob_fromNRtoRE);
Appendix 5
168
mean_Drug2_prob_fromNRtoAW=nanmean(Drug2_prob_fromNRtoAW);
mean_Drug2_prob_fromNRtoNR=nanmean(Drug2_prob_fromNRtoNR);
mean_Drug2_prob_fromNRtoRE=nanmean(Drug2_prob_fromNRtoRE);
mean_Drug3_prob_fromNRtoAW=nanmean(Drug3_prob_fromNRtoAW);
mean_Drug3_prob_fromNRtoNR=nanmean(Drug3_prob_fromNRtoNR);
mean_Drug3_prob_fromNRtoRE=nanmean(Drug3_prob_fromNRtoRE);
pp_Bas=mean_Bas_prob_fromNRtoAW+mean_Bas_prob_fromNRtoNR+mean_Bas_prob_fromNRtoRE
pp_Vec=mean_Vec_prob_fromNRtoAW+mean_Vec_prob_fromNRtoNR+mean_Vec_prob_fromNRtoRE
pp_Drug1=mean_Drug1_prob_fromNRtoAW+mean_Drug1_prob_fromNRtoNR+mean_Drug1_prob_fromN
RtoRE
pp_Drug2=mean_Drug2_prob_fromNRtoAW+mean_Drug2_prob_fromNRtoNR+mean_Drug2_prob_fromN
RtoRE
pp_Drug3=mean_Drug3_prob_fromNRtoAW+mean_Drug3_prob_fromNRtoNR+mean_Drug3_prob_fromN
RtoRE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PLOTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Xaxis=[4:16] Axis % plot x,y,ʹLineWidthʹ,2 Line sizes number 2
%ʹ‐‐ʹ Dashed line % ʹColorʹ,[0 0.60 0] Color Codices
subplot(3,3,4) % 3 indicated the number of row, 3 indicated the
number of columns and 4 indicated the position of plot.
Xaxis=[4:16]
xlim([4,15]) % Limited of Y axis
ylim([0,1]) % Limited of X axis
plot(Xaxis,mean_Bas_prob_fromNRtoAW,ʹ‐‐ʹ,ʹColorʹ, [0 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Baseline TP NR‐AW
plot(Xaxis,mean_Vec_prob_fromNRtoAW,ʹʹ‐‐ʹ,ʹColorʹ, [0 0 1],ʹLineWidthʹ,2)
hold on % Plot mean of Methylcellulose TP NR‐AW
plot(Xaxis,mean_Drug1_prob_fromNRtoAW,ʹ‐‐ʹ,ʹColorʹ, [1 0.800000011920929 0.800000011920929
],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 1 TP NR‐AW
plot(Xaxis,mean_Drug2_prob_fromNRtoAW,ʹ‐‐ʹ,ʹColorʹ, [0.400000005960464 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 2 TP NR‐AW
Appendix 5
169
plot(Xaxis,mean_Drug3_prob_fromNRtoAW, ʹ‐‐ʹ,ʹColorʹ, [1 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 3 TP NR‐AW
subplot(3,3,5) % Fifth plot, position 5. Xaxis=[4:16]
xlim([4,15]) % Limited of Y axis
ylim([0,1]) % Limited of X axis
plot(Xaxis,mean_Bas_prob_fromNRtoNR,ʹ‐‐ʹ,ʹColorʹ, [0 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Baseline TP NR‐NR
plot(Xaxis,mean_Vec_prob_fromNRtoNR,ʹʹ‐‐ʹ,ʹColorʹ, [0 0 1],ʹLineWidthʹ,2)
hold on % Plot mean of Methylcellulose TP NR‐NR
plot(Xaxis,mean_Drug1_prob_fromNRtoNR,ʹ‐‐ʹ,ʹColorʹ, [1 0.800000011920929 0.800000011920929
],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 1 TP NR‐NR
plot(Xaxis,mean_Drug2_prob_fromNRtoNR,ʹ‐‐ʹ,ʹColorʹ, [0.400000005960464 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 2 TP NR‐NR
plot(Xaxis,mean_Drug3_prob_fromNRtoNR,ʹ‐‐ʹ,ʹColorʹ, [1 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 3 TP NR‐NR
subplot(3,3,6) % Sixth plot, position 6. Xaxis=[4:16]
xlim([4,15]) % Limited of Y axis
ylim([0,1]) % Limited of X axis
plot(Xaxis,mean_Bas_prob_fromNRtoRE,ʹ‐‐ʹ,ʹColorʹ, [0 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Baseline TP NR‐RE
plot(Xaxis,mean_Vec_prob_fromNRtoRE,ʹʹ‐‐ʹ,ʹColorʹ, [0 0 1],ʹLineWidthʹ,2)
hold on % Plot mean of Methylcellulose TP NR‐RE
plot(Xaxis,mean_Drug1_prob_fromNRtoRE,ʹ‐‐ʹ,ʹColorʹ, [1 0.800000011920929 0.800000011920929
],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 1 TP NR‐RE
plot(Xaxis,mean_Drug2_prob_fromNRtoRE,ʹ‐‐ʹ,ʹColorʹ, [0.400000005960464 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 2 TP NR‐RE
plot(Xaxis,mean_Drug3_prob_fromNRtoRE,ʹ‐‐ʹ,ʹColorʹ, [1 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 3 TP NR‐RE
Appendix 5
170
DESCRIPTORS OF SLEEP
2. TRANSITIONS PROBABILITIES
2.3. From REM
‐ All groups
%Load data set
%Rename of datasets
Bas_data=Name of dataset; % Baseline Dataset Vec_data=Name of dataset; % Vehicle‐Methylcellulose Dataset
Drug1_data= Name of dataset; % Zolpidem(10 mg) Dataset
Drug2_data= Name of dataset; % Zolpidem(20 mg) Dataset
Drug3_data= Name of dataset; % Zolpidem(30 mg) Dataset
%COLUMNS OF DATASET
%STD=ID STT=DV TIME EPOCH AWPV NRPV REPV AWK NREM REM
ListRatsBas=unique(Bas_data(:,1)); % Select the number of the ID for each rats.
ListRatsVec=unique(Vec_data(:,1));
ListRatsDrug1=unique(Drug1_data(:,1));
ListRatsDrug2=unique(Drug2_data(:,1));
ListRatsDrug3=unique(Drug3_data(:,1));
numObs=360; % 60min=3600sec, 360 observations per window.
studyTime=4320; % 12hrs=43200sec, 4320 observations in 12 hours. %%%Initialization of Baseline Bas_numelREtoAW=zeros(length(ListRatsBas),4320/numObs);
Bas_numelREtoNR=zeros(length(ListRatsBas),4320/numObs);
Bas_numelREtoRE=zeros(length(ListRatsBas),4320/numObs);
%%%Initialization of Vehicle‐Methylcellulose Vec_numelREtoAW=zeros(length(ListRatsVec),4320/numObs);
Vec_numelREtoNR=zeros(length(ListRatsVec),4320/numObs);
Vec_numelREtoRE=zeros(length(ListRatsVec),4320/numObs);
%%%Initialization of Drug 1 Drug1_numelREtoAW=zeros(length(ListRatsDrug1),4320/numObs);
Drug1_numelREtoNR=zeros(length(ListRatsDrug1),4320/numObs);
Drug1_numelREtoRE=zeros(length(ListRatsDrug1),4320/numObs);
Appendix 5
171
%%%Initialization of Drug 2 Drug2_numelREtoAW=zeros(length(ListRatsDrug2),4320/numObs);
Drug2_numelREtoNR=zeros(length(ListRatsDrug2),4320/numObs);
Drug2_numelREtoRE=zeros(length(ListRatsDrug2),4320/numObs);
%%%Initialization of Drug 3 Drug3_numelREtoAW=zeros(length(ListRatsDrug3),4320/numObs);
Drug3_numelREtoNR=zeros(length(ListRatsDrug3), 4320/numObs);
Drug3_numelREtoRE=zeros(length(ListRatsDrug3), 4320/numObs);
% Transitions probabilities
for i=1:length(listRatsBas) % For each rata
% Load rat i
Bas_rat=Bas_data(find(Bas_data(:,1)==ListRatsBas(i)),:);
Vec_rat=Vec_data(find(Vec_data(:,1)==ListRatsVec(i)),:);
Drug1_rat=Drug1_data(find(Drug1_data(:,1)==ListRatsDrug1(i)),:);
Drug2_rat=Drug2_data(find(Drug2_data(:,1)==ListRatsDrug2(i)),:);
Drug3_rat=Drug3_data(find(Drug3_data(:,1)==ListRatsDrug3(i)),:);
k=1; % Initialization k (K identifies the window)
for c=1:numObs:(4320‐numObs+1)
% If the window have 360 observations4320/360=12 window
% Calculation of Nº of transitions for all groups
Bas_windo=Bas_rat(c:(c+360‐1),2);
Vec_windo=Vec_rat(c:(c+360‐1),2);
Drug1_windo=Drug1_rat(c:(c+360‐1),2);
Drug2_windo=Drug2_rat(c:(c+360‐1),2);
Drug3_windo=Drug3_rat(c:(c+360‐1),2);
Bas_numelREM=numel(find(Bas_windo==3)); % All observations of REM
Vec_numelREM=numel(find(Vec_windo==3));
Drug1_numelREM=numel(find(Drug1_windo==3));
Drug2_numelREM=numel(find(Drug2_windo==3));
Drug2_numelREM=numel(find(Drug2_windo==3));
for j=1:numObs‐1
if Bas_windo(j)==3
if Bas_windo(j+1)==1
Bas_numelREtoAW(i,k)=nansum([Bas_numelREtoAW(i,k) 1],2);
Appendix 5
172
elseif Bas_windo(j+1)==2
Bas_numelREtoNR(i,k)=nansum([Bas_numelREtoNR(i,k) 1],2);
elseif Bas_windo(j+1)==3
Bas_numelREtoRE(i,k)=nansum([Bas_numelREtoRE(i,k) 1],2);
end
end
if Vec_windo(j)==3
if Vec_windo(j+1)==1
Vec_numelREtoAW(i,k)=nansum([Vec_numelREtoAW(i,k) 1],2);
elseif Vec_windo(j+1)==2
Vec_numelREtoNR(i,k)=nansum([Vec_numelREtoNR(i,k) 1],2);
elseif Vec_windo(j+1)==3
Vec_numelREtoRE(i,k)=nansum([Vec_numelREtoRE(i,k) 1],2);
end
end
if Drug1_windo(j)==3
if Drug1_windo(j+1)==1
Drug1_numelREtoAW(i,k)=nansum([Drug1_numelREtoAW(i,k) 1],2);
elseif Drug1_windo(j+1)==2
Drug1_numelREtoNR(i,k)=nansum([Drug1_numelREtoNR(i,k) 1],2);
elseif Drug1_windo(j+1)==3
Drug1_numelREtoRE(i,k)=nansum([Drug1_numelREtoRE(i,k) 1],2);
end
end
if Drug2_windo(j)==3
if Drug2_windo(j+1)==1
Drug2_numelREtoAW(i,k)=nansum([Drug2_numelREtoAW(i,k) 1],2);
elseif Drug2_windo(j+1)==2
Drug2_numelREtoNR(i,k)=nansum([Drug2_numelREtoNR(i,k) 1],2);
elseif Drug2_windo(j+1)==3
Drug2_numelREtoRE(i,k)=nansum([Drug2_numelREtoRE(i,k) 1],2);
end
end
if Drug3_windo(j)==3
if Drug3_windo(j+1)==1
Drug3_numelREtoAW(i,k)=nansum([Drug3_numelREtoAW(i,k) 1],2);
elseif Drug3_windo(j+1)==2
Drug3_numelREtoNR(i,k)=nansum([Drug3_numelREtoNR(i,k) 1],2);
Appendix 5
173
elseif Drug3 _windo(j+1)==3
Drug3_numelREtoRE(i,k)= nansum([Drug3_numelREtoRE(i,k) 1],2);
end
end
end
Bas_prob_fromREtoAW(i,k)=Bas_numelREtoAW(i,k)/Bas_numelREM;
Bas_prob_fromREtoNR(i,k)=Bas_numelREtoNR(i,k)/Bas_numelREM;
Bas_prob_fromREtoRE(i,k)=Bas_numelREtoRE(i,k)/Bas_numelREM;
Vec_prob_fromREtoAW(i,k)=Vec_numelREtoAW(i,k)/Vec_numelREM;
Vec_prob_fromREtoNR(i,k)=Vec_numelREtoNR(i,k)/Vec_numelREM;
Vec_prob_fromREtoRE(i,k)=Vec_numelREtoRE(i,k)/Vec_numelREM;
Drug1_prob_fromREtoAW(i,k)=Drug1_numelREtoAW(i,k)/Drug1_numelREM;
Drug1_prob_fromREtoNR(i,k)=Drug1_numelREtoNR(i,k)/Drug1_numelREM;
Drug1_prob_fromREtoRE(i,k)=Drug1_numelREtoRE(i,k)/Drug1_numelREM;
Drug2_prob_fromREtoAW(i,k)=Drug2_numelREtoAW(i,k)/Drug2_numelREM;
Drug2_prob_fromREtoNR(i,k)=Drug2_numelREtoNR(i,k)/Drug2_numelREM;
Drug2_prob_fromREtoRE(i,k)=Drug2_numelREtoRE(i,k)/Drug2_numelREM;
Drug3_prob_fromREtoAW(i,k)=Drug3_numelREtoAW(i,k)/Drug3_numelREM;
Drug3_prob_fromREtoNR(i,k)=Drug3_numelREtoNR(i,k)/Drug3_numelREM;
Drug3_prob_fromREtoRE(i,k)=Drug3_numelREtoRE(i,k)/Drug3_numelREM;
k=k+1;
end
end
% Calculation the mean of the transition probability from REM to different sleep stages.
mean_Bas_prob_fromREtoAW=nanmean(Bas_prob_fromREtoAW);
mean_Bas_prob_fromREtoNR=nanmean(Bas_prob_fromREtoNR);
mean_Bas_prob_fromREtoRE=nanmean(Bas_prob_fromREtoRE);
mean_Vec_prob_fromREtoAW=nanmean(Vec_prob_fromREtoAW);
mean_Vec_prob_fromREtoNR=nanmean(Vec_prob_fromREtoNR);
mean_Vec_prob_fromREtoRE=nanmean(Vec_prob_fromREtoRE);
mean_Drug1_prob_fromREtoAW=nanmean(Drug1_prob_fromREtoAW);
mean_Drug1_prob_fromREtoNR=nanmean(Drug1_prob_fromREtoNR);
mean_Drug1_prob_fromREtoRE=nanmean(Drug1_prob_fromREtoRE);
mean_Drug2_prob_fromREtoAW=nanmean(Drug2_prob_fromREtoAW);
mean_Drug2_prob_fromREtoNR=nanmean(Drug2_prob_fromREtoNR);
mean_Drug2_prob_fromREtoRE=nanmean(Drug2_prob_fromREtoRE);
Appendix 5
174
mean_Drug3_prob_fromREtoAW=nanmean(Drug3_prob_fromREtoAW);
mean_Drug3_prob_fromREtoNR=nanmean(Drug3_prob_fromREtoNR);
mean_Drug3_prob_fromREtoRE=nanmean(Drug3_prob_fromREtoRE);
pp_Bas=mean_Bas_prob_fromREtoAW+mean_Bas_prob_fromREtoNR+mean_Bas_prob_fromREtoRE
pp_Vec=mean_Vec_prob_fromREtoAW+mean_Vec_prob_fromREtoNR+mean_Vec_prob_fromREtoRE
pp_Drug1=mean_Drug1_prob_fromREtoAW+mean_Drug1_prob_fromREtoNR+mean_Drug1_prob_fromRE
toRE
pp_Drug2=mean_Drug2_prob_fromREtoAW+mean_Drug2_prob_fromREtoNR+mean_Drug2_prob_fromRE
toRE
pp_Drug3=mean_Drug3_prob_fromREtoAW+mean_Drug3_prob_fromREtoNR+mean_Drug3_prob_fromRE
toRE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PLOTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Xaxis=[4:16] Axis % plot x,y,ʹLineWidthʹ,2 Line sizes number 2
%ʹ‐‐ʹ Dashed line % ʹColorʹ,[0 0.60 0] Color Codices
subplot(3,3,7) % 3 indicated the number of row, 3 indicated the
number of columns and 7 indicated the position of plot.
Xaxis=[4:16]
xlim([4,15]) % Limited of Y axis
ylim([0,1]) % Limited of X axis
plot(Xaxis,mean_Bas_prob_fromREtoAW,ʹ‐‐ʹ,ʹColorʹ, [0 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Baseline TP RE‐AW
plot(Xaxis,mean_Vec_prob_fromREtoAW,ʹʹ‐‐ʹ,ʹColorʹ, [0 0 1],ʹLineWidthʹ,2)
hold on % Plot mean of Methylcellulose TP RE‐AW
plot(Xaxis,mean_Drug1_prob_fromREtoAW,ʹ‐‐ʹ,ʹColorʹ, [1 0.800000011920929 0.800000011920929
],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 1 TP RE‐AW
plot(Xaxis,mean_Drug2_prob_fromREtoAW,ʹ‐‐ʹ,ʹColorʹ, [0.400000005960464 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 2 TP RE‐AW
plot(Xaxis,mean_Drug3_prob_fromREtoAW,ʹ‐‐ʹ,ʹColorʹ, [1 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 3 TP RE‐AW
Appendix 5
175
subplot(3,3,8) % Eight plot, position 8. Xaxis=[4:16]
xlim([4,15]) % Limited of Y axis
ylim([0,1]) % Limited of X axis
plot(Xaxis,mean_Bas_prob_fromREtoNR,ʹ‐‐ʹ,ʹColorʹ, [0 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Baseline TP RE‐NR
plot(Xaxis,mean_Vec_prob_fromREtoNR,ʹ‐‐ʹ,ʹColorʹ, [0 0 1],ʹLineWidthʹ,2)
hold on % Plot mean of Methylcellulose TP RE‐NR
plot(Xaxis,mean_Drug1_prob_fromREtoNR,ʹ‐‐ʹ,ʹColorʹ, [1 0.800000011920929 0.800000011920929
],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 1 TP RE‐NR
plot(Xaxis,mean_Drug2_prob_fromREtoNR,ʹ‐‐ʹ,ʹColorʹ, [0.400000005960464 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 2 TP RE‐NR
plot(Xaxis,mean_Drug3_prob_fromREtoNR,ʹ‐‐ʹ,ʹColorʹ, [1 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 3 TP RE‐NR
subplot(3,3,9) % Third plot, position 3. Xaxis=[4:16]
xlim([4,15]) % Limited of Y axis
ylim([0,1]) % Limited of X axis
plot(Xaxis,mean_Bas_prob_fromREtoRE,ʹ‐‐ʹ,ʹColorʹ, [0 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Baseline TP RE‐RE
plot(Xaxis,mean_Vec_prob_fromREtoRE,ʹʹ‐‐ʹ,ʹColorʹ, [0 0 1],ʹLineWidthʹ,2)
hold on % Plot mean of Methylcellulose TP RE‐RE
plot(Xaxis,mean_Drug1_prob_fromREtoRE,ʹ‐‐ʹ,ʹColorʹ, [1 0.800000011920929 0.800000011920929
],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 1 TP RE‐RE
plot(Xaxis,mean_Drug2_prob_fromREtoRE,ʹ‐‐ʹ,ʹColorʹ, [0.400000005960464 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 2 TP RE‐RE
plot(Xaxis,mean_Drug3_prob_fromREtoRE,ʹ‐‐ʹ,ʹColorʹ, [1 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 3 TP RE‐RE
Appendix 5
176
DESCRIPTORS OF SLEEP
3. NUMBER OF TRANSITIONS
%Load data set
%Rename of datasets
Bas_data=Name of dataset; % Baseline Dataset Vec_data=Name of dataset; % Methylcellulose Dataset
Drug1_data=Name of dataset; % Zolpidem 10 mg Dataset
Drug2_data=Name of dataset; % Zolpidem 20 mg Dataset
Drug3_data=Name of dataset; % Zolpidem 30 mg Dataset
%COLUMNS OF DATASET
%STD=ID STT=DV TIME EPOCH AWPV NRPV REPV AWK NREM REM
ListRatsBas=unique(Bas_data(:,1)); % Select the number of the ID for each rats.
ListRatsVec=unique(Vec_data(:,1));
ListRatsDrug1=unique(Drug1_data(:,1));
ListRatsDrug2=unique(Drug2_data(:,1));
ListRatsDrug3=unique(Drug3_data(:,1));
numObs=360; % 60min=3600sec, 360 observations per window.
studyTime=4320; % 12hrs=43200sec, 4320 observations in 12 hours.
Bas_numTran=zeros(length(ListRatsBas),4320/numObs);
Vec_numTran=zeros(length(ListRatsVec),4320/numObs);
Drug1_numTran=zeros(length(ListRatsDrug1),4320/numObs);
Drug2_numTran=zeros(length(ListRatsDrug2),4320/numObs);
Drug3_numTran=zeros(length(ListRatsDrug3),4320/numObs);
for i=1:length(ListRatsBas) % For each rata
% Load rat i
Bas_rat=Bas_data(find(Bas_data(:,1)==ListRatsBas(i)),:);
Vec_rat=Vec_data(find(Vec_data(:,1)==ListRatsVec (i)),:);
Drug1_rat= Drug1_data(find(Drug1_data(:,1)==ListRatsDrug1(i)),:);
Drug2_rat= Drug2_data(find(Drug2_data(:,1)==ListRatsDrug2(i)),:);
Drug3_rat= Drug3_data(find(Drug3_data(:,1)==ListRatsDrug3(i)),:);
k=1; % Initialization k (K identifies the window)
for c=1:numObs:(4320‐numObs)
% If the window have 360 observations4320/360=12 window
Appendix 5
177
% Calculation of number of transitions for all groups
Bas_windo=Bas_rat(c:(c+360‐1),2);
Vec_windo=Vec_rat(c:(c+360‐1),2);
Drug1_windo=Drug1_rat(c:(c+360‐1),2);
Drug2_windo=Drug2_rat(c:(c+360‐1),2);
Drug3_windo=Drug3_rat(c:(c+360‐1),2);
for j=1:numObs‐1 % Run the window
if Bas_windo(j)~=Bas_windo(j+1)
Bas_numTran(i,k)=Bas_numTran(i,k)+1;
end
if Vec_windo(j)~=Vec_windo(j+1)
Vec_numTran(i,k)=Vec_numTran(i,k)+1;
end
if Drug1_windo(j)~=Drug1_windo(j+1)
Drug1_numTran(i,k)=Drug1_numTran(i,k)+1;
end
if Drug2_windo(j)~=Drug2_windo(j+1)
Drug2_numTran(i,k)=Drug2_numTran(i,k)+1;
end
if Drug3_windo(j)~=Drug3_windo(j+1)
Drug3_numTran(i,k)=Drug3_numTran(i,k)+1;
end
end
k=k+1;
end
end
% Calculation the mean of the number of transition
mean_Bas_numTran=mean(Bas_numTran);
mean_Vec_numTran=mean(Vec_numTran);
mean_Drug1_numTran=mean(Drug1_numTran);
mean_Drug2_numTran=mean(Drug2_numTran);
mean_Drug3_numTran=mean(Drug3_numTran);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PLOTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Xaxis=[4:16] Axis % plot x,y,ʹLineWidthʹ,2 Line sizes number 2
%ʹ‐‐ʹ Dashed line % ʹColorʹ,[0 0.60 0] Color Codices
Appendix 5
178
%% BASELINE VS VEHICLE
Xaxis=[4:16]
Xlim([4,15]) % Limited of Y axis
plot(Xaxis,mean_Bas_numTran,ʹ‐kʹ,ʹLineWidthʹ,2)
hold on % Plot mean of Baseline
plot(Xaxis,mean_Vec_numTran,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
hold on % Plot mean of Vehicle
plot(Xaxis,Bas_numTran,ʹokʹ,ʹMarkerFaceColorʹ,ʹkʹ,ʹMarkerSizeʹ,2)
hold on
plot(Xaxis,Vec_numTran,ʹokʹ,ʹColorʹ,[0 0 1], ʹLineWidthʹ,2)
%% BASELINE VS DRUGS
Xaxis=[4:16]
Xlim([4,15]) % Limited of Y axis
plot(Xaxis,mean_Bas_numTran,ʹ‐‐ʹ,ʹColorʹ, [0 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Baseline
plot(Xaxis,mean_Drug1_numTran,ʹ‐‐ʹ,ʹColorʹ, [1 0.800000011920929 0.800000011920929
],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 1
plot(Xaxis,mean_Drug2_numTran,ʹ‐‐ʹ,ʹColorʹ, [0.400000005960464 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 2
plot(Xaxis,mean_Drug3_numTran,ʹ‐‐ʹ,ʹColorʹ, [1 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 3
plot(Xaxis,Bas_numTran,ʹokʹ,ʹMarkerFaceColorʹ,ʹkʹ,ʹMarkerSizeʹ,2)
hold on
plot(Xaxis,Drug1_numTran,ʹokʹ,ʹMarkerFaceColorʹ,[1 0.800000011920929 0.800000011920929],ʹMarkerSizeʹ,2)
hold on
plot(Xaxis,Drug2_numTran,ʹokʹ,ʹMarkerFaceColorʹ,[0.400000005960464 0 0],ʹMarkerSizeʹ,2)
hold on
plot(Xaxis,Drug3_numTran, ʹokʹ,ʹMarkerFaceColorʹ,[1 0 0],ʹMarkerSizeʹ,2)
hold on
Appendix 5
179
DESCRIPTORS OF SLEEP
4. MAXIMUM TIME CONSECUTIVE
4.1. AWAKE
%Load data set
%Rename of datasets
Bas_data=Name of dataset; % Baseline Dataset Vec_data=Name of dataset; % Methylcellulose Dataset
Drug1_data=Name of dataset; % Zolpidem 10 mg Dataset
Drug2_data=Name of dataset; % Zolpidem 20 mg Dataset
Drug3_data=Name of dataset; % Zolpidem 30 mg Dataset
%COLUMNS OF DATASET
%STD=ID STT=DV TIME EPOCH AWPV NRPV REPV AWK NREM REM
ListRatsBas=unique(Bas_data(:,1)); % Select the number of the ID for each rats.
ListRatsVec=unique(Vec_data(:,1));
ListRatsDrug1=unique(Drug1_data(:,1));
ListRatsDrug2=unique(Drug2_data(:,1));
ListRatsDrug3=unique(Drug3_data(:,1));
numObs=360; % 60min=3600sec, 360 observations per window.
studyTime=4320; % 12hrs=43200sec, 4320 observations in 12 hours.
Bas_maxC=zeros(length(ListRatsBas),4320/numObs);
Vec_maxC=zeros(length(ListRatsVec),4320/numObs);
Drug1_maxC=zeros(length(ListRatsDrug1),4320/numObs);
Drug2_maxC=zeros(length(ListRatsDrug2),4320/numObs);
Drug3_maxC=zeros(length(ListRatsDrug3),4320/numObs);
for i=1:length(ListRatsBas) % For each rata
% Load rat i
Bas_rat=Bas_data(find(Bas_data(:,1)==ListRatsBas(i)),:);
Vec_rat=Vec_data(find(Vec_data(:,1)==ListRatsVec (i)),:);
Drug1_rat= Drug1_data(find(Drug1_data(:,1)==ListRatsDrug1(i)),:);
Drug2_rat= Drug2_data(find(Drug2_data(:,1)==ListRatsDrug2(i)),:);
Drug3_rat= Drug3_data(find(Drug3_data(:,1)==ListRatsDrug3(i)),:);
Appendix 5
180
k=1; % Initialization k (K identifies the window)
for c=1:numObs:(4320‐numObs+1)
% Calculation of Number of transitions for all groups Bas_windo=Bas_rat(c:(c+360‐1),2);
Vec_windo=Vec_rat(c:(c+360‐1),2);
Drug1_windo=Drug1_rat(c:(c+360‐1),2);
Drug2_windo=Drug2_rat(c:(c+360‐1),2);
Drug3_windo=Drug3_rat(c:(c+360‐1),2);
%Baseline j=1;
while j<length(Bas_windo)
if Bas_windo(j)==1 % Awake cmax_aux=1;
au=j+1;
while au<=length(Bas_windo) & Bas_windo(au)==1
% While continuos in Awake au=au+1;
cmax_aux=cmax_aux+1;
end
j=au;
if Bas_maxC(i,k)<cmax_aux
Bas_maxC(i,k)=cmax_aux;
end
else
j=j+1;
end
end
%Vehicle‐Methylcellulose
j=1;
while j<length(Vec_windo)
if Vec_windo(j)==1 % Awake cmax_aux=1;
au=j+1;
while au<=length(Vec_windo) & Vec_windo(au)==1
% While continuos in Awake au=au+1;
cmax_aux=cmax_aux+1;
end
j=au;
if Vec_maxC(i,k)<cmax_aux
Appendix 5
181
Vec_maxC(i,k)=cmax_aux;
end
else
j=j+1;
end
end
%Drug 1‐Zolpidem 10 mg
j=1;
while j<length(Drug1_windo)
if Drug1_windo(j)==1 % Awake cmax_aux=1;
au=j+1;
while au<=length(Drug1_windo) & Drug1_windo(au)==1
% While continuos in Awake au=au+1;
cmax_aux=cmax_aux+1;
end
j=au;
if Drug1_maxC(i,k)<cmax_aux
Drug1_maxC(i,k)=cmax_aux;
end
else
j=j+1;
end
end
%Drug 2‐Zolpidem 20 mg
j=1;
while j<length(Drug2_windo)
if Drug2_windo(j)==1 % Awake cmax_aux=1;
au=j+1;
while au<=length(Drug2_windo) & Drug2_windo(au)==1
% While continuous in Awake au=au+1;
cmax_aux=cmax_aux+1;
end
j=au;
if Drug2_maxC(i,k)<cmax_aux
Drug2_maxC(i,k)=cmax_aux;
end
else
Appendix 5
182
j=j+1;
end
end
%Drug 3‐Zolpidem 30 mg
j=1;
while j<length(Drug3_windo)
if Drug3_windo(j)==1 % Awake cmax_aux=1;
au=j+1;
while au<=length(Drug3_windo) & Drug3_windo(au)==1
% While continuous in Awake au=au+1;
cmax_aux=cmax_aux+1;
end
j=au;
if Drug3_maxC(i,k)<cmax_aux
Drug3_maxC(i,k)=cmax_aux;
end
else
j=j+1;
end
end
k=k+1;
end
end
mean_Bas_maxC=mean(Bas_maxC);
mean_Vec_maxC=mean(Vec_maxC);
mean_Drug1_maxC=mean(Drug1_maxC);
mean_Drug2_maxC=mean(Drug2_maxC);
mean_Drug3_maxC=mean(Drug3_maxC);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PLOTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Xaxis=[4:15] Axis % plot x,y,ʹLineWidthʹ,2 Line sizes number 2
%ʹ‐‐ʹ Dashed line % ʹColorʹ,[0 0.60 0] Color Codices
Appendix 5
183
%%BASELINE VS VEHICLE
Xaxis=[4:15];
xlim([4,15]) % Limited of X axis
plot(Xaxis,mean_Bas_maxC,ʹ‐kʹ,ʹLineWidthʹ,2)
hold on % Plot mean of Baseline
plot(Xaxis,mean_Vec_maxC,ʹ‐bʹ,ʹLineWidthʹ,2)
hold on % Plot mean of Methylcellulose
plot(Xaxis,Bas_maxC,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 0],ʹMarkerSizeʹ,2)
hold on
plot(Xaxis,Vec_maxC,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 1],ʹMarkerSizeʹ,2)
%%BASELINE VS DRUGS
Xaxis=[4:15];
xlim([4,15]) % Limited of X axis
plot(Xaxis,mean_Bas_maxC,ʹ‐kʹ,ʹLineWidthʹ,2)
hold on % Plot mean of Baseline
plot(Xaxis,mean_Drug1_maxC,ʹ‐‐ʹ,ʹColorʹ,[1 0.800000011920929 0.800000011920929],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 1
plot(Xaxis,mean_Drug2_maxC,ʹ‐‐ʹ,ʹColorʹ,[0.400000005960464 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 2
plot(Xaxis,mean_Drug3_maxC,ʹ‐‐ʹ,ʹColorʹ,[1 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 3
plot(Xaxis,Bas_maxC,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 0],ʹMarkerSizeʹ,2)
hold on
plot(Xaxis,Drug1_maxC,ʹokʹ,ʹMarkerFaceColorʹ,[1 0.800000011920929 0.800000011920929] ,ʹMarkerSizeʹ,2)
hold on
plot(Xaxis,Drug2_maxC,ʹokʹ,ʹMarkerFaceColorʹ,[0.400000005960464 0 0],ʹMarkerSizeʹ,2)
hold on
plot(Xaxis,Drug3_maxC,ʹokʹ,ʹMarkerFaceColorʹ,[1 0 0],ʹMarkerSizeʹ,2)
hold on
Appendix 5
184
DESCRIPTORS OF SLEEP
4. MAXIMUM TIME CONSECUTIVE
4.2. NREM
%Load data set
%Rename of datasets
Bas_data=Name of dataset; % Baseline Dataset Vec_data=Name of dataset; % Methylcellulose Dataset
Drug1_data=Name of dataset; % Zolpidem 10 mg Dataset
Drug2_data=Name of dataset; % Zolpidem 20 mg Dataset
Drug3_data=Name of dataset; % Zolpidem 30 mg Dataset
%COLUMNS OF DATASET
%STD=ID STT=DV TIME EPOCH AWPV NRPV REPV AWK NREM REM
ListRatsBas=unique(Bas_data(:,1)); % Select the number of the ID for each rats.
ListRatsVec=unique(Vec_data(:,1));
ListRatsDrug1=unique(Drug1_data(:,1));
ListRatsDrug2=unique(Drug2_data(:,1));
ListRatsDrug3=unique(Drug3_data(:,1));
numObs=360; % 60min=3600sec, 360 observations per window.
studyTime=4320; % 12hrs=43200sec, 4320 observations in 12 hours.
Bas_maxC=zeros(length(ListRatsBas),4320/numObs);
Vec_maxC=zeros(length(ListRatsVec),4320/numObs);
Drug1_maxC=zeros(length(ListRatsDrug1),4320/numObs);
Drug2_maxC=zeros(length(ListRatsDrug2),4320/numObs);
Drug3_maxC=zeros(length(ListRatsDrug3),4320/numObs);
for i=1:length(ListRatsBas) % For each rata
% Load rat i
Bas_rat=Bas_data(find(Bas_data(:,1)==ListRatsBas(i)),:);
Vec_rat=Vec_data(find(Vec_data(:,1)==ListRatsVec (i)),:);
Drug1_rat= Drug1_data(find(Drug1_data(:,1)==ListRatsDrug1(i)),:);
Drug2_rat= Drug2_data(find(Drug2_data(:,1)==ListRatsDrug2(i)),:);
Drug3_rat= Drug3_data(find(Drug3_data(:,1)==ListRatsDrug3(i)),:);
Appendix 5
185
k=1; % Initialization k (K identifies the window)
for c=1:numObs:(4320‐numObs+1)
%Calculation of number of transitions for all groups
Bas_windo=Bas_rat(c:(c+360‐1),2);
Vec_windo=Vec_rat(c:(c+360‐1),2);
Drug1_windo=Drug1_rat(c:(c+360‐1),2);
Drug2_windo=Drug2_rat(c:(c+360‐1),2);
Drug3_windo=Drug3_rat(c:(c+360‐1),2);
%Baseline
j=1;
while j<length(Bas_windo)
if Bas_windo(j)==2 % NREM
cmax_aux=1;
au=j+1;
while au<=length(Bas_windo) & Bas_windo(au)==2
% While continuous in NREM au=au+1;
cmax_aux=cmax_aux+1;
end
j=au;
if Bas_maxC(i,k)<cmax_aux
Bas_maxC(i,k)=cmax_aux;
end
else
j=j+1;
end
end
%Vehicle‐Methylcellulose
j=1;
while j<length(Vec_windo)
if Vec_windo(j)==2 %NREM
cmax_aux=1;
au=j+1;
while au<=length(Vec_windo) & Vec_windo(au)==2
% While continuous in NREM au=au+1;
cmax_aux=cmax_aux+1;
end
j=au;
Appendix 5
186
if Vec_maxC(i,k)<cmax_aux
Vec_maxC(i,k)=cmax_aux;
end
else
j=j+1;
end
end
%Drug 1‐Zolpidem 10 mg
j=1;
while j<length(Drug1_windo)
if Drug1_windo(j)==2 %NREM
cmax_aux=1;
au=j+1;
while au<=length(Drug1_windo) & Drug1_windo(au)==2
% While continuous in NREM au=au+1;
cmax_aux=cmax_aux+1;
end
j=au;
if Drug1_maxC(i,k)<cmax_aux
Drug1_maxC(i,k)=cmax_aux;
end
else
j=j+1;
end
end
%Drug 2‐Zolpidem 20 mg
j=1;
while j<length(Drug2_windo)
if Drug2_windo(j)==2 %NREM
cmax_aux=1;
au=j+1;
while au<=length(Drug2_windo) & Drug2_windo(au)==2
% While continuous in NREM au=au+1;
cmax_aux=cmax_aux+1;
end
j=au;
if Drug2_maxC(i,k)<cmax_aux
Drug2_maxC(i,k)=cmax_aux;
end
else
Appendix 5
187
j=j+1;
end
end
%Drug 3‐Zolpidem 30 mg
j=1;
while j<length(Drug3_windo)
if Drug3_windo(j)==2 %NREM
cmax_aux=1;
au=j+1;
while au<=length(Drug3_windo) & Drug3_windo(au)==2
% While continuous in NREM au=au+1;
cmax_aux=cmax_aux+1;
end
j=au;
if Drug3_maxC(i,k)<cmax_aux
Drug3_maxC(i,k)=cmax_aux;
end
else
j=j+1;
end
end
k=k+1;
end
end
mean_Bas_maxC=mean(Bas_maxC);
mean_Vec_maxC=mean(Vec_maxC);
mean_Drug1_maxC=mean(Drug1_maxC);
mean_Drug2_maxC=mean(Drug2_maxC);
mean_Drug3_maxC=mean(Drug3_maxC);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PLOTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Xaxis=[4:15] Axis % plot x,y,ʹLineWidthʹ,2 Line sizes number 2
%ʹ‐‐ʹ Dashed line % ʹColorʹ,[0 0.60 0] Color Codices
%%BASELINE VS VEHICLE
Xaxis=[4:15];
Appendix 5
188
xlim([4,15]) % Limited of X axis
plot(Xaxis,mean_Bas_maxC,ʹ‐kʹ,ʹLineWidthʹ,2)
hold on % Plot mean of Baseline
plot(Xaxis,mean_Vec_maxC,ʹ‐bʹ,ʹLineWidthʹ,2)
hold on % Plot mean of Methylcellulose
plot(Xaxis,Bas_maxC, ʹokʹ,ʹMarkerFaceColorʹ,[0 0 0],ʹMarkerSizeʹ,2)
hold on
plot(Xaxis,Vec_maxC,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 1],ʹMarkerSizeʹ,2)
%%BASELINE VS DRUGS
Xaxis=[4:15];
xlim([4,15]) % Limited of X axis
plot(Xaxis,mean_Bas_maxC,ʹ‐kʹ,ʹLineWidthʹ,2)
hold on % Plot mean of Baseline
plot(Xaxis,mean_Drug1_maxC,ʹ‐‐ʹ,ʹColorʹ,[1 0.800000011920929 0.800000011920929],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 1
plot(Xaxis,mean_Drug2_maxC,ʹ‐‐ʹ,ʹColorʹ,[0.400000005960464 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 2
plot(Xaxis,mean_Drug3_maxC,ʹ‐‐ʹ,ʹColorʹ,[1 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 3
plot(Xaxis,Bas_maxC,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 0],ʹMarkerSizeʹ,2)
hold on
plot(Xaxis,Drug1_maxC,ʹokʹ,ʹMarkerFaceColorʹ,[1 0.800000011920929 0.800000011920929] ,ʹMarkerSizeʹ,2)
hold on
plot(Xaxis,Drug2_maxC,ʹokʹ,ʹMarkerFaceColorʹ,[0.400000005960464 0 0],ʹMarkerSizeʹ,2)
hold on
plot(Xaxis,Drug3_maxC,ʹokʹ,ʹMarkerFaceColorʹ,[1 0 0],ʹMarkerSizeʹ,2)
hold on
Appendix 5
189
DESCRIPTORS OF SLEEP
4. MAXIMUM TIME CONSECUTIVE
4.3. REM
%Load data set
%Rename of datasets
Bas_data=Name of dataset; % Baseline Dataset Vec_data=Name of dataset; % Methylcellulose Dataset
Drug1_data=Name of dataset; % Zolpidem 10 mg Dataset
Drug2_data=Name of dataset; % Zolpidem 20 mg Dataset
Drug3_data=Name of dataset; % Zolpidem 30 mg Dataset
%COLUMNS OF DATASET
%STD=ID STT=DV TIME EPOCH AWPV NRPV REPV AWK NREM REM
ListRatsBas=unique(Bas_data(:,1)); % Select the number of the ID for each rats.
ListRatsVec=unique(Vec_data(:,1));
ListRatsDrug1=unique(Drug1_data(:,1));
ListRatsDrug2=unique(Drug2_data(:,1));
ListRatsDrug3=unique(Drug3_data(:,1));
numObs=360; % 60min=3600sec, 360 observations per window.
studyTime=4320; % 12hrs=43200sec, 4320 observations in 12 hours.
Bas_maxC=zeros(length(ListRatsBas),4320/numObs);
Vec_maxC=zeros(length(ListRatsVec),4320/numObs);
Drug1_maxC=zeros(length(ListRatsDrug1),4320/numObs);
Drug2_maxC=zeros(length(ListRatsDrug2),4320/numObs);
Drug3_maxC=zeros(length(ListRatsDrug3),4320/numObs);
for i=1:length(ListRatsBas) % For each rata
% Load rat i
Bas_rat=Bas_data(find(Bas_data(:,1)==ListRatsBas(i)),:);
Vec_rat=Vec_data(find(Vec_data(:,1)==ListRatsVec(i)),:);
Drug1_rat= Drug1_data(find(Drug1_data(:,1)==ListRatsDrug1(i)),:);
Drug2_rat= Drug2_data(find(Drug2_data(:,1)==ListRatsDrug2(i)),:);
Drug3_rat= Drug3_data(find(Drug3_data(:,1)==ListRatsDrug3(i)),:);
Appendix 5
190
k=1; % Initialization k (K identifies the window)
for c=1:numObs:(4320‐numObs+1)
%Calculation of number of transitions for all groups
Bas_windo=Bas_rat(c:(c+360‐1),2);
Vec_windo=Vec_rat(c:(c+360‐1),2);
Drug1_windo=Drug1_rat(c:(c+360‐1),2);
Drug2_windo=Drug2_rat(c:(c+360‐1),2);
Drug3_windo=Drug3_rat(c:(c+360‐1),2);
%Baseline
j=1;
while j<length(Bas_windo)
if Bas_windo(j)==3 %REM
cmax_aux=1;
au=j+1;
while au<=length(Bas_windo) & Bas_windo(au)==3
% While continuous in REM
au=au+1;
cmax_aux=cmax_aux+1;
end
j=au;
if Bas_maxC(i,k)<cmax_aux
Bas_maxC(i,k)=cmax_aux;
end
else
j=j+1;
end
end
%Vehicle‐Methylcellulose
j=1;
while j<length(Vec_windo)
if Vec_windo(j)==3 %REM
cmax_aux=1;
au=j+1;
while au<=length(Vec_windo) & Vec_windo(au)==3
% While continuous in REM
au=au+1;
cmax_aux=cmax_aux+1;
end
Appendix 5
191
j=au;
if Vec_maxC(i,k)<cmax_aux
Vec_maxC(i,k)=cmax_aux;
end
else
j=j+1;
end
end
%Drug 1‐ Zolpidem 10 mg
j=1;
while j<length(Drug1_windo)
if Drug1_windo(j)==3 %REM
cmax_aux=1;
au=j+1;
while au<=length(Drug1_windo) & Drug1_windo(au)==3
% While continuous in REM
au=au+1;
cmax_aux=cmax_aux+1;
end
j=au;
if Drug1_maxC(i,k)<cmax_aux
Drug1_maxC(i,k)=cmax_aux;
end
else
j=j+1;
end
end
%Drug 2‐ Zolpidem 20 mg
j=1;
while j<length(Drug2_windo)
if Drug2_windo(j)==3 %REM
cmax_aux=1;
au=j+1;
while au<=length(Drug2_windo) & Drug2_windo(au)==3
% While continuous in REM
au=au+1;
cmax_aux=cmax_aux+1;
end
j=au;
if Drug2_maxC(i,k)<cmax_aux
Drug2_maxC(i,k)=cmax_aux;
end
Appendix 5
192
else
j=j+1;
end
end
%Drug 3‐ Zolpidem 30 mg
j=1;
while j<length(Drug3_windo)
if Drug3_windo(j)==3 %REM
cmax_aux=1;
au=j+1;
while au<=length(Drug3_windo) & Drug3_windo(au)==3
% While continuous in REM
au=au+1;
cmax_aux=cmax_aux+1;
end
j=au;
if Drug3_maxC(i,k)<cmax_aux
Drug3_maxC(i,k)=cmax_aux;
end
else
j=j+1;
end
end
k=k+1;
end
end
mean_Bas_maxC=mean(Bas_maxC);
mean_Vec_maxC=mean(Vec_maxC);
mean_Drug1_maxC=mean(Drug1_maxC);
mean_Drug2_maxC=mean(Drug2_maxC);
mean_Drug3_maxC=mean(Drug3_maxC);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PLOTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Xaxis=[4:15] Axis % plot x,y,ʹLineWidthʹ,2 Line sizes number 2
%ʹ‐‐ʹ Dashed line % ʹColorʹ,[0 0.60 0] Color Codices
Appendix 5
193
%%BASELINE VS VEHICLE
Xaxis=[4:15];
xlim([4,15]) % Limited of X axis
plot(Xaxis,mean_Bas_maxC,ʹ‐kʹ,ʹLineWidthʹ,2)
hold on % Plot mean of Baseline
plot(Xaxis,mean_Vec_maxC,ʹ‐bʹ,ʹLineWidthʹ,2)
hold on % Plot mean of Methylcellulose
plot(Xaxis,Bas_maxC, ʹokʹ,ʹMarkerFaceColorʹ,[0 0 0],ʹMarkerSizeʹ,2)
hold on
plot(Xaxis,Vec_maxC,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 1],ʹMarkerSizeʹ,2)
%%BASELINE VS DRUGS
Xaxis=[4:15];
xlim([4,15]) % Limited of X axis
plot(Xaxis,mean_Bas_maxC,ʹ‐kʹ,ʹLineWidthʹ,2)
hold on % Plot mean of Baseline
plot(Xaxis,mean_Drug1_maxC,ʹ‐‐ʹ,ʹColorʹ,[1 0.800000011920929 0.800000011920929],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 1
plot(Xaxis,mean_Drug2_maxC,ʹ‐‐ʹ,ʹColorʹ,[0.400000005960464 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 2
plot(Xaxis,mean_Drug3_maxC,ʹ‐‐ʹ,ʹColorʹ,[1 0 0],ʹLineWidthʹ,2)
hold on % Plot mean of Drug 3
plot(Xaxis,Bas_maxC,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 0],ʹMarkerSizeʹ,2)
hold on
plot(Xaxis,Drug1_maxC,ʹokʹ,ʹMarkerFaceColorʹ,[1 0.800000011920929 0.800000011920929] ,ʹMarkerSizeʹ,2)
hold on
plot(Xaxis,Drug2_maxC,ʹokʹ,ʹMarkerFaceColorʹ,[0.400000005960464 0 0],ʹMarkerSizeʹ,2)
hold on
plot(Xaxis,Drug3_maxC,ʹokʹ,ʹMarkerFaceColorʹ,[1 0 0],ʹMarkerSizeʹ,2)
hold on
Appendix 6
194
APPENDIX 6
SCRIPTS: VISUAL PREDICTIVE CHECK
1. PERCENTAGE OF SLEEP STAGE
‐ Drug Simulated data
%Load data set
%Rename of dataset
Zol_simulated=Name of simulated dataset(:,[1 2 3 4 5]);
% Drug simulated dataset (selected only 5 columns)
Zol_simulated=Name of simulated dataset(find(Zol_simulated(:,2)==1),[1 3 4 5]);
% Selected only 4 columns
%COLUMNS OF DATASET
%NSIM ID EPOC DV PDV PSDV APAW APNR NPAW NPNR NPRE RPAW RPNR RPRE CP
%NSIM(1) EPOC(3) DV(4) PDV(5)
ListRatsZol=unique(Zol_simulated(:,1));
% Select the number of the ID for each rats.
numObs=360; % 60min=3600sec, 360 observations per window.
studyTime=4320; % 12hrs=43200sec, 4320 observations in 12 hours.
for i=1:length(ListRatsZol) % For each rata
% Load rat i
Zol_rat= Zol_simulated(find(Zol_simulated(:,1)==ListRatsZol(i)),:);
% Initialization k (K identifies the window)
k=1;
for c=1:numObs:(4320‐numObs+1)
%Load the states of the corresponding window of the animal i
Zol_windo= Zol_rat (c:(c+360‐1),3);
Zol_perc1(i,k)=numel(find(Zol_windo==1))*100/numObs;
Zol_perc2(i,k)=numel(find(Zol_windo==2))*100/numObs;
Zol_perc3(i,k)=numel(find(Zol_windo==3))*100/numObs;
k=k+1;
end
Appendix 6
195
end
Zol_prctile1=prctile(Zol_perc1,[2.5 50 97.5]);
Zol_prctile2=prctile(Zol_perc2,[2.5 50 97.5]);
Zol_prctile3=prctile(Zol_perc3,[2.5 50 97.5]);
‐ Drug Observed data
%Load data set
%Rename of datasets
Zol_Obs=Name of dataset; % Drug Dataset
%COLUMNS OF DATASET
%STD=ID STT=DV TIME EPOCH AWPV NRPV REPV AWK NREM REM
ListRatsZol=unique(Zol_Obs(:,1)); % Select the number of the ID for each rats.
numObs=360; % 60min=3600sec, 360 observations per window.
studyTime=4320; % 12hrs=43200sec, 4320 observations in 12 hours.
for i=1:length(ListRatsZol)
Zol_rat_Obs=Zol_data(find(Zol_Obs (:,1)==ListRatsZol(i)),:);
k=1;
for c=1:numObs:(4320‐numObs+1)
Zol_windo_Obs= Zol_rat_Obs(c:(c+360‐1),2);
Zol_perc1_Obs(i,k)=numel(find(Zol_windo_Obs==1))*100/numObs;
Zol_perc2_Obs(i,k)=numel(find(Zol_windo_Obs==2))*100/numObs;
Zol_perc3_Obs(i,k)=numel(find(Zol_windo_Obs==3))*100/numObs;
k=k+1;
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PLOTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Xaxis=[4:16] Axis % plot x,y,ʹLineWidthʹ,2 Line sizes number 2
%ʹ‐‐ʹ Dashed line % ʹColorʹ,[0 0.60 0] Color Codices
Appendix 6
196
% Percentage of AWAKE
subplot(3,1,1) % 3 indicated the number of row, 1 indicated the number
of columns and 1indicated the position of plot.
Xaxis=[4,16];
ylim([0,100]) % Limited of y axis
xlim([4,15]) % Limited of X axis
plot(Xaxis, Zol_prctile1,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
hold on % Percentiles of Simulated data
plot(Xaxis, Zol_perc1_Obs,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 1],ʹMarkerSizeʹ,2)
hold on % Observation data of % AWAKE
plot(Xaxis,median(Zol_perc1_Obs),ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
% Median of observed data
% Percentage of NREM
subplot(3,1,2) % Second plot, position 2. Xaxis=[4,16];
ylim([0,100]) % Limited of y axis
xlim([4,15]) % Limited of x axis
plot(Xaxis, Zol_prctile2, ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
hold on % Percentiles of Simulated data
plot(Xaxis, Zol_perc2_Obs,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 1],ʹMarkerSizeʹ,2)
hold on % Observation data of % NREM
plot(Xaxis,median(Zol_perc2_Obs),ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
% Median of observed data
% Percentage of REM
subplot(3,1,3) % Third plot, position 3. Xaxis=[4,16];
ylim([0,100]) % Limited of y axis
xlim([4,15]) % Limited of y axis
plot(Xaxis, Zol_prctile3,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
hold on % Percentiles of Simulated data
plot(Xaxis, Zol_perc3_Obs,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 1],ʹMarkerSizeʹ,2)
hold on % Observation data of % NREM
plot(Xaxis,median(Zol_perc3_Obs),ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
% Median of observed data
Appendix 6
197
VISUAL PREDICTIVE CHECK
2. TRANSITIONS PROBABILITIES
‐ Drugs Simulated data from AWAKE
%Load data set
%Rename of dataset
Zol_simulated=Name of simulated dataset(:,[1 2 3 4 5]);
% Drug simulated dataset (selected only 5 columns)
Zol_simulated=Name of simulated dataset(find(Zol_simulated(:,2)==1),[1 3 4 5]);
% Selected only 4 columns
%COLUMNS OF DATASET
%NSIM ID EPOC DV PDV PSDV APAW APNR NPAW NPNR NPRE RPAW RPNR RPRE CP
%NSIM(1) EPOC(3) DV(4) PDV(5)
ListRatsZol=unique(Zol_simulated(:,1));
% Select the number of the ID for each rats.
numObs=360; % 60min=3600sec, 360 observations per window.
studyTime=4320; % 12hrs=43200sec, 4320 observations in 12 hours.
%%%Initialization of Baseline
Zol_numelAWtoAW=zeros(length(ListRatsZol),4320/numObs);
Zol_numelAWtoNR=zeros(length(ListRatsZol),4320/numObs);
Zol_numelAWtoRE=zeros(length(ListRatsZol),4320/numObs);
% Transitions probabilities
for i=1:length(ListRatsZol) % For each rata
% Load rat i
Zol_rat=Zol_simulated (find(Zol_simulated(:,1)==ListRatsZol(i)),:);
k=1; % Initialization k (K identifies the window)
for c=1:numObs:(4320‐numObs+1)
% If the window have 360 observations4320/360=12 window
% Calculation of number of transitions
Zol_windo=Zol_rat(c:(c+360‐1),3);
Appendix 6
198
Zol_numelAWAKE=numel(find(Zol_windo==1));
for j=1:numObs‐1
if Zol_windo(j)==1
if Zol_windo(j+1)==1
Zol_numelAWtoAW(i,k)=nansum([Zol_numelAWtoAW(i,k) 1],2);
elseif Zol_windo(j+1)==2
Zol_numelAWtoNR(i,k)=nansum([Zol_numelAWtoNR(i,k) 1],2);
elseif Zol_windo(j+1)==3
Zol_numelAWtoRE(i,k)= nansum([Zol_numelAWtoRE(i,k) 1],2);
end
end
end
Zol_prob_fromAWtoAW(i,k)=Zol_numelAWtoAW(i,k)/Zol_numelAWAKE;
Zol_prob_fromAWtoNR(i,k)=Zol_numelAWtoNR(i,k)/Zol_numelAWAKE;
Zol_prob_fromAWtoRE(i,k)=Zol_numelAWtoRE(i,k)/Zol_numelAWAKE;
k=k+1;
end
end
median_Zol_prob_fromAWtoAW=nanmedian(Zol_prob_fromAWtoAW);
median_Zol_prob_fromAWtoNR=nanmedian(Zol_prob_fromAWtoNR);
median_Zol_prob_fromAWtoRE=nanmedian(Zol_prob_fromAWtoRE);
pp1=median_Zol_prob_fromAWtoAW+median_Zol_prob_fromAWtoNR+median_Zol_prob_fromAWtoRE
prctile_Zol_prob_fromAWtoAW=prctile(Zol_prob_fromAWtoAW,[5 50 95]);
prctile_Zol_prob_fromAWtoNR=prctile(Zol_prob_fromAWtoNR,[5 50 95]);
prctile_Zol_prob_fromAWtoRE=prctile(Zol_prob_fromAWtoRE,[5 50 95]);
‐ Drugs Observed data from AWAKE
%Load data set
%Rename of datasets
Zol_Obs =Name of dataset; % Drug Dataset
%COLUMNS OF DATASET
%STD=ID STT=DV TIME EPOCH AWPV NRPV REPV AWK NREM REM
ListRatsZol=unique(Zol_Obs(:,1)); % Select the number of the ID for each rats.
numObs=360; % 60min=3600sec, 360 observations per window.
studyTime=4320; % 12hrs=43200sec, 4320 observations in 12 hours.
Appendix 6
199
%%%Initialization of Baseline
Zol_numelAWtoAW_Obs=zeros(length(ListRatsZol),4320/numObs);
Zol_numelAWtoNR_Obs=zeros(length(ListRatsZol),4320/numObs);
Zol_numelAWtoRE_Obs=zeros(length(ListRatsZol),4320/numObs);
% Transitions probabilities
for i=1:length(ListRatsZol) % For each rata
% Load rat i
Zol_rat_Obs=Zol_Obs (find(Zol_Obs (:,1)==ListRatsZol(i)),:);
% Initialization k (K identifies the window)
k=1;
for c=1:numObs:(4320‐numObs+1)
% If the window have 360 observations4320/360=12 window
Zol_windo_Obs=Zol_rat_Obs(c:(c+360‐1),2);
Zol_numelAWAKE_Obs=numel(find(Zol_windo_Obs==1));
for j=1:numObs‐1
if Zol_windo_Obs(j)==1
if Zol_windo_Obs(j+1)==1
Zol_numelAWtoAW_Obs(i,k)=nansum([Zol_numelAWtoAW_Obs(i,k) 1],2);
elseif Zol_windo_Obs(j+1)==2
Zol_numelAWtoNR_Obs(i,k)=nansum([Zol_numelAWtoNR_Obs(i,k) 1],2);
elseif Zol_windo_Obs(j+1)==3
Zol_numelAWtoRE_Obs(i,k)= nansum([Zol_numelAWtoRE_Obs(i,k) 1],2);
end
end
end
Zol_prob_fromAWtoAW_Obs(i,k)=Zol_numelAWtoAW_Obs(i,k)/Zol_numelAWAKE_Obs;
Zol_prob_fromAWtoNR_Obs(i,k)=Zol_numelAWtoNR_Obs(i,k)/Zol_numelAWAKE_Obs;
Zol_prob_fromAWtoRE_Obs(i,k)=Zol_numelAWtoRE_Obs(i,k)/Zol_numelAWAKE_Obs;
k=k+1;
end
end
median_Zol_prob_fromAWtoAW_Obs=nanmedian(Zol_prob_fromAWtoAW_Obs);
median_Zol_prob_fromAWtoNR_Obs=nanmedian(Zol_prob_fromAWtoNR_Obs);
median_Zol_prob_fromAWtoRE_Obs=nanmedian(Zol_prob_fromAWtoRE_Obs);
pp1=median_Zol_prob_fromAWtoAW_Obs+median_Zol_prob_fromAWtoNR_Obs+median_Zol_prob_from
AWtoRE_Obs
Appendix 6
200
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PLOTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Xaxis=[4:16] Axis % plot x,y,ʹLineWidthʹ,2 Line sizes number 2
%ʹ‐‐ʹ Dashed line % ʹColorʹ,[0 0.60 0] Color Codices
subplot(3,3,1) % 3 indicated the number of row, 3 indicated the number
of columns and 1 indicated the position of plot.
Xaxis=[4,16];
ylim([0,1]) % Limited of y axis
xlim([4,15]) % Limited of X axis
plot(Xaxis,median_Zol_prob_fromAWtoAW_Obs,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
hold on % Median of observed data, TP AW‐AW
plot(Xaxis,Zol_prob_fromAWtoAW_Obs,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 1],ʹMarkerSizeʹ,2)
hold on % Observed data, TP AW‐AW
plot(Xaxis,prctile_Zol_prob_fromAWtoAW,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
% Percentile of simulated data, TP AW‐AW
subplot(3,3,2) % Second plot, position 2. Xaxis=[4,16];
ylim([0,1]) % Limited of y axis
xlim([4,15]) % Limited of X axis
plot(Xaxis,median_Zol_prob_fromAWtoNR_Obs,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
hold on % Median of observed data, TP AW‐NR
plot(Xaxis,Zol_prob_fromAWtoNR_Obs,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 1],ʹMarkerSizeʹ,2)
hold on % Observed data, TP AW‐NR
plot(Xaxis,prctile_Zol_prob_fromAWtoNR,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
% Percentile of simulated data, TP AW‐NR
subplot(3,3,3) % Third plot, position 3. Xaxis=[4,16];
ylim([0,1]) % Limited of y axis
xlim([4,15]) % Limited of X axis
plot(Xaxis,median_Zol_prob_fromAWtoRE_Obs,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
hold on % Median of observed data, TP AW‐RE
Appendix 6
201
plot(Xaxis,Zol_prob_fromAWtoRE_Obs,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 1],ʹMarkerSizeʹ,2)
hold on % Observed data, TP AW‐RE
plot(Xaxis,prctile_Zol_prob_fromAWtoRE,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
% Percentile of simulated data, TP AW‐RE
Appendix 6
202
2. TRANSITIONS PROBABILITIES
‐ Drugs Simulated data from NREM
%Load data set
%Rename of dataset
Zol_simulated=Name of simulated dataset(:,[1 2 3 4 5]);
% Drug simulated dataset (selected only 5 columns)
Zol_simulated=Name of simulated dataset(find(Zol_simulated(:,2)==1),[1 3 4 5]);
% Selected only 4 columns
%COLUMNS OF DATASET
%NSIM ID EPOC DV PDV PSDV APAW APNR NPAW NPNR NPRE RPAW RPNR RPRE CP
%NSIM(1) EPOC(3) DV(4) PDV(5)
ListRatsZol=unique(Zol_simulated(:,1));
% Select the number of the ID for each rats.
numObs=360; % 60min=3600sec, 360 observations per window.
studyTime=4320; % 12hrs=43200sec, 4320 observations in 12 hours.
%%%Initialization of Baseline
Zol_numelNRtoAW=zeros(length(ListRatsZol),4320/numObs);
Zol_numelNRtoNR=zeros(length(ListRatsZol),4320/numObs);
Zol_numelNRtoRE=zeros(length(ListRatsZol),4320/numObs);
% Transitions probabilities
for i=1:length(ListRatsZol) % For each rata
% Load rat i
Zol_rat=Zol_simulated (find(Zol_simulated(:,1)==ListRatsZol(i)),:);
k=1; % Initialization k (K identifies the window)
for c=1:numObs:(4320‐numObs+1)
% If the window have 360 observations4320/360=12 window
% Calculation of number of transitions
Zol_windo=Zol_rat(c:(c+360‐1),3);
Zol_numelNREM=numel(find(Zol_windo==2));
Appendix 6
203
for j=1:numObs‐1
if Zol_windo(j)==2
if Zol_windo(j+1)==1
Zol_numelNRtoAW(i,k)=nansum([Zol_numelNRtoAW(i,k) 1],2);
elseif Zol_windo(j+1)==2
Zol_numelNRtoNR(i,k)=nansum([Zol_numelNRtoNR(i,k) 1],2);
elseif Zol_windo(j+1)==3
Zol_numelNRtoRE(i,k)=nansum([Zol_numelNRtoRE(i,k) 1],2);
end
end
end
Zol_prob_fromNRtoAW(i,k)=Zol_numelNRtoAW(i,k)/Zol_numelNREM;
Zol_prob_fromNRtoNR(i,k)=Zol_numelNRtoNR(i,k)/Zol_numelNREM;
Zol_prob_fromNRtoRE(i,k)=Zol_numelNRtoRE(i,k)/Zol_numelNREM;
k=k+1;
end
end
median_Zol_prob_fromNRtoAW=nanmedian(Zol_prob_fromNRtoAW);
median_Zol_prob_fromNRtoNR=nanmedian(Zol_prob_fromNRtoNR);
median_Zol_prob_fromNRtoRE=nanmedian(Zol_prob_fromNRtoRE);
pp1=median_Zol_prob_fromNRtoAW+median_Zol_prob_fromNRtoNR+median_Zol_prob_fromNRtoRE
prctile_Zol_prob_fromNRtoAW=prctile(Zol_prob_fromNRtoAW,[5 50 95]);
prctile_Zol_prob_fromNRtoNR=prctile(Zol_prob_fromNRtoNR,[5 50 95]);
prctile_Zol_prob_fromNRtoRE=prctile(Zol_prob_fromNRtoRE,[5 50 95]);
‐ Drugs Observed data from NREM
%Load data set
%Rename of datasets
Zol_Obs =Name of dataset; % Drug Dataset
%COLUMNS OF DATASET
%STD=ID STT=DV TIME EPOCH AWPV NRPV REPV AWK NREM REM
ListRatsZol=unique(Zol_Obs(:,1)); % Select the number of the ID for each rats.
numObs=360; % 60min=3600sec, 360 observations per window.
studyTime=4320; % 12hrs=43200sec, 4320 observations in 12 hours.
Appendix 6
204
%%%Initialization of Baseline
Zol_numelAWtoAW_Obs=zeros(length(ListRatsZol),4320/numObs);
Zol_numelAWtoNR_Obs=zeros(length(ListRatsZol),4320/numObs);
Zol_numelAWtoRE_Obs=zeros(length(ListRatsZol),4320/numObs);
% Transitions probabilities
for i=1:length(ListRatsZol) % For each rata
% Load rat i
Zol_rat_Obs=Zol_Obs (find(Zol_Obs (:,1)==ListRatsZol(i)),:);
k=1; % Initialization k (K identifies the window)
for c=1:numObs:(4320‐numObs+1)
% If the window have 360 observations4320/360=12 window
% Calculation of Number of Transitions
Zol_windo_Obs=Zol_rat_Obs(c:(c+360‐1),2);
Zol_numelNREM_Obs=numel(find(Zol_windo_Obs==2));
for j=1:numObs‐1
if Zol_windo_Obs(j)==2
if Zol_windo_Obs(j+1)==1
Zol_numelNRtoAW_Obs(i,k)=nansum([Zol_numelNRtoAW_Obs(i,k) 1],2);
elseif Zol_windo_Obs(j+1)==2
Zol_numelNRtoNR_Obs(i,k)=nansum([Zol_numelNRtoNR_Obs(i,k) 1],2);
elseif Zol_windo_Obs(j+1)==3
Zol_numelNRtoRE_Obs(i,k)= nansum([Zol_numelNRtoRE_Obs(i,k) 1],2);
end
end
end
Zol_prob_fromNRtoAW_Obs(i,k)=Zol_numelNRtoAW_Obs(i,k)/Zol_numelNREM_Obs;
Zol_prob_fromNRtoNR_Obs(i,k)=Zol_numelNRtoNR_Obs(i,k)/Zol_numelNREM_Obs;
Zol_prob_fromNRtoRE_Obs(i,k)=Zol_numelNRtoRE_Obs(i,k)/Zol_numelNREM_Obs;
k=k+1;
end
end
median_Zol_prob_fromNRtoAW_Obs=nanmedian(Zol_prob_fromNRtoAW_Obs);
median_Zol_prob_fromNRtoNR_Obs=nanmedian(Zol_prob_fromNRtoNR_Obs)
median_Zol_prob_fromNRtoRE_Obs=nanmedian(Zol_prob_fromNRtoRE_Obs);
Appendix 6
205
pp1=median_Zol_prob_fromNRtoAW_Obs+median_Zol_prob_fromNRtoNR_Obs+median_Zol_prob_from
NRtoRE_Obs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PLOTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Xaxis=[4:16] Axis % plot x,y,ʹLineWidthʹ,2 Line sizes number 2
%ʹ‐‐ʹ Dashed line % ʹColorʹ,[0 0.60 0] Color Codices
subplot(3,3,4) % 3 indicated the number of row, 3 indicated the number
of columns and 4 indicated the position of plot.
Xaxis=[4,16];
ylim([0,1]) % Limited of y axis
xlim([4,15]) % Limited of X axis
plot(Xaxis,median_Zol_prob_fromNRtoAW_Obs,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
hold on % Median of observed data, TP NR‐AW
plot(Xaxis,Zol_prob_fromNRtoAW_Obs,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 1],ʹMarkerSizeʹ,2)
hold on % Observed data, TP NR‐AW
plot(Xaxis,prctile_Zol_prob_fromNRtoAW,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
% Percentile of simulated data, TP NR‐AW
subplot(3,3,5) % Fifth plot, position 5. Xaxis=[4,16];
ylim([0,1]) % Limited of y axis
xlim([4,15]) % Limited of X axis
plot(Xaxis,median_Zol_prob_fromNRtoNR_Obs,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
hold on % Median of observed data, TP NR‐NR
plot(Xaxis,Zol_prob_fromNRtoNR_Obs,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 1],ʹMarkerSizeʹ,2)
hold on % Observed data, TP NR‐NR
plot(Xaxis,prctile_Zol_prob_fromNRtoNR, ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
% Percentile of simulated data, TP NR‐NR
subplot(3,3,6) % Sixth plot, position 2. Xaxis=[4,16];
ylim([0,1]) % Limited of y axis
Appendix 6
206
xlim([4,15]) % Limited of X axis
plot(Xaxis,median_Zol_prob_fromNRtoRE_Obs,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
hold on % Median of observed data, TP NR‐RE
plot(Xaxis,Zol_prob_fromNRtoRE_Obs,ʹokʹ,ʹMarkerFaceColorʹ,[0 0 1],ʹMarkerSizeʹ,2)
hold on % Observed data, TP NR‐RE
plot(Xaxis,prctile_Zol_prob_fromNRtoRE,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
% Percentile of simulated data, TP NR‐RE
Appendix 6
207
2. TRANSITIONS PROBABILITIES
‐ Drugs Simulated data from REM
%Load data set
%Rename of dataset
Zol_simulated=Name of simulated dataset(:,[1 2 3 4 5]);
% Drug simulated dataset (selected only 5 columns)
Zol_simulated=Name of simulated dataset(find(Zol_simulated(:,2)==1),[1 3 4 5]);
% Selected only 4 columns
%COLUMNS OF DATASET
%NSIM ID EPOC DV PDV PSDV APAW APNR NPAW NPNR NPRE RPAW RPNR RPRE CP
%NSIM(1) EPOC(3) DV(4) PDV(5)
ListRatsZol=unique(Zol_simulated(:,1));
% Select the number of the ID for each rats.
numObs=360; % 60min=3600sec, 360 observations per window.
studyTime=4320; % 12hrs=43200sec, 4320 observations in 12 hours.
%%%Initialization of Baseline
Zol_numelREtoAW=zeros(length(ListRatsZol),4320/numObs);
Zol_numelREtoNR=zeros(length(ListRatsZol),4320/numObs);
Zol_numelREtoRE=zeros(length(ListRatsZol),4320/numObs);
% Transitions probabilities
for i=1:length(ListRatsZol) % For each rata
% Load rat i
Zol_rat=Zol_simulated (find(Zol_simulated(:,1)==ListRatsZol(i)),:);
k=1; % Initialization k (K identifies the window)
for c=1:numObs:(4320‐numObs+1)
% If the window have 360 observations4320/360=12 window
% Calculation of number of transitions
Zol_windo=Zol_rat(c:(c+360‐1),3);
Zol_numelREM=numel(find(Zol_windo==3));
Appendix 6
208
for j=1:numObs‐1
if Zol_windo(j)==3
if Zol_windo(j+1)==1
Zol_numelREtoAW(i,k)=nansum([Zol_numelREtoAW(i,k) 1],2);
elseif Zol_windo(j+1)==2
Zol_numelREtoNR(i,k)=nansum([Zol_numelREtoNR(i,k) 1],2);
elseif Zol_windo(j+1)==3
Zol_numelREtoRE(i,k)= nansum([Zol_numelREtoRE(i,k) 1],2);
end
end
end
Zol_prob_fromREtoAW(i,k)=Zol_numelREtoAW(i,k)/Zol_numelREM;
Zol_prob_fromREtoNR(i,k)=Zol_numelREtoNR(i,k)/Zol_numelREM;
Zol_prob_fromREtoRE(i,k)=Zol_numelREtoRE(i,k)/Zol_numelREM;
k=k+1;
end
end
median_Zol_prob_fromREtoAW=nanmedian(Zol_prob_fromREtoAW);
median_Zol_prob_fromREtoNR=nanmedian(Zol_prob_fromREtoNR);
median_Zol_prob_fromREtoRE=nanmedian(Zol_prob_fromREtoRE);
pp1=median_Zol_prob_fromREtoAW+median_Zol_prob_fromREtoNR+median_Zol_prob_fromREtoRE
prctile_Zol_prob_fromREtoAW=prctile(Zol_prob_fromREtoAW,[5 50 95]);
prctile_Zol_prob_fromREtoNR=prctile(Zol_prob_fromREtoNR,[5 50 95]);
prctile_Zol_prob_fromREtoRE=prctile(Zol_prob_fromREtoRE,[5 50 95]);
‐ Drugs Observed data from REM
%Load data set
%Rename of datasets
Zol_Obs =Name of dataset; % Drug Dataset
%COLUMNS OF DATASET
%STD=ID STT=DV TIME EPOCH AWPV NRPV REPV AWK NREM REM
ListRatsZol=unique(Zol_Obs(:,1)); % Select the number of the ID for each rats.
numObs=360; % 60min=3600sec, 360 observations per window.
studyTime=4320; % 12hrs=43200sec, 4320 observations in 12 hours.
%%%Initialization of Baseline
Zol_numelREtoAW_Obs=zeros(length(ListRatsZol),4320/numObs);
Appendix 6
209
Zol_numelREtoNR_Obs=zeros(length(ListRatsZol),4320/numObs);
Zol_numelREtoRE_Obs=zeros(length(ListRatsZol),4320/numObs);
% Transitions probabilities
for i=1:length(ListRatsZol) % For each rata
% Load rat i
Zol_rat_Obs=Zol_Obs (find(Zol_Obs (:,1)==ListRatsZol(i)),:);
% Initialization k (K identifies the window)
k=1;
for c=1:numObs:(4320‐numObs+1)
% If the window have 360 observations4320/360=12 window
% Calculation of Number of Transitions
Zol_windo_Obs=Zol_rat_Obs(c:(c+360‐1),2);
Zol_numelREM_Obs=numel(find(Zol_windo_Obs==3));
for j=1:numObs‐1
if Zol_windo_Obs(j)==3
if Zol_windo_Obs(j+1)==1
Zol_numelREtoAW_Obs(i,k)=nansum([Zol_numelREtoAW_Obs(i,k) 1],2);
elseif Zol_windo_Obs(j+1)==2
Zol_numelREtoNR_Obs(i,k)=nansum([Zol_numelREtoNR_Obs(i,k) 1],2);
elseif Zol_windo_Obs(j+1)==3
Zol_numelREtoRE_Obs(i,k)= nansum([Zol_numelREtoRE_Obs(i,k) 1],2);
end
end
end
Zol_prob_fromREtoAW_Obs(i,k)=Zol_numelREtoAW_Obs(i,k)/Zol_numelREM_Obs;
Zol_prob_fromREtoNR_Obs(i,k)=Zol_numelREtoNR_Obs(i,k)/Zol_numelREM_Obs;
Zol_prob_fromREtoRE_Obs(i,k)=Zol_numelREtoRE_Obs(i,k)/Zol_numelREM_Obs;
k=k+1;
end
end
median_Zol_prob_fromREtoAW_Obs=nanmedian(Zol_prob_fromREtoAW_Obs);
median_Zol_prob_fromREtoNR_Obs=nanmedian(Zol_prob_fromREtoNR_Obs);
median_Zol_prob_fromREtoRE_Obs=nanmedian(Zol_prob_fromREtoRE_Obs);
pp1=median_Zol_prob_fromREtoAW_Obs+median_Zol_prob_fromREtoNR_Obs+median_Zol_prob_fromR
EtoRE_Obs
Appendix 6
210
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PLOTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Xaxis=[4:16] Axis % plot x,y,ʹLineWidthʹ,2 Line sizes number 2
%ʹ‐‐ʹ Dashed line % ʹColorʹ,[0 0.60 0] Color Codices
subplot(3,3,7) % 3 indicated the number of row, 3 indicated the number
of columns and 7 indicated the position of plot.
Xaxis=[4,16];
ylim([0,1]) % Limited of y axis
xlim([4,15]) % Limited of X axis
plot(Xaxis,median_Zol_prob_fromREtoAW_Obs,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
hold on % Median of observed data, TP RE‐AW
plot(Xaxis,Zol_prob_fromREtoAW_Obs,ʹokʹ,ʹMarkerFaceColorʹ,[ 0 0 1],ʹMarkerSizeʹ,2)
hold on % Observed data, TP RE‐AW
plot(Xaxis,prctile_Zol_prob_fromREtoAW,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
% Percentile of simulated data, TP RE‐AW
subplot(3,3,8) % Eight plot, position 8. Xaxis=[4,16];
ylim([0,1]) % Limited of y axis
xlim([4,15]) % Limited of X axis
plot(Xaxis,median_Zol_prob_fromREtoNR_Obs,ʹ‐‐ʹ,ʹColorʹ,[ 0 0 1],ʹLineWidthʹ,2)
hold on % Median of observed data, TP RE‐NR
plot(Xaxis,Zol_prob_fromREtoNR_Obs,ʹokʹ,ʹMarkerFaceColorʹ,[ 0 0 1],ʹMarkerSizeʹ,2)
hold on % Observed data, TP RE‐NR
plot(Xaxis,prctile_Zol_prob_fromREtoNR,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
% Percentile of simulated data, TP RE‐NR
subplot(3,3,9) % Ninth plot, position 9.
Xaxis=[4,16];
ylim([0,1]) % Limited of y axis
xlim([4,15]) % Limited of X axis
plot(Xaxis,median_Zol_prob_fromREtoRE_Obs,ʹ‐‐ʹ,ʹColorʹ,[ 0 0 1],ʹLineWidthʹ,2)
hold on % Median of observed data, TP RE‐RE
Appendix 6
211
plot(Xaxis,Zol_prob_fromREtoRE_Obs,ʹokʹ,ʹMarkerFaceColorʹ,[ 0 0 1],ʹMarkerSizeʹ,2)
hold on % Observed data, TP RE‐RE
plot(Xaxis,prctile_Zol_prob_fromREtoRE,ʹ‐‐ʹ,ʹColorʹ,[0 0 1],ʹLineWidthʹ,2)
% Percentile of simulated data, TP RE‐RE
Appendix 7
212
APPENDIX 7
Table 2 . Summary of Sleep Descriptors *
Term Abbreviation Definition Formula
TOTAL
RECORDING
TIME
TRT
The time from lights out to
lights on. To calculate in
minutes, count the number
of epochs and divide by two.
2
TOTAL SLEEP
TIME
TST
The total time spent asleep.
The total amount of sleep
recorded during the total
recording time. The basis for
many of the additional
statistics and indices.
Derived by summing the
total of all the minutes of S1,
S2, S2, S4 (in own case
NREM), and REM sleep.
1 2 3 4
TOTAL
STAGE TIME
‐
The total amount of time
spent on a particular stage of
sleep.
#
2
# 2
% OF SLEEP
STAGES:
% WAKE
TIME
‐
The percentage of time spent
awake. This statistic cannot
be based on TST, only SPT or
TRT
%
100
%
100
% REM
The percentage of total sleep
%
100%
%
100
Appendix 7
213
time spent in REM sleep %
100
% NREM
‐
The percentage or total sleep
time spent in NREM
%
100%
WAKE AFTER
SLEEP ONSET
WASO
The total amount of wake
time after the first epoch of
sleep. Wakefulness occurring
between sleep onset and the
last epoch of sleep
# 2
%SLEEP
EFFICIENCY
SE
The portion of the total
recording time spent asleep.
The percentage of time
asleep compared to the time
spent in bed.
Basically the quality of one’s
sleep
Normal adult value is 90% or
greater
The “laboratory effect”
allows for a75% efficiency in
the sleep lab environment.
% 100%
% 100
SLEEP ONSET
SO
The first epoch of sleep no
matter what stage.
Several criteria are used to define sleep onset. Generally for
the nocturnal polysomnogram, the rules are as follows:
1. The first of three consecutive epochs of S1 sleep
2. Any non‐S1 stage of sleep (any epoch of S2, S3, S4, or
REM sleep onset is at the underscored stage REM)
3. Any S1 that is contiguous with a non‐S1 stage of sleep
(sleep onset is at the underscored S1).
‐For the clinical MSLT, a different criterion is employed:
Sleep onset is defined as the first epoch of any sleep stage.
*(Butkov, Lee‐Chiong 2007)