How can I test if the two parameter estimates in the same model are significantly different?
I have the model
$$
y=x^a times z^b + e
$$
where $y$ is the dependent variable, $x$ and $z$ are explanatory variables, $a$ and $b$ are the parameters and $e$ is an error term. I have parameter estimates of $a$ and $b$ and a covariance matrix of these estimates. How do I test if $a$ and $b$ are significantly different?
statistical-significance nonlinear-regression
add a comment |
I have the model
$$
y=x^a times z^b + e
$$
where $y$ is the dependent variable, $x$ and $z$ are explanatory variables, $a$ and $b$ are the parameters and $e$ is an error term. I have parameter estimates of $a$ and $b$ and a covariance matrix of these estimates. How do I test if $a$ and $b$ are significantly different?
statistical-significance nonlinear-regression
add a comment |
I have the model
$$
y=x^a times z^b + e
$$
where $y$ is the dependent variable, $x$ and $z$ are explanatory variables, $a$ and $b$ are the parameters and $e$ is an error term. I have parameter estimates of $a$ and $b$ and a covariance matrix of these estimates. How do I test if $a$ and $b$ are significantly different?
statistical-significance nonlinear-regression
I have the model
$$
y=x^a times z^b + e
$$
where $y$ is the dependent variable, $x$ and $z$ are explanatory variables, $a$ and $b$ are the parameters and $e$ is an error term. I have parameter estimates of $a$ and $b$ and a covariance matrix of these estimates. How do I test if $a$ and $b$ are significantly different?
statistical-significance nonlinear-regression
statistical-significance nonlinear-regression
edited Dec 24 '18 at 14:17
COOLSerdash
16.1k75192
16.1k75192
asked Dec 24 '18 at 14:11
K. RoelofsK. Roelofs
985
985
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Assessing the hypothesis that $a$ and $b$ are different is equivalent to testing the null hypothesis $a - b = 0$ (against the alternative that $a-bne 0$).
The following analysis presumes it is reasonable for you to estimate $a-b$ as $$U = hat a - hat b.$$ It also accepts your model formulation (which often is a reasonable one), which--because the errors are additive (and could even produce negative observed values of $y$)--does not permit us to linearize it by taking logarithms of both sides.
The variance of $U$ can be expressed in terms of the covariance matrix $(c_{ij})$ of $(hat a, hat b)$ as
$$operatorname{Var}(U) = operatorname{Var}(hat a - hat b) = operatorname{Var}(hat a) + operatorname{Var}(hat b) - 2 operatorname{Cov}(hat a, hat b) = c_{11} + c_{22} - 2c_{12}^2.$$
When $(hat a, hat b)$ is estimated with least squares, one usually uses a "t test;" that is, the distribution of $$t = U / sqrt{operatorname{Var(U)}}$$ is approximated by a Student t distribution with $n-2$ degrees of freedom (where $n$ is the data count and $2$ counts the number of coefficients). Regardless, $t$ usually is the basis of any test. You may perform a Z test (when $n$ is large or when fitting with Maximum Likelihood) or bootstrap it, for instance.
To be specific, the p-value of the t test is given by
$$p = 2t_{n-2}(-|t|)$$
where $t_{n-2}$ is the Student t (cumulative) distribution function. It is one expression for the "tail area:" the chance that a Student t variable (of $n-2$ degrees of freedom) equals or exceeds the size of the test statistic, $|t|.$
More generally, for numbers $c_1,$ $c_2,$ and $mu$ you can use exactly the same approach to test any hypothesis
$$H_0: c_1 a + c_2 b = mu$$
against the two-sided alternative. (This encompasses the special but widespread case of a "contrast".) Use the estimated variance-covariance matrix $(c_{ij})$ to estimate the variance of $U = c_1 a + c_2 b$ and form the statistic
$$t = (c_1 hat a + c_2 hat b - mu) / sqrt{operatorname{Var}(U)}.$$
The foregoing is the case $(c_1,c_2) = (1,-1)$ and $mu=0.$
To check that this advice is correct, I ran the following R code to create data according to this model (with Normally distributed errors e), fit them, and compute the values of $t$ many times. The check is that the probability plot of $t$ (based on the assumed Student t distribution) closely follows the diagonal. Here is that plot in a simulation of size $500$ where $n=5$ (a very small dataset, chosen because the $t$ distribution is far from Normal) and $a=b=-1/2.$

In this example, at least, the procedure works beautifully. Consider re-running the simulation using parameters $a,$ $b,$ $sigma$ (the error standard deviation), and $n$ that reflect your situation.
Here is the code.
#
# Specify the true parameters.
#
set.seed(17)
a <- -1/2
b <- -1/2
sigma <- 0.25 # Variance of the errors
n <- 5 # Sample size
n.sim <- 500 # Simulation size
#
# Specify the hypothesis.
#
H.0 <- c(1, -1) # Coefficients of `a` and `b`.
mu <- 0
#
# Provide x and z values in terms of their logarithms.
#
log.x <- log(rexp(n))
log.z <- log(rexp(n))
#
# Compute y without error.
#
y.0 <- exp(a * log.x + b * log.z)
#
# Conduct a simulation to estimate the sampling distribution of the t statistic.
#
sim <- replicate(n.sim, {
#
# Add the errors.
#
e <- rnorm(n, 0, sigma)
df <- data.frame(log.x=log.x, log.z=log.z, y.0, y=y.0 + e)
#
# Guess the solution.
#
fit.ols <- lm(log(y) ~ log.x + log.z - 1, subset(df, y > 0))
start <- coefficients(fit.ols) # Initial values of (a.hat, b.hat)
#
# Polish it using nonlinear least squares.
#
fit <- nls(y ~ exp(a * log.x + b * log.z), df, list(a=start[1], b=start[2]))
#
# Test a hypothesis.
#
cc <- vcov(fit)
s <- sqrt((H.0 %*% cc %*% H.0))
(crossprod(H.0, coef(fit)) - mu) / s
})
#
# Display the simulation results.
#
summary(lm(sort(sim) ~ 0 + ppoints(length(sim))))
qqplot(qt(ppoints(length(sim)), df=n-2), sim,
pch=21, bg="#00000010", col="#00000040",
xlab="Student t reference value",
ylab="Test statistic")
abline(0:1, col="Red", lwd=2)
2
This is excellent. The answer with the theory, with steps to follow to repeat for other tests, with a numerical approach for clarity, and with code. This is the gold standard.
– SecretAgentMan
Dec 24 '18 at 15:29
1
I find "The hypothesis that a and b are different" ambiguous in your opening sentence, because it is not clear whether that is a null or alternative hypothesis. The OP's question makes clear they are looking for evidence of difference, and the second clause of your sentence speaks to that. Pedagogically I think it helps folks newer to hypothesis testing to be super explicit. (But +1 for your answer overall :)
– Alexis
Dec 24 '18 at 17:49
1
@Alexis thank you--I see what you're saying. Because I do have such people in mind, I'll clarify.
– whuber♦
Dec 24 '18 at 17:55
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "65"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f384362%2fhow-can-i-test-if-the-two-parameter-estimates-in-the-same-model-are-significantl%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Assessing the hypothesis that $a$ and $b$ are different is equivalent to testing the null hypothesis $a - b = 0$ (against the alternative that $a-bne 0$).
The following analysis presumes it is reasonable for you to estimate $a-b$ as $$U = hat a - hat b.$$ It also accepts your model formulation (which often is a reasonable one), which--because the errors are additive (and could even produce negative observed values of $y$)--does not permit us to linearize it by taking logarithms of both sides.
The variance of $U$ can be expressed in terms of the covariance matrix $(c_{ij})$ of $(hat a, hat b)$ as
$$operatorname{Var}(U) = operatorname{Var}(hat a - hat b) = operatorname{Var}(hat a) + operatorname{Var}(hat b) - 2 operatorname{Cov}(hat a, hat b) = c_{11} + c_{22} - 2c_{12}^2.$$
When $(hat a, hat b)$ is estimated with least squares, one usually uses a "t test;" that is, the distribution of $$t = U / sqrt{operatorname{Var(U)}}$$ is approximated by a Student t distribution with $n-2$ degrees of freedom (where $n$ is the data count and $2$ counts the number of coefficients). Regardless, $t$ usually is the basis of any test. You may perform a Z test (when $n$ is large or when fitting with Maximum Likelihood) or bootstrap it, for instance.
To be specific, the p-value of the t test is given by
$$p = 2t_{n-2}(-|t|)$$
where $t_{n-2}$ is the Student t (cumulative) distribution function. It is one expression for the "tail area:" the chance that a Student t variable (of $n-2$ degrees of freedom) equals or exceeds the size of the test statistic, $|t|.$
More generally, for numbers $c_1,$ $c_2,$ and $mu$ you can use exactly the same approach to test any hypothesis
$$H_0: c_1 a + c_2 b = mu$$
against the two-sided alternative. (This encompasses the special but widespread case of a "contrast".) Use the estimated variance-covariance matrix $(c_{ij})$ to estimate the variance of $U = c_1 a + c_2 b$ and form the statistic
$$t = (c_1 hat a + c_2 hat b - mu) / sqrt{operatorname{Var}(U)}.$$
The foregoing is the case $(c_1,c_2) = (1,-1)$ and $mu=0.$
To check that this advice is correct, I ran the following R code to create data according to this model (with Normally distributed errors e), fit them, and compute the values of $t$ many times. The check is that the probability plot of $t$ (based on the assumed Student t distribution) closely follows the diagonal. Here is that plot in a simulation of size $500$ where $n=5$ (a very small dataset, chosen because the $t$ distribution is far from Normal) and $a=b=-1/2.$

