aboutsummaryrefslogtreecommitdiff
path: root/R/mkinerrmin.R
blob: 7a922eb4d2b3eb03e866e1f4574f2f2fa9d0c0b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
mkinerrmin <- function(errdata, n.parms, alpha = 0.05)
{
  means.mean <- mean(errdata$value_mean, na.rm=TRUE)

	df = length(errdata$value_mean) - n.parms
  
	f <- function(err)
	{
		(sum((errdata$value_mean - errdata$value_pred)^2/((err * means.mean)^2)) - 
		 qchisq(1 - alpha,df))^2
	}
	err.min <- optimize(f, c(0.01,0.9))$minimum
	return(list(err.min = err.min, n.optim = n.parms, df = df))
}

Contact - Imprint