<div dir="ltr">Boa tarde Alexandre,<div><br></div><div><span style="font-size:12.8000001907349px">Alexandre</span><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">A linha que sugeri é para ser rodada após a função do Walmes, ficando desta forma:</div><span class="im" style="font-size:12.8000001907349px"><div><br></div><div><span style="font-size:12.8000001907349px">#Variáveis artificiais</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">var1<-sort(rnorm(30,1), decreasing = TRUE)</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">var2<-rnorm(30,10)</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">var3<-sort(rnorm(30,22))</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">var4<-sort(rnorm(30,10))</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">var5<-sort(rnorm(30,0.5), decreasing = TRUE)</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">var6<-sort(rnorm(30,25), decreasing = TRUE)</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">var7<-rnorm(30,10)</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">dados<-cbind(var1,var2,var3,</span><span style="font-size:12.8000001907349px">var4,var5,var6,var7)</span><br></div><div><br></div></span><div style="font-size:12.8000001907349px"><span class="im"><div>pn <- function(X){crossprod(!<a href="http://is.na/" target="_blank">is.na</a>(X))} </div><div><br></div><div>cor.prob <- function(X){ </div><div>     pair.SampSize <- pn(X) </div><div>     above1 <- row(pair.SampSize) < col(pair.SampSize) </div><div>     pair.df <- pair.SampSize[above1] - 2 </div><div>     </div><div>     R <- cor(X, use="pair") </div><div>     above2 <- row(R) < col(R) </div><div>     r2 <- R[above2]^2 </div><div>     Fstat <- (r2 * pair.df)/(1 - r2) </div><div>     R[above2] <- 1 - pf(Fstat, 1, pair.df) </div><div>     R</div><div>     } </div><div><br></div><div>         </div></span><div>correla <- round(cor.prob(dados),2) </div></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px"><span class="im"><div>cor.probC <- function(x){</div><div><br></div><div>    results <- x</div><div>    ifelse(row(x)< col(x),ifelse(x<=0.05,NA,x),ifelse(x<=0.08,NA,x))</div><div>}</div><div><br></div><div><br></div><div><br></div></span><div>cr <- cor.probC(correla)</div><div>colnames(cr)  <- names(dados)</div><div>rownames(cr) <- names(dados)</div><div>cr</div><div><br></div><div><br></div><div>Tentei colorir as células de acordo com as exigencias para a correlação e o p-valor, mas não tenho conhecimento para isso.</div><div><br></div><div>Outra coisa, seria muito bom colocarmos lado a lado, em colunas, os valores da correlação e o p-valor, facilitaria muito a análise...</div><div><br></div><div><br></div><div>Abraço</div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">Em 2 de setembro de 2015 00:25, ASANTOS [via R-br] <span dir="ltr"><<a href="mailto:ml-node+s2285057n4665017h95@n4.nabble.com" target="_blank">ml-node+s2285057n4665017h95@n4.nabble.com</a>></span> escreveu:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

        
  
    
  
  
    Boa noite Hélio,<br>
    <br>
            Estou mexendo ainda, mas ainda não funcionou, veja o CRM
    abaixo, comparando a sua função e a do Walmes:<br>
    <br>
    #Variáveis artificiais<br>
    var1<-sort(rnorm(30,1), decreasing = TRUE)<br>
    var2<-rnorm(30,10)<br>
    var3<-sort(rnorm(30,22))<br>
    var4<-sort(rnorm(30,10))<br>
    var5<-sort(rnorm(30,0.5), decreasing = TRUE)<br>
    var6<-sort(rnorm(30,25), decreasing = TRUE)<br>
    var7<-rnorm(30,10)<br>
    dados<-cbind(var1,var2,var3,var4,var5,var6,var7)<br>
    <br>
    #Função by IFSULDEMINAS<br>
    cor.probC <- function(x){<br>
    <br>
        results <- x<br>
        ifelse(row(x)<
    col(x),ifelse(x<=0.05,NA,x),ifelse(x<=0.08,NA,x))<br>
    }<br>
    #<br>
    <br>
    #Teste<br>
    cor.probC(dados)<br>
    <br>
    <br>
    require(Hmisc)## Pacote<span class=""><br>
    <br>
    <br>
    #Função que dispõem p valor na diagonal superior e r valor na
    inferior<br>
    <br>
    pn <- function(X){crossprod(!<a href="http://is.na" target="_blank">is.na</a>(X))}<br>
    <br>
    cor.prob <- function(X){<br>
        pair.SampSize <- pn(X)<br>
        above1 <- row(pair.SampSize) < col(pair.SampSize)<br>
        pair.df <- pair.SampSize[above1] - 2<br>
        R <- cor(X, use="pair")<br>
        above2 <- row(R) < col(R)<br>
        r2 <- R[above2]^2<br>
        Fstat <- (r2 * pair.df)/(1 - r2)<br>
        R[above2] <- 1 - pf(Fstat, 1, pair.df)<br>
        R<br>
    }<br>
    <br>
    #Resultado da matriz<br>
    cor.prob(dados)<br>
    #<br>
    <br>
    </span><span class=""><pre cols="72">-- 
======================================================================
Alexandre dos Santos
Proteção Florestal 
IFMT - Instituto Federal de Educação, Ciência e Tecnologia de Mato Grosso
Campus Cáceres
Caixa Postal 244
Avenida dos Ramires, s/n
Bairro: Distrito Industrial 
Cáceres - MT                      CEP: 78.200-000
Fone: <a href="tel:%28%2B55%29%2065%208132-8112" value="+556581328112" target="_blank">(+55) 65 8132-8112</a> (TIM)   <a href="tel:%28%2B55%29%2065%209686-6970" value="+556596866970" target="_blank">(+55) 65 9686-6970</a> (VIVO)
<a href="http:///user/SendEmail.jtp?type=node&node=4665017&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a> 
        <a href="http:///user/SendEmail.jtp?type=node&node=4665017&i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a> 
Lattes: <a href="http://lattes.cnpq.br/1360403201088680" rel="nofollow" link="external" target="_blank">http://lattes.cnpq.br/1360403201088680</a>                   
======================================================================</pre>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    </span><span class=""><div>Em 29/08/2015 11:35, Hélio Gallo Rocha
      escreveu:<br>
    </div>
    </span><blockquote style="border-left:2px solid #cccccc;padding:0 1em" type="cite">
      <div dir="ltr">Alexandre,
        <div><br>
        </div><span class="">
        <div>Conseguimos resolver, mas não rodando dentro da função,
          testa ai</div>
        <div><br>
        </div>
        <div>
          <div>correla <- cor.prob(dados) </div>
          <div>correla</div>
          <div>  </div>
          <div> </div>
          <div>corr <- ifelse(row(correla)<
col(correla),ifelse(correla<=0.05,NA,correla),ifelse(correla<=0.08,NA,correla));corr</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        </span><div class="gmail_extra"><br>
          <div class="gmail_quote"><span class="">Em 24 de agosto de 2015 16:50,
            ASANTOS [via R-br] <span dir="ltr"><<a href="http:///user/SendEmail.jtp?type=node&node=4665017&i=2" rel="nofollow" link="external" target="_blank">[hidden email]</a>></span>
            escreveu:<br>
            </span><blockquote style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote"><span class="">
              Boa tarde Helio,<br>
              <br>
                    Ainda não estou quebrando a cabeça nas partes above1
              <- row(pair.SampSize) < col(pair.SampSize) e  above2
              <- row(R) < col(R) que é onde vão as condições, mas
              esse é um caso para Programming master em R. Se funcionar
              essa seria uma boa função para seleção de variáveis
              multivariadas quando se trabalha com um p muito grande,<br>
              <br>
                    Vou continuar tentando,<br>
              <br>
              Abraços,</span><span><br>
                <br>
                <br>
                <pre cols="72">-- 
======================================================================
Alexandre dos Santos
Proteção Florestal 
IFMT - Instituto Federal de Educação, Ciência e Tecnologia de Mato Grosso
Campus Cáceres
Caixa Postal 244
Avenida dos Ramires, s/n
Bairro: Distrito Industrial 
Cáceres - MT                      CEP: 78.200-000
Fone: <a moz-do-not-send="true" href="tel:%28%2B55%29%2065%208132-8112" value="+556581328112" target="_blank">(+55) 65 8132-8112 (TIM)   <a moz-do-not-send="true" href="tel:%28%2B55%29%2065%209686-6970" value="<a href="tel:%2B556596866970" value="+556596866970" target="_blank">+556596866970</a>" target="_blank"><a href="tel:%28%2B55%29%2065%209686-6970" value="+556596866970" target="_blank">(+55) 65 9686-6970</a> (VIVO)
<div><div class="h5"><a href="http:///user/SendEmail.jtp?type=node&node=4664976&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a> 
        <a href="http:///user/SendEmail.jtp?type=node&node=4664976&i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a> 
Lattes: <a href="http://lattes.cnpq.br/1360403201088680" rel="nofollow" link="external" target="_blank">http://lattes.cnpq.br/1360403201088680</a>                   
======================================================================
</div></div></pre>
                <br>
                <br>
              </span><div><div class="h5"><span>
                <div>Em 24/08/2015 15:35, Hélio Gallo Rocha escreveu:<br>
                </div>
              </span>
              <blockquote style="border-left:2px solid #cccccc;padding:0 1em" type="cite"><span>
                  <div dir="ltr"><span style="font-size:12.8000001907349px">Alexandre,</span>
                    <div style="font-size:12.8000001907349px"><br>
                    </div>
                    <div style="font-size:12.8000001907349px">Conseguiu
                      resolver esta questão?</div>
                    <div style="font-size:12.8000001907349px"><br>
                    </div>
                    <div style="font-size:12.8000001907349px">Olhei o
                      site sugerido pelo Walmes, mas ñ consegui inserir
                      na função.</div>
                    <div style="font-size:12.8000001907349px"><br>
                    </div>
                    <div style="font-size:12.8000001907349px">Se der
                      resultado, posta na lista, pois a é bem
                      iteressante.</div>
                    <div style="font-size:12.8000001907349px"><br>
                    </div>
                    <div style="font-size:12.8000001907349px">Abraço</div>
                  </div>
                </span>
                <div>
                  <div>
                    <div class="gmail_extra"><br>
                      <div class="gmail_quote">Em 19 de agosto de 2015
                        21:38, Walmes Zeviani 2 [via R-br] <span dir="ltr"><<a href="http:///user/SendEmail.jtp?type=node&node=4664976&i=2" rel="nofollow" link="external" target="_blank">[hidden email]</a>></span>
                        escreveu:<br>
                        <blockquote style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote">
                          <div dir="ltr">
                            <div class="gmail_default">Isso pode servir de
                              inspiração.<br>
                              <br>
                              <a href="http://stackoverflow.com/questions/9439619/using-r-replace-all-values-in-a-matrix-0-1-with-0" rel="nofollow" link="external" target="_blank">http://stackoverflow.com/questions/9439619/using-r-replace-all-values-in-a-matrix-0-1-with-0</a><br>
                              <br>
                              À disposição.<br>
                            </div>
                            <div class="gmail_default">Walmes.<br>
                            </div>
                            ​</div>
                          <span> <br>
                            _______________________________________________

                            <br>
                            R-br mailing list <br>
                            <a href="http:///user/SendEmail.jtp?type=node&node=4664945&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a> <br>
                            <a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" rel="nofollow" link="external" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
                            Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" rel="nofollow" link="external" target="_blank"></a><a href="http://www.leg.ufpr.br/r-br-guia" rel="nofollow" link="external" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>)
                            e forneça código mínimo reproduzível. <br>
                            <br>
                            <hr noshade size="1" color="#cccccc"> </span>
                          <div style="color:rgb(68,68,68);font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12px;line-height:normal;font-family:tahoma,geneva,helvetica,arial,sans-serif"><span>
                              <div style="font-weight:bold">If you reply
                                to this email, your message will be
                                added to the discussion below:</div>
                            </span><a href="http://r-br.2285057.n4.nabble.com/R-br-Exibicao-de-matriz-de-correlacao-dada-uma-condicao-tp4664911p4664945.html" rel="nofollow" link="external" target="_blank">http://r-br.2285057.n4.nabble.com/R-br-Exibicao-de-matriz-de-correlacao-dada-uma-condicao-tp4664911p4664945.html</a>
                          </div>
                          <div>
                            <div>
                              <div style="color:rgb(102,102,102);font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;font-family:tahoma,geneva,helvetica,arial,sans-serif;margin-top:0.4em;line-height:1.5em">
                                To unsubscribe from R-br, <a rel="nofollow" link="external">click here</a>.<br>
                                <a href="http://r-br.2285057.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9px;line-height:normal;font-family:serif" link="external" target="_blank">NAML</a>
                              </div>
                            </div>
                          </div>
                        </blockquote>
                      </div>
                      <br>
                      <br clear="all">
                      <div><br>
                      </div>
                      -- <br>
                      <div>Hélio Gallo Rocha<br>
                        IFSULDEMINAS - Câmpus Muzambinho<br>
                      </div>
                    </div>
                    <br>
                    <fieldset></fieldset>
                    <br>
                    <pre>_______________________________________________
R-br mailing list
<a href="http:///user/SendEmail.jtp?type=node&node=4664976&i=3" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" rel="nofollow" link="external" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" rel="nofollow" link="external" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.</pre>
                  </div>
                </div>
              </blockquote>
              <div>
                <div> <br>
                  <br>
                  _______________________________________________
                  <br>
                  R-br mailing list
                  <br>
                  <a href="http:///user/SendEmail.jtp?type=node&node=4664976&i=4" rel="nofollow" link="external" target="_blank">[hidden
                    email]</a>
                  <br>
                  <a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" rel="nofollow" link="external" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
                  Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" rel="nofollow" link="external" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>)
                  e forneça código mínimo reproduzível. <br>
                  <br>
                  <hr noshade size="1" color="#cccccc"> </div>
              </div>
              <div style="color:rgb(68,68,68);font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12px;line-height:normal;font-family:tahoma,geneva,helvetica,arial,sans-serif">
                <div>
                  <div>
                    <div style="font-weight:bold">If you reply to this
                      email, your message will be added to the
                      discussion below:</div>
                  </div>
                </div>
                <a href="http://r-br.2285057.n4.nabble.com/R-br-Exibicao-de-matriz-de-correlacao-dada-uma-condicao-tp4664911p4664976.html" rel="nofollow" link="external" target="_blank">http://r-br.2285057.n4.nabble.com/R-br-Exibicao-de-matriz-de-correlacao-dada-uma-condicao-tp4664911p4664976.html</a>
              </div>
              <div>
                <div>
                  <div style="color:rgb(102,102,102);font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;font-family:tahoma,geneva,helvetica,arial,sans-serif;margin-top:0.4em;line-height:1.5em">
                    To unsubscribe from R-br, <a rel="nofollow" link="external">click here</a>.<br>
                    <a href="http://r-br.2285057.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9px;line-height:normal;font-family:serif" link="external" target="_blank">NAML</a> </div>
                </div>
              </div>
            </div></div></blockquote>
          </div><div><div class="h5">
          <br>
          <br clear="all">
          <div><br>
          </div>
          -- <br>
          <div>Hélio Gallo Rocha<br>
            IFSULDEMINAS - Câmpus Muzambinho<br>
          </div>
        </div></div></div>
      </div><div><div class="h5">
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
R-br mailing list
<a href="http:///user/SendEmail.jtp?type=node&node=4665017&i=3" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" rel="nofollow" link="external" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" rel="nofollow" link="external" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.</pre>
    </div></div></blockquote><div><div class="h5">
    <br>
    <pre cols="72"></pre>
  

<br>_______________________________________________
<br>R-br mailing list
<br><a href="http:///user/SendEmail.jtp?type=node&node=4665017&i=4" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" rel="nofollow" link="external" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" rel="nofollow" link="external" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.

        
        
        
        <br>
        <br>
        <hr noshade size="1" color="#cccccc">
        </div></div><div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif"><div><div class="h5">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                </div></div><a href="http://r-br.2285057.n4.nabble.com/R-br-Exibicao-de-matriz-de-correlacao-dada-uma-condicao-tp4664911p4665017.html" target="_blank">http://r-br.2285057.n4.nabble.com/R-br-Exibicao-de-matriz-de-correlacao-dada-uma-condicao-tp4664911p4665017.html</a>
        </div><div class="HOEnZb"><div class="h5">
        <div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
                
                To unsubscribe from R-br, <a href="http://r-br.2285057.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3357982&code=aGVsaW9nYWxsb3JvY2hhQGdtYWlsLmNvbXwzMzU3OTgyfC0xMzQ3NTkwMDY4" target="_blank">click here</a>.<br>
                <a href="http://r-br.2285057.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_blank">NAML</a>
        </div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Hélio Gallo Rocha<br>IFSULDEMINAS - Câmpus Muzambinho<br></div>
</div>