In this example, at least, the procedure works beautifully. Consider re-running the simulation using parameters $a,$ $b,$ $sigma$ (the error standard deviation), and $n$ that reflect your situation.
Here is the code.
#
# Specify the true parameters.
#
set.seed(17)
a <- -1/2
b <- -1/2
sigma <- 0.25 # Variance of the errors
n <- 5 # Sample size
n.sim <- 500 # Simulation size
#
# Specify the hypothesis.
#
H.0 <- c(1, -1) # Coefficients of `a` and `b`.
mu <- 0
#
# Provide x and z values in terms of their logarithms.
#
log.x <- log(rexp(n))
log.z <- log(rexp(n))
#
# Compute y without error.
#
y.0 <- exp(a * log.x + b * log.z)
#
# Conduct a simulation to estimate the sampling distribution of the t statistic.
#
sim <- replicate(n.sim, {
#
# Add the errors.
#
e <- rnorm(n, 0, sigma)
df <- data.frame(log.x=log.x, log.z=log.z, y.0, y=y.0 + e)
#
# Guess the solution.
#
fit.ols <- lm(log(y) ~ log.x + log.z - 1, subset(df, y > 0))
start <- coefficients(fit.ols) # Initial values of (a.hat, b.hat)
#
# Polish it using nonlinear least squares.
#
fit <- nls(y ~ exp(a * log.x + b * log.z), df, list(a=start[1], b=start[2]))
#
# Test a hypothesis.
#
cc <- vcov(fit)
s <- sqrt((H.0 %*% cc %*% H.0))
(crossprod(H.0, coef(fit)) - mu) / s
})
#
# Display the simulation results.
#
summary(lm(sort(sim) ~ 0 + ppoints(length(sim))))
qqplot(qt(ppoints(length(sim)), df=n-2), sim,
pch=21, bg="#00000010", col="#00000040",
xlab="Student t reference value",
ylab="Test statistic")
abline(0:1, col="Red", lwd=2)
2
This is excellent. The answer with the theory, with steps to follow to repeat for other tests, with a numerical approach for clarity, and with code. This is the gold standard.
– SecretAgentMan
Dec 24 '18 at 15:29
1
I find "The hypothesis that a and b are different" ambiguous in your opening sentence, because it is not clear whether that is a null or alternative hypothesis. The OP's question makes clear they are looking for evidence of difference, and the second clause of your sentence speaks to that. Pedagogically I think it helps folks newer to hypothesis testing to be super explicit. (But +1 for your answer overall :)
– Alexis
Dec 24 '18 at 17:49
1
@Alexis thank you--I see what you're saying. Because I do have such people in mind, I'll clarify.
– whuber♦
Dec 24 '18 at 17:55
add a comment |
Assessing the hypothesis that $a$ and $b$ are different is equivalent to testing the null hypothesis $a - b = 0$ (against the alternative that $a-bne 0$).
The following analysis presumes it is reasonable for you to estimate $a-b$ as $$U = hat a - hat b.$$ It also accepts your model formulation (which often is a reasonable one), which--because the errors are additive (and could even produce negative observed values of $y$)--does not permit us to linearize it by taking logarithms of both sides.
The variance of $U$ can be expressed in terms of the covariance matrix $(c_{ij})$ of $(hat a, hat b)$ as
$$operatorname{Var}(U) = operatorname{Var}(hat a - hat b) = operatorname{Var}(hat a) + operatorname{Var}(hat b) - 2 operatorname{Cov}(hat a, hat b) = c_{11} + c_{22} - 2c_{12}^2.$$
When $(hat a, hat b)$ is estimated with least squares, one usually uses a "t test;" that is, the distribution of $$t = U / sqrt{operatorname{Var(U)}}$$ is approximated by a Student t distribution with $n-2$ degrees of freedom (where $n$ is the data count and $2$ counts the number of coefficients). Regardless, $t$ usually is the basis of any test. You may perform a Z test (when $n$ is large or when fitting with Maximum Likelihood) or bootstrap it, for instance.
To be specific, the p-value of the t test is given by
$$p = 2t_{n-2}(-|t|)$$
where $t_{n-2}$ is the Student t (cumulative) distribution function. It is one expression for the "tail area:" the chance that a Student t variable (of $n-2$ degrees of freedom) equals or exceeds the size of the test statistic, $|t|.$
More generally, for numbers $c_1,$ $c_2,$ and $mu$ you can use exactly the same approach to test any hypothesis
$$H_0: c_1 a + c_2 b = mu$$
against the two-sided alternative. (This encompasses the special but widespread case of a "contrast".) Use the estimated variance-covariance matrix $(c_{ij})$ to estimate the variance of $U = c_1 a + c_2 b$ and form the statistic
$$t = (c_1 hat a + c_2 hat b - mu) / sqrt{operatorname{Var}(U)}.$$
The foregoing is the case $(c_1,c_2) = (1,-1)$ and $mu=0.$
To check that this advice is correct, I ran the following R code to create data according to this model (with Normally distributed errors e), fit them, and compute the values of $t$ many times. The check is that the probability plot of $t$ (based on the assumed Student t distribution) closely follows the diagonal. Here is that plot in a simulation of size $500$ where $n=5$ (a very small dataset, chosen because the $t$ distribution is far from Normal) and $a=b=-1/2.$

