Professional Documents
Culture Documents
HW4 - Problem 6.2.1: Man-Fang Liang 2023-05-05
HW4 - Problem 6.2.1: Man-Fang Liang 2023-05-05
Man-fang Liang
2023-05-05
Data
dat.signal=c(3,7,14,24,32,12)
dat.noise=c(12,16,21,15,10,6)
NS=sum(dat.signal)
NN=sum(dat.noise)
parest.signal=dat.signal/NS
parest.noise=dat.noise/NN
## [1] 283.1945
# helper function that computes the value of p.ij for any mean.j, sd.j and vector of bounds
sd.prob.1=function(mean,sd,bounds)
{
cumulative=c(0,pnorm(bounds,mean,sd),1)
p.ij=diff(cumulative)
return(p.ij)
}
1
#y=y_(1,s),..,y_(I,s),y_(1,n),..,y_(I,n)
nll.sigdet=function(par,y)
{
I=length(y)/2
d=par[1]
sigma=par[2]
bounds=par[3:length(par)]
p.noise=sd.prob.1(0,1,bounds)
p.signal=sd.prob.1(d,sigma,bounds)
nll.signal=nll.mult.1(p.signal,y[1:I])
nll.noise=nll.mult.1(p.noise,y[(I+1):(2*I)])
return(nll.signal+nll.noise)
}
sigdet
## $par
## [1] 0.6933274 0.8410482 -0.9832706 -0.3793114 0.2078974 0.7772900 1.5834454
##
## $value
## [1] 284.6423
##
## $counts
## function gradient
## 838 NA
##
## $convergence
## [1] 0
##
## $message
## NULL
2 * (sigdet$value - nll.general)
## [1] 2.895623
## [1] 7.814728
𝐺2 is 2.90, less than the critical value of 7.81 with 3 degrees of freedom. The free-variance signal detection
model is also appropriate for the data.