VII. The following data was collected on a patient that was admitted to the Emergency Department.(ED). The data collected sequentially in time was 1) Body temperature (temp) 2) Heart rate (hrtrate) 3) respiratory rate (resprate), 4)oxygen saturation (02sat), 5) systolic blood pressure (sbp) 6) diastolic blood pressure (dbp) the data appears in the text file patientED.tex Fit a Hidden Markov |Model (HMM) to this data assuming that the 6 variables being measured follow a Multivariate Normal distribution when the patient is in a given state. a. Fit the HMM model with two states, three states and four states. b. In each case determine the Viterbi sequence of states c. Carry out the likelihood ratio test to see if three states are required over two states, if four states are required over three states Here is the data screenshot. Here is the data code provided as an example. ourData2states.R P1data<-read.table("C:/Users/wilhl/OneDrive/Desktop/patientHMM.txt", header=FALSE) y<-data.matrix(P1data) # now use makeDepmix to create a depmix model for this 3-dim normal timeseries # response is a 2-dim list of response models. Models <- list() rModels[[1]] <- list(MVNresponse(y~1)) Models[[2]] <- list(MVNresponse(y~1)) trstart=c(0.9,0.1,0.2,0.8) 97.3 80 18 99 138 78 98.5 82 18 100 142 78 98.2 73 20 99 122 60 97.6 70 18 98 153 66 97.8 70 18 98 123 60 98 70 18 95 122 61 98.3 71 16 100 134 57 98.8 78 19 100 151 75 transition <-list() 99.5 75 18 98 180 74 97.4 71 16 96 119 59 97.9 62 16 95 145 63 98.7 65 19 99 116 76 98.7 50 12 98 50 12 98.6 72 18 97.8 70 18 97.9 72 20 98 105 42 100 119 56 100 125 62 100 118 59 100 135 64 100.2 73 15 98 149 53 98.4 72 16 96 134 53 97.9 70 17 97 131 58 98.2 72 17 96 126 70 98.1 69 18 98.5 95 16 98.5 76 16 97.9 73 16 97 118 64 100 158 71 100 149 60 100 144 59 98.5 81 18 98 157 80 98.9 120 16 96 120 71 102.4 123 20 99 107 69 transition[[1]] <- transInit(~1,nstates=2,data=data.frame(1),pstart=c(trstart[1:2])) transition[[2]] <- transInit(~1,nstates=2,data=data.frame(1),pstart=c(trstart[3:4])) instart=runif(2) inMod <- transInit(~1,ns-2,ps-instart.data-data.frame(1)) mod <- makeDepmix(response-rModels.transition-transition prior-inMod) fm2 <- fit(mod.emc-em.control(random=TRUE)) summary(fm2) postvit2<-posterior(fm2,type="global") plot(postvit2,type="[") ourData3states.R Models <- list() Models [[1]] <- list(MVNresponse(y-1)) Models [[2]] <- list(MVNresponse(y-1)) Models [[3]] <- list(MVNresponse(y-1)) trstart=c(0.8,0.1,0.1,0.1,0.8,0.1,0.1,0.1,0.8) transition<-list() transition[[1]] <- transInit(~1,nstates=3,data=data.frame(1),pstart=c(trstart[1:3])) transition[[2]] <- translnit(~1,nstates=3,data=data.frame(1),pstart=c(trstart[4:6])) transition[[3]] <- transInit(~1,nstates=3,data=data.frame(1),pstart=c(trstart[7:9])) instart-runif(3) inMod <- transInit(~1,ns=3,ps=instart.data=data.frame(1)) mod <- makeDepmix(response-rModels.transition-transition prior-inMod) fm3<- fit(mod.emc-em.control(random=TRUE)) summary(fm3) postvit3<-posterior(fm3,type="global") plot(postvit3,type="l") Uratio(fm3.fm2)

Glencoe Algebra 1, Student Edition, 9780079039897, 0079039898, 2018
18th Edition
ISBN:9780079039897
Author:Carter
Publisher:Carter
Chapter10: Statistics
Section10.6: Summarizing Categorical Data
Problem 28PPS
Question