In this example, at least, the procedure works beautifully. Consider re-running the simulation using parameters $a,$ $b,$ $sigma$ (the error standard deviation), and $n$ that reflect your situation.
Here is the code.
#
# Specify the true parameters.
#
set.seed(17)
a <- -1/2
b <- -1/2
sigma <- 0.25 # Variance of the errors
n <- 5 # Sample size
n.sim <- 500 # Simulation size
#
# Specify the hypothesis.
#
H.0 <- c(1, -1) # Coefficients of `a` and `b`.
mu <- 0
#
# Provide x and z values in terms of their logarithms.
#
log.x <- log(rexp(n))
log.z <- log(rexp(n))
#
# Compute y without error.
#
y.0 <- exp(a * log.x + b * log.z)
#
# Conduct a simulation to estimate the sampling distribution of the t statistic.
#
sim <- replicate(n.sim, {
#
# Add the errors.
#
e <- rnorm(n, 0, sigma)
df <- data.frame(log.x=log.x, log.z=log.z, y.0, y=y.0 + e)
#
# Guess the solution.
#
fit.ols <- lm(log(y) ~ log.x + log.z - 1, subset(df, y > 0))
start <- coefficients(fit.ols) # Initial values of (a.hat, b.hat)
#
# Polish it using nonlinear least squares.
#
fit <- nls(y ~ exp(a * log.x + b * log.z), df, list(a=start[1], b=start[2]))
#
# Test a hypothesis.
#
cc <- vcov(fit)
s <- sqrt((H.0 %*% cc %*% H.0))
(crossprod(H.0, coef(fit)) - mu) / s
})
#
# Display the simulation results.
#
summary(lm(sort(sim) ~ 0 + ppoints(length(sim))))
qqplot(qt(ppoints(length(sim)), df=n-2), sim,
pch=21, bg="#00000010", col="#00000040",
xlab="Student t reference value",
ylab="Test statistic")
abline(0:1, col="Red", lwd=2)
2
This is excellent. The answer with the theory, with steps to follow to repeat for other tests, with a numerical approach for clarity, and with code. This is the gold standard.
– SecretAgentMan
Dec 24 '18 at 15:29
1
I find "The hypothesis that a and b are different" ambiguous in your opening sentence, because it is not clear whether that is a null or alternative hypothesis. The OP's question makes clear they are looking for evidence of difference, and the second clause of your sentence speaks to that. Pedagogically I think it helps folks newer to hypothesis testing to be super explicit. (But +1 for your answer overall :)
– Alexis
Dec 24 '18 at 17:49
1
@Alexis thank you--I see what you're saying. Because I do have such people in mind, I'll clarify.
– whuber♦
Dec 24 '18 at 17:55
add a comment |
Assessing the hypothesis that $a$ and $b$ are different is equivalent to testing the null hypothesis $a - b = 0$ (against the alternative that $a-bne 0$).
The following analysis presumes it is reasonable for you to estimate $a-b$ as $$U = hat a - hat b.$$ It also accepts your model formulation (which often is a reasonable one), which--because the errors are additive (and could even produce negative observed values of $y$)--does not permit us to linearize it by taking logarithms of both sides.
The variance of $U$ can be expressed in terms of the covariance matrix $(c_{ij})$ of $(hat a, hat b)$ as
$$operatorname{Var}(U) = operatorname{Var}(hat a - hat b) = operatorname{Var}(hat a) + operatorname{Var}(hat b) - 2 operatorname{Cov}(hat a, hat b) = c_{11} + c_{22} - 2c_{12}^2.$$
When $(hat a, hat b)$ is estimated with least squares, one usually uses a "t test;" that is, the distribution of $$t = U / sqrt{operatorname{Var(U)}}$$ is approximated by a Student t distribution with $n-2$ degrees of freedom (where $n$ is the data count and $2$ counts the number of coefficients). Regardless, $t$ usually is the basis of any test. You may perform a Z test (when $n$ is large or when fitting with Maximum Likelihood) or bootstrap it, for instance.
To be specific, the p-value of the t test is given by
$$p = 2t_{n-2}(-|t|)$$
where $t_{n-2}$ is the Student t (cumulative) distribution function. It is one expression for the "tail area:" the chance that a Student t variable (of $n-2$ degrees of freedom) equals or exceeds the size of the test statistic, $|t|.$
More generally, for numbers $c_1,$ $c_2,$ and $mu$ you can use exactly the same approach to test any hypothesis
$$H_0: c_1 a + c_2 b = mu$$
against the two-sided alternative. (This encompasses the special but widespread case of a "contrast".) Use the estimated variance-covariance matrix $(c_{ij})$ to estimate the variance of $U = c_1 a + c_2 b$ and form the statistic
$$t = (c_1 hat a + c_2 hat b - mu) / sqrt{operatorname{Var}(U)}.$$
The foregoing is the case $(c_1,c_2) = (1,-1)$ and $mu=0.$
To check that this advice is correct, I ran the following R code to create data according to this model (with Normally distributed errors e), fit them, and compute the values of $t$ many times. The check is that the probability plot of $t$ (based on the assumed Student t distribution) closely follows the diagonal. Here is that plot in a simulation of size $500$ where $n=5$ (a very small dataset, chosen because the $t$ distribution is far from Normal) and $a=b=-1/2.$

In this example, at least, the procedure works beautifully. Consider re-running the simulation using parameters $a,$ $b,$ $sigma$ (the error standard deviation), and $n$ that reflect your situation.
Here is the code.
#
# Specify the true parameters.
#
set.seed(17)
a <- -1/2
b <- -1/2
sigma <- 0.25 # Variance of the errors
n <- 5 # Sample size
n.sim <- 500 # Simulation size
#
# Specify the hypothesis.
#
H.0 <- c(1, -1) # Coefficients of `a` and `b`.
mu <- 0
#
# Provide x and z values in terms of their logarithms.
#
log.x <- log(rexp(n))
log.z <- log(rexp(n))
#
# Compute y without error.
#
y.0 <- exp(a * log.x + b * log.z)
#
# Conduct a simulation to estimate the sampling distribution of the t statistic.
#
sim <- replicate(n.sim, {
#
# Add the errors.
#
e <- rnorm(n, 0, sigma)
df <- data.frame(log.x=log.x, log.z=log.z, y.0, y=y.0 + e)
#
# Guess the solution.
#
fit.ols <- lm(log(y) ~ log.x + log.z - 1, subset(df, y > 0))
start <- coefficients(fit.ols) # Initial values of (a.hat, b.hat)
#
# Polish it using nonlinear least squares.
#
fit <- nls(y ~ exp(a * log.x + b * log.z), df, list(a=start[1], b=start[2]))
#
# Test a hypothesis.
#
cc <- vcov(fit)
s <- sqrt((H.0 %*% cc %*% H.0))
(crossprod(H.0, coef(fit)) - mu) / s
})
#
# Display the simulation results.
#
summary(lm(sort(sim) ~ 0 + ppoints(length(sim))))
qqplot(qt(ppoints(length(sim)), df=n-2), sim,
pch=21, bg="#00000010", col="#00000040",
xlab="Student t reference value",
ylab="Test statistic")
abline(0:1, col="Red", lwd=2)
Assessing the hypothesis that $a$ and $b$ are different is equivalent to testing the null hypothesis $a - b = 0$ (against the alternative that $a-bne 0$).
The following analysis presumes it is reasonable for you to estimate $a-b$ as $$U = hat a - hat b.$$ It also accepts your model formulation (which often is a reasonable one), which--because the errors are additive (and could even produce negative observed values of $y$)--does not permit us to linearize it by taking logarithms of both sides.
The variance of $U$ can be expressed in terms of the covariance matrix $(c_{ij})$ of $(hat a, hat b)$ as
$$operatorname{Var}(U) = operatorname{Var}(hat a - hat b) = operatorname{Var}(hat a) + operatorname{Var}(hat b) - 2 operatorname{Cov}(hat a, hat b) = c_{11} + c_{22} - 2c_{12}^2.$$
When $(hat a, hat b)$ is estimated with least squares, one usually uses a "t test;" that is, the distribution of $$t = U / sqrt{operatorname{Var(U)}}$$ is approximated by a Student t distribution with $n-2$ degrees of freedom (where $n$ is the data count and $2$ counts the number of coefficients). Regardless, $t$ usually is the basis of any test. You may perform a Z test (when $n$ is large or when fitting with Maximum Likelihood) or bootstrap it, for instance.
To be specific, the p-value of the t test is given by
$$p = 2t_{n-2}(-|t|)$$
where $t_{n-2}$ is the Student t (cumulative) distribution function. It is one expression for the "tail area:" the chance that a Student t variable (of $n-2$ degrees of freedom) equals or exceeds the size of the test statistic, $|t|.$
More generally, for numbers $c_1,$ $c_2,$ and $mu$ you can use exactly the same approach to test any hypothesis
$$H_0: c_1 a + c_2 b = mu$$
against the two-sided alternative. (This encompasses the special but widespread case of a "contrast".) Use the estimated variance-covariance matrix $(c_{ij})$ to estimate the variance of $U = c_1 a + c_2 b$ and form the statistic
$$t = (c_1 hat a + c_2 hat b - mu) / sqrt{operatorname{Var}(U)}.$$
The foregoing is the case $(c_1,c_2) = (1,-1)$ and $mu=0.$
To check that this advice is correct, I ran the following R code to create data according to this model (with Normally distributed errors e), fit them, and compute the values of $t$ many times. The check is that the probability plot of $t$ (based on the assumed Student t distribution) closely follows the diagonal. Here is that plot in a simulation of size $500$ where $n=5$ (a very small dataset, chosen because the $t$ distribution is far from Normal) and $a=b=-1/2.$

In this example, at least, the procedure works beautifully. Consider re-running the simulation using parameters $a,$ $b,$ $sigma$ (the error standard deviation), and $n$ that reflect your situation.
Here is the code.
#
# Specify the true parameters.
#
set.seed(17)
a <- -1/2
b <- -1/2
sigma <- 0.25 # Variance of the errors
n <- 5 # Sample size
n.sim <- 500 # Simulation size
#
# Specify the hypothesis.
#
H.0 <- c(1, -1) # Coefficients of `a` and `b`.
mu <- 0
#
# Provide x and z values in terms of their logarithms.
#
log.x <- log(rexp(n))
log.z <- log(rexp(n))
#
# Compute y without error.
#
y.0 <- exp(a * log.x + b * log.z)
#
# Conduct a simulation to estimate the sampling distribution of the t statistic.
#
sim <- replicate(n.sim, {
#
# Add the errors.
#
e <- rnorm(n, 0, sigma)
df <- data.frame(log.x=log.x, log.z=log.z, y.0, y=y.0 + e)
#
# Guess the solution.
#
fit.ols <- lm(log(y) ~ log.x + log.z - 1, subset(df, y > 0))
start <- coefficients(fit.ols) # Initial values of (a.hat, b.hat)
#
# Polish it using nonlinear least squares.
#
fit <- nls(y ~ exp(a * log.x + b * log.z), df, list(a=start[1], b=start[2]))
#
# Test a hypothesis.
#
cc <- vcov(fit)
s <- sqrt((H.0 %*% cc %*% H.0))
(crossprod(H.0, coef(fit)) - mu) / s
})
#
# Display the simulation results.
#
summary(lm(sort(sim) ~ 0 + ppoints(length(sim))))
qqplot(qt(ppoints(length(sim)), df=n-2), sim,
pch=21, bg="#00000010", col="#00000040",
xlab="Student t reference value",
ylab="Test statistic")
abline(0:1, col="Red", lwd=2)
edited Dec 26 '18 at 19:42
answered Dec 24 '18 at 15:26
whuber♦whuber
201k33437806
201k33437806
2
This is excellent. The answer with the theory, with steps to follow to repeat for other tests, with a numerical approach for clarity, and with code. This is the gold standard.
– SecretAgentMan
Dec 24 '18 at 15:29
1
I find "The hypothesis that a and b are different" ambiguous in your opening sentence, because it is not clear whether that is a null or alternative hypothesis. The OP's question makes clear they are looking for evidence of difference, and the second clause of your sentence speaks to that. Pedagogically I think it helps folks newer to hypothesis testing to be super explicit. (But +1 for your answer overall :)
– Alexis
Dec 24 '18 at 17:49
1
@Alexis thank you--I see what you're saying. Because I do have such people in mind, I'll clarify.
– whuber♦
Dec 24 '18 at 17:55
add a comment |
2
This is excellent. The answer with the theory, with steps to follow to repeat for other tests, with a numerical approach for clarity, and with code. This is the gold standard.
– SecretAgentMan
Dec 24 '18 at 15:29
1
I find "The hypothesis that a and b are different" ambiguous in your opening sentence, because it is not clear whether that is a null or alternative hypothesis. The OP's question makes clear they are looking for evidence of difference, and the second clause of your sentence speaks to that. Pedagogically I think it helps folks newer to hypothesis testing to be super explicit. (But +1 for your answer overall :)
– Alexis
Dec 24 '18 at 17:49
1
@Alexis thank you--I see what you're saying. Because I do have such people in mind, I'll clarify.
– whuber♦
Dec 24 '18 at 17:55
2
2
This is excellent. The answer with the theory, with steps to follow to repeat for other tests, with a numerical approach for clarity, and with code. This is the gold standard.
– SecretAgentMan
Dec 24 '18 at 15:29
This is excellent. The answer with the theory, with steps to follow to repeat for other tests, with a numerical approach for clarity, and with code. This is the gold standard.
– SecretAgentMan
Dec 24 '18 at 15:29
1
1
I find "The hypothesis that a and b are different" ambiguous in your opening sentence, because it is not clear whether that is a null or alternative hypothesis. The OP's question makes clear they are looking for evidence of difference, and the second clause of your sentence speaks to that. Pedagogically I think it helps folks newer to hypothesis testing to be super explicit. (But +1 for your answer overall :)
– Alexis
Dec 24 '18 at 17:49
I find "The hypothesis that a and b are different" ambiguous in your opening sentence, because it is not clear whether that is a null or alternative hypothesis. The OP's question makes clear they are looking for evidence of difference, and the second clause of your sentence speaks to that. Pedagogically I think it helps folks newer to hypothesis testing to be super explicit. (But +1 for your answer overall :)
– Alexis
Dec 24 '18 at 17:49
1
1
@Alexis thank you--I see what you're saying. Because I do have such people in mind, I'll clarify.
– whuber♦
Dec 24 '18 at 17:55
@Alexis thank you--I see what you're saying. Because I do have such people in mind, I'll clarify.
– whuber♦
Dec 24 '18 at 17:55
add a comment |
Thanks for contributing an answer to Cross Validated!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f384362%2fhow-can-i-test-if-the-two-parameter-estimates-in-the-same-model-are-significantl%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown