Closed lenthomas closed 1 year ago
No control values are passed to the model fitting function (io.glm) from ddf.io.fi
data(book.tee.data)
region <- book.tee.data$book.tee.region
egdata <- book.tee.data$book.tee.dataframe
samples <- book.tee.data$book.tee.samples
obs <- book.tee.data$book.tee.obs
# Confirm how the initial values work for the ds models
# fit a half-normal detection function
result <- ddf(dsmodel=~mcds(key="hn", formula=~1), data=egdata, method="ds",
meta.data=list(width=4))
result$par
# fit a half-normal detection function
result <- ddf(dsmodel=~mcds(key="hn", formula=~1), data=egdata, method="ds",
meta.data=list(width=4),
control = list(initial = list(scale = 0.25)))
result$par # slightly different
result <- ddf(dsmodel=~mcds(key="hn", formula=~1), data=egdata, method="ds",
meta.data=list(width=4),
control = list(initial = list(scale = 0.25),
lowerbounds = 0,
upperbounds = 0.9))
result$par # hits upper bound
# Seem to have no effect on the mr models
result <- ddf(dsmodel=~mcds(key="hn", formula=~1), data=egdata, method="ds",
meta.data=list(width=4),
control = list(initial = list(scale = 1.25),
lowerbounds = 1,
upperbounds = 1.9))
result$par # hits lower bound
# fit an independent observer model with full independence
result.io.fi <- ddf(mrmodel=~glm(~distance), data=egdata, method="io.fi",
meta.data=list(width = 4))
result.io.fi$par
# fit an independent observer model with full independence
result.io.fi2 <- ddf(mrmodel=~glm(~distance), data=egdata, method="io.fi",
meta.data=list(width = 4),
control = list(lowerbounds = c(2,-1.1), upperbounds = c(2.5,-1)))
# No difference
result.io.fi$par
result.io.fi2$par
# fit an independent observer model with point independence
result.io <- ddf(dsmodel=~cds(key = "hn"), mrmodel=~glm(~distance),
data=egdata, method="io", meta.data=list(width=4))
result.io$par
result.io <- ddf(dsmodel=~cds(key = "hn"), mrmodel=~glm(~distance),
data=egdata, method="io", meta.data=list(width=4),
control = list(initial = list(scale = 0.25),
lowerbounds = 0,
upperbounds = 0.9))
result.io$par #scale param of DF is 0.9
Checking the order of the lower and upper bounds for covariates and adjustment terms
result <- ddf(dsmodel=~mcds(key="hr", formula=~size+sex+exposure),
data=egdata, method="ds",
meta.data=list(width=4),
control = list(initial = list(scale = c(0.5, 0.05, 0.5, 0.1),
shape = 1.35)))
summary(result)
result$par
result2 <- ddf(dsmodel=~mcds(key="hr", formula=~size+sex+exposure),
data=egdata, method="ds",
meta.data=list(width=4),
control = list(initial = list(scale = c(0.5, 0.05, 0.5, 0.1),
shape = 1.35),
lowerbounds = c(0.5, 0.4, 0, 0.4, 0 ),
upperbounds = c(1, 0.55, 0.1, 0.59, 0.069)))
result2$par
result$par
# Check where adjustment terms fit in
result3 <- ddf(dsmodel=~mcds(key="hr", formula=~size+sex+exposure,
adj.series="cos", adj.order=2),
data=egdata, method="ds",
meta.data=list(width=4))
> result$par
V1 X.Intercept. size sex
1.35393807 0.51176985 0.05595641 0.50309413
exposure
0.11589361
> result3$par
V1 X.Intercept. size sex
1.51183107 0.64483879 0.03699285 0.40526429
exposure V6
0.09326986 0.08810099
@lenthomas what is the mrds-opt page you refer to above?
@LHMarshall There is a man-page written containing optimisation hints as seen here looking at the content of the mrds
package, yet it cannot be accessed (as you have shown) by using the question mark. Don't know why the question mark doesn't work.
@erex it had a problem with the - in mrds-opt so I've renamed to mrds_opt now ?mrds_opt works
In
ddf
it is possible to add lower and upper bounds to the detection function parameters. However, I believe these just apply to thedsmodel
parameters, not themrmodel
. The documentation for the ddf function does not make this clear:I also think the
initial
values are only for thedsmodel
.These things need checked and the help clarified. This would be help for the
ddf
function and also the text in themrds-opt
page.