Please solve the questions

I have attached the data in the screenshot and the codes that can be used for the questions. 

 

Thank you. 

VII. The following data was collected on a patient that was admitted to the Emergency
Department.(ED). The data collected sequentially in time was
1) Body temperature (temp)
2) Heart rate (hrtrate)
3) respiratory rate (resprate),
4)oxygen saturation (02sat),
5) systolic blood pressure (sbp)
6) diastolic blood pressure (dbp)
the data appears in the text file patientED.tex
Fit a Hidden Markov |Model (HMM) to this data assuming that the 6 variables
being measured follow a Multivariate Normal distribution when the patient is in a
given state.
a. Fit the HMM model with two states, three states and four states.
b. In each case determine the Viterbi sequence of states
c. Carry out the likelihood ratio test to see if three states are required over two
states, if four states are required over three states
Here is the data screenshot.
Here is the data code provided as an example.
ourData2states.R
P1data<-read.table("C:/Users/wilhl/OneDrive/Desktop/patientHMM.txt", header=FALSE)
y<-data.matrix(P1data)
# now use makeDepmix to create a depmix model for this 3-dim normal timeseries
# response is a 2-dim list of response models.
Models <- list()
rModels[[1]] <- list(MVNresponse(y~1))
Models[[2]] <- list(MVNresponse(y~1))
trstart=c(0.9,0.1,0.2,0.8)
97.3 80 18
99
138 78
98.5 82
18
100
142
78
98.2 73
20
99
122 60
97.6 70
18
98
153 66
97.8 70
18
98
123 60
98
70
18
95
122 61
98.3 71
16
100 134 57
98.8 78
19
100
151 75
transition <-list()
99.5 75 18
98
180 74
97.4 71 16
96
119 59
97.9 62
16
95
145
63
98.7 65 19
99
116 76
98.7 50 12
98 50 12
98.6 72 18
97.8 70 18
97.9 72 20
98
105 42
100 119 56
100 125 62
100 118 59
100 135 64
100.2 73
15
98 149 53
98.4 72 16
96
134 53
97.9 70 17
97
131 58
98.2 72 17
96
126
70
98.1 69 18
98.5 95 16
98.5 76 16
97.9 73 16
97
118
64
100 158 71
100 149 60
100
144 59
98.5 81 18
98
157 80
98.9 120 16
96
120 71
102.4 123 20 99
107 69
transition[[1]] <- transInit(~1,nstates=2,data=data.frame(1),pstart=c(trstart[1:2]))
transition[[2]] <- transInit(~1,nstates=2,data=data.frame(1),pstart=c(trstart[3:4]))
instart=runif(2)
inMod <- transInit(~1,ns-2,ps-instart.data-data.frame(1))
mod <- makeDepmix(response-rModels.transition-transition prior-inMod)
fm2 <- fit(mod.emc-em.control(random=TRUE))
summary(fm2)
postvit2<-posterior(fm2,type="global")
plot(postvit2,type="[")
ourData3states.R
Models <- list()
Models [[1]] <- list(MVNresponse(y-1))
Models [[2]] <- list(MVNresponse(y-1))
Models [[3]] <- list(MVNresponse(y-1))
trstart=c(0.8,0.1,0.1,0.1,0.8,0.1,0.1,0.1,0.8)
transition<-list()
transition[[1]] <- transInit(~1,nstates=3,data=data.frame(1),pstart=c(trstart[1:3]))
transition[[2]] <- translnit(~1,nstates=3,data=data.frame(1),pstart=c(trstart[4:6]))
transition[[3]] <- transInit(~1,nstates=3,data=data.frame(1),pstart=c(trstart[7:9]))
instart-runif(3)
inMod <- transInit(~1,ns=3,ps=instart.data=data.frame(1))
mod <- makeDepmix(response-rModels.transition-transition prior-inMod)
fm3<- fit(mod.emc-em.control(random=TRUE))
summary(fm3)
postvit3<-posterior(fm3,type="global")
plot(postvit3,type="l")
Uratio(fm3.fm2)
Transcribed Image Text:VII. The following data was collected on a patient that was admitted to the Emergency Department.(ED). The data collected sequentially in time was 1) Body temperature (temp) 2) Heart rate (hrtrate) 3) respiratory rate (resprate), 4)oxygen saturation (02sat), 5) systolic blood pressure (sbp) 6) diastolic blood pressure (dbp) the data appears in the text file patientED.tex Fit a Hidden Markov |Model (HMM) to this data assuming that the 6 variables being measured follow a Multivariate Normal distribution when the patient is in a given state. a. Fit the HMM model with two states, three states and four states. b. In each case determine the Viterbi sequence of states c. Carry out the likelihood ratio test to see if three states are required over two states, if four states are required over three states Here is the data screenshot. Here is the data code provided as an example. ourData2states.R P1data<-read.table("C:/Users/wilhl/OneDrive/Desktop/patientHMM.txt", header=FALSE) y<-data.matrix(P1data) # now use makeDepmix to create a depmix model for this 3-dim normal timeseries # response is a 2-dim list of response models. Models <- list() rModels[[1]] <- list(MVNresponse(y~1)) Models[[2]] <- list(MVNresponse(y~1)) trstart=c(0.9,0.1,0.2,0.8) 97.3 80 18 99 138 78 98.5 82 18 100 142 78 98.2 73 20 99 122 60 97.6 70 18 98 153 66 97.8 70 18 98 123 60 98 70 18 95 122 61 98.3 71 16 100 134 57 98.8 78 19 100 151 75 transition <-list() 99.5 75 18 98 180 74 97.4 71 16 96 119 59 97.9 62 16 95 145 63 98.7 65 19 99 116 76 98.7 50 12 98 50 12 98.6 72 18 97.8 70 18 97.9 72 20 98 105 42 100 119 56 100 125 62 100 118 59 100 135 64 100.2 73 15 98 149 53 98.4 72 16 96 134 53 97.9 70 17 97 131 58 98.2 72 17 96 126 70 98.1 69 18 98.5 95 16 98.5 76 16 97.9 73 16 97 118 64 100 158 71 100 149 60 100 144 59 98.5 81 18 98 157 80 98.9 120 16 96 120 71 102.4 123 20 99 107 69 transition[[1]] <- transInit(~1,nstates=2,data=data.frame(1),pstart=c(trstart[1:2])) transition[[2]] <- transInit(~1,nstates=2,data=data.frame(1),pstart=c(trstart[3:4])) instart=runif(2) inMod <- transInit(~1,ns-2,ps-instart.data-data.frame(1)) mod <- makeDepmix(response-rModels.transition-transition prior-inMod) fm2 <- fit(mod.emc-em.control(random=TRUE)) summary(fm2) postvit2<-posterior(fm2,type="global") plot(postvit2,type="[") ourData3states.R Models <- list() Models [[1]] <- list(MVNresponse(y-1)) Models [[2]] <- list(MVNresponse(y-1)) Models [[3]] <- list(MVNresponse(y-1)) trstart=c(0.8,0.1,0.1,0.1,0.8,0.1,0.1,0.1,0.8) transition<-list() transition[[1]] <- transInit(~1,nstates=3,data=data.frame(1),pstart=c(trstart[1:3])) transition[[2]] <- translnit(~1,nstates=3,data=data.frame(1),pstart=c(trstart[4:6])) transition[[3]] <- transInit(~1,nstates=3,data=data.frame(1),pstart=c(trstart[7:9])) instart-runif(3) inMod <- transInit(~1,ns=3,ps=instart.data=data.frame(1)) mod <- makeDepmix(response-rModels.transition-transition prior-inMod) fm3<- fit(mod.emc-em.control(random=TRUE)) summary(fm3) postvit3<-posterior(fm3,type="global") plot(postvit3,type="l") Uratio(fm3.fm2)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Glencoe Algebra 1, Student Edition, 9780079039897…
Glencoe Algebra 1, Student Edition, 9780079039897…
Algebra
ISBN:
9780079039897
Author:
Carter
Publisher:
McGraw Hill