Why I get p value = NA in Shapiro Wilk test after a BoxCox transformation?












0















this is my first question in this forum which I find very helpful! I have got a problem that I don't know how to interpret or solve it:



I've got measurements of a biochemical parameter (named 'droms') which doesn't reach normality. So, I did a BoxCox transformation following this code:



sum(is.na(dataframe$droms))
[1] 0
boxcoxnc(dataframe$droms, method='sw', lambda =seq(-5,5,0.01),plot=TRUE, alpha=0.05, verbose=TRUE)

Error in boxcoxnc(data_turbidez$droms, method = "sw", lambda = seq(-5, :
Data must include positive values. Specify shifting parameter, lambda2


So, I changed the code to this new one:



 boxcoxnc(dataframe$droms, method='sw', lambda2=2, lambda =seq(-5,5,0.01),plot=TRUE, alpha=0.05, verbose=TRUE)

lambda.hat : -0.53
statistic : 0.9895904
p.value : 0.1819954

Result : Transformed data are normal.


And I proceeded to apply the transformation:



dataframe$droms_normalized <- (dataframe$droms^-0.53-1)/-0.53


But when I try to check again the normality looking at the histogram, I don't get the same histogram given by the boxcox transformation and I get this output from the Shapiro Wilk Test:



W = NaN, p-value = NA


Could you help me to identify what I am doing wrong in the transformation?



Thank you so much!










share|improve this question























  • It's a pity that you don't provide reproducible sample data. Provided I understood correctly, you're estimating the parameter lambda of a two parameter Box-Cox transformation (with a non-zero shift parameter lambda2). So you need to account for the shift parameter when calculating dataframe$droms_normalized. Try ((dataframe$droms + 2)^-0.53-1)/-0.53.

    – Maurits Evers
    Jan 2 at 12:38








  • 1





    Thank you so much!

    – Iraida
    Jan 2 at 12:43
















0















this is my first question in this forum which I find very helpful! I have got a problem that I don't know how to interpret or solve it:



I've got measurements of a biochemical parameter (named 'droms') which doesn't reach normality. So, I did a BoxCox transformation following this code:



sum(is.na(dataframe$droms))
[1] 0
boxcoxnc(dataframe$droms, method='sw', lambda =seq(-5,5,0.01),plot=TRUE, alpha=0.05, verbose=TRUE)

Error in boxcoxnc(data_turbidez$droms, method = "sw", lambda = seq(-5, :
Data must include positive values. Specify shifting parameter, lambda2


So, I changed the code to this new one:



 boxcoxnc(dataframe$droms, method='sw', lambda2=2, lambda =seq(-5,5,0.01),plot=TRUE, alpha=0.05, verbose=TRUE)

lambda.hat : -0.53
statistic : 0.9895904
p.value : 0.1819954

Result : Transformed data are normal.


And I proceeded to apply the transformation:



dataframe$droms_normalized <- (dataframe$droms^-0.53-1)/-0.53


But when I try to check again the normality looking at the histogram, I don't get the same histogram given by the boxcox transformation and I get this output from the Shapiro Wilk Test:



W = NaN, p-value = NA


Could you help me to identify what I am doing wrong in the transformation?



Thank you so much!










share|improve this question























  • It's a pity that you don't provide reproducible sample data. Provided I understood correctly, you're estimating the parameter lambda of a two parameter Box-Cox transformation (with a non-zero shift parameter lambda2). So you need to account for the shift parameter when calculating dataframe$droms_normalized. Try ((dataframe$droms + 2)^-0.53-1)/-0.53.

    – Maurits Evers
    Jan 2 at 12:38








  • 1





    Thank you so much!

    – Iraida
    Jan 2 at 12:43














0












0








0








this is my first question in this forum which I find very helpful! I have got a problem that I don't know how to interpret or solve it:



I've got measurements of a biochemical parameter (named 'droms') which doesn't reach normality. So, I did a BoxCox transformation following this code:



sum(is.na(dataframe$droms))
[1] 0
boxcoxnc(dataframe$droms, method='sw', lambda =seq(-5,5,0.01),plot=TRUE, alpha=0.05, verbose=TRUE)

Error in boxcoxnc(data_turbidez$droms, method = "sw", lambda = seq(-5, :
Data must include positive values. Specify shifting parameter, lambda2


So, I changed the code to this new one:



 boxcoxnc(dataframe$droms, method='sw', lambda2=2, lambda =seq(-5,5,0.01),plot=TRUE, alpha=0.05, verbose=TRUE)

lambda.hat : -0.53
statistic : 0.9895904
p.value : 0.1819954

Result : Transformed data are normal.


And I proceeded to apply the transformation:



dataframe$droms_normalized <- (dataframe$droms^-0.53-1)/-0.53


But when I try to check again the normality looking at the histogram, I don't get the same histogram given by the boxcox transformation and I get this output from the Shapiro Wilk Test:



W = NaN, p-value = NA


Could you help me to identify what I am doing wrong in the transformation?



Thank you so much!










share|improve this question














this is my first question in this forum which I find very helpful! I have got a problem that I don't know how to interpret or solve it:



I've got measurements of a biochemical parameter (named 'droms') which doesn't reach normality. So, I did a BoxCox transformation following this code:



sum(is.na(dataframe$droms))
[1] 0
boxcoxnc(dataframe$droms, method='sw', lambda =seq(-5,5,0.01),plot=TRUE, alpha=0.05, verbose=TRUE)

Error in boxcoxnc(data_turbidez$droms, method = "sw", lambda = seq(-5, :
Data must include positive values. Specify shifting parameter, lambda2


So, I changed the code to this new one:



 boxcoxnc(dataframe$droms, method='sw', lambda2=2, lambda =seq(-5,5,0.01),plot=TRUE, alpha=0.05, verbose=TRUE)

lambda.hat : -0.53
statistic : 0.9895904
p.value : 0.1819954

Result : Transformed data are normal.


And I proceeded to apply the transformation:



dataframe$droms_normalized <- (dataframe$droms^-0.53-1)/-0.53


But when I try to check again the normality looking at the histogram, I don't get the same histogram given by the boxcox transformation and I get this output from the Shapiro Wilk Test:



W = NaN, p-value = NA


Could you help me to identify what I am doing wrong in the transformation?



Thank you so much!







r statistics normalization






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 2 at 12:25









Iraida Iraida

12




12













  • It's a pity that you don't provide reproducible sample data. Provided I understood correctly, you're estimating the parameter lambda of a two parameter Box-Cox transformation (with a non-zero shift parameter lambda2). So you need to account for the shift parameter when calculating dataframe$droms_normalized. Try ((dataframe$droms + 2)^-0.53-1)/-0.53.

    – Maurits Evers
    Jan 2 at 12:38








  • 1





    Thank you so much!

    – Iraida
    Jan 2 at 12:43



















  • It's a pity that you don't provide reproducible sample data. Provided I understood correctly, you're estimating the parameter lambda of a two parameter Box-Cox transformation (with a non-zero shift parameter lambda2). So you need to account for the shift parameter when calculating dataframe$droms_normalized. Try ((dataframe$droms + 2)^-0.53-1)/-0.53.

    – Maurits Evers
    Jan 2 at 12:38








  • 1





    Thank you so much!

    – Iraida
    Jan 2 at 12:43

















It's a pity that you don't provide reproducible sample data. Provided I understood correctly, you're estimating the parameter lambda of a two parameter Box-Cox transformation (with a non-zero shift parameter lambda2). So you need to account for the shift parameter when calculating dataframe$droms_normalized. Try ((dataframe$droms + 2)^-0.53-1)/-0.53.

– Maurits Evers
Jan 2 at 12:38







It's a pity that you don't provide reproducible sample data. Provided I understood correctly, you're estimating the parameter lambda of a two parameter Box-Cox transformation (with a non-zero shift parameter lambda2). So you need to account for the shift parameter when calculating dataframe$droms_normalized. Try ((dataframe$droms + 2)^-0.53-1)/-0.53.

– Maurits Evers
Jan 2 at 12:38






1




1





Thank you so much!

– Iraida
Jan 2 at 12:43





Thank you so much!

– Iraida
Jan 2 at 12:43












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54006362%2fwhy-i-get-p-value-na-in-shapiro-wilk-test-after-a-boxcox-transformation%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54006362%2fwhy-i-get-p-value-na-in-shapiro-wilk-test-after-a-boxcox-transformation%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas