Re: [R-br] Criando variáveis

2018-08-16 Por tôpico Felipe via R-br

Consegui da seguinte forma:


library(tidyverse)

new<-dados %>%spread(key=IndicatorName,value=Value)


Em 16/08/2018 21:13, Felipe escreveu:

Prezados, tenho um conjunto de dados como segue abaixo:

dados<-structure(list(IndicatorName = structure(c(323L, 713L, 713L,
55L, 185L, 293L, 291L, 832L, 834L, 720L, 715L, 186L, 710L, 294L,
735L, 323L, 187L, 55L, 49L, 1112L, 414L, 944L, 709L, 715L, 723L
), .Label = c("2005 PPP conversion factor, GDP (LCU per international 
$)",
"2005 PPP conversion factor, private consumption (LCU per 
international $)",
"Access to electricity (% of population)", "Access to electricity, 
rural (% of rural population)",
"Access to electricity, urban (% of urban population)", "Access to 
non-solid fuel (% of population)",
"Access to non-solid fuel, rural (% of rural population)", "Access to 
non-solid fuel, urban (% of urban population)",
"Adequacy of social insurance programs (% of total welfare of 
beneficiary households)",
"Adequacy of social protection and labor programs (% of total welfare 
of beneficiary households)",
"Adequacy of social safety net programs (% of total welfare of 
beneficiary households)",
"Adequacy of unemployment benefits and ALMP (% of total welfare of 
beneficiary households)",
"Adjusted net enrolment rate, primary, both sexes (%)", "Adjusted net 
enrolment rate, primary, female (%)",
"Adjusted net enrolment rate, primary, male (%)", "Adjusted net 
national income (annual % growth)",
"Adjusted net national income (constant 2005 US$)", "Adjusted net 
national income (current US$)",

"Adjusted net national income per capita (annual % growth)",
"Adjusted net national income per capita (constant 2005 US$)",
"Adjusted net national income per capita (current US$)", "Adjusted net 
savings, excluding particulate emission damage (% of GNI)",
"Adjusted net savings, excluding particulate emission damage (current 
US$)",

"Adjusted net savings, including particulate emission damage (% of GNI)",
"Adjusted net savings, including particulate emission damage (current 
US$)",
"Adjusted savings: carbon dioxide damage (% of GNI)", "Adjusted 
savings: carbon dioxide damage (current US$)",

"Adjusted savings: consumption of fixed capital (% of GNI)",
"Adjusted savings: consumption of fixed capital (current US$)",
"Adjusted savings: education expenditure (% of GNI)", "Adjusted 
savings: education expenditure (current US$)",
"Adjusted savings: energy depletion (% of GNI)", "Adjusted savings: 
energy depletion (current US$)",
"Adjusted savings: gross savings (% of GNI)", "Adjusted savings: 
mineral depletion (% of GNI)",
"Adjusted savings: mineral depletion (current US$)", "Adjusted 
savings: natural resources depletion (% of GNI)",
"Adjusted savings: net forest depletion (% of GNI)", "Adjusted 
savings: net forest depletion (current US$)",
"Adjusted savings: net national savings (% of GNI)", "Adjusted 
savings: net national savings (current US$)",
"Adjusted savings: particulate emission damage (% of GNI)", "Adjusted 
savings: particulate emission damage (current US$)",

"Adolescent fertility rate (births per 1,000 women ages 15-19)",
"Adult literacy rate, population 15+ years, both sexes (%)",
"Adult literacy rate, population 15+ years, female (%)", "Adult 
literacy rate, population 15+ years, male (%)",
"Age dependency ratio (% of working-age population)", "Age dependency 
ratio, old (% of working-age population)",

"Age dependency ratio, young (% of working-age population)",
"Agricultural irrigated land (% of total agricultural land)",
"Agricultural land (% of land area)", "Agricultural land (sq. km)",
"Agricultural machinery, tractors", "Agricultural machinery, tractors 
per 100 sq. km of arable land",
"Agricultural methane emissions (% of total)", "Agricultural methane 
emissions (thousand metric tons of CO2 equivalent)",
"Agricultural nitrous oxide emissions (% of total)", "Agricultural 
nitrous oxide emissions (thousand metric tons of CO2 equivalent)",

"Agricultural raw materials exports (% of merchandise exports)",
"Agricultural raw materials imports (% of merchandise imports)",
"Agriculture value added per worker (constant 2005 US$)", 
"Agriculture, value added (% of GDP)",
"Agriculture, value added (annual % growth)", "Agriculture, value 
added (constant 2005 US$)",
"Agriculture, value added (constant LCU)", "Agriculture, value added 
(current LCU)",
"Agriculture, value added (current US$)", "Air transport, freight 
(million ton-km)",
"Air transport, passengers carried", "Air transport, registered 
carrier departures worldwide",
"All education staff compensation, primary (% of total expenditure in 
primary public institutions)",
"All education staff compensation, secondary (% of total expenditure 
in secondary public institutions)",
"All education staff compensation, tertiary (% of total expenditure in 
tertiary public institutions)",
"All education staff compensation, total (% of total expenditure in 
public institutions)",
"Alternative and nuclear energy (% of total e

[R-br] Criando variáveis

2018-08-16 Por tôpico Felipe via R-br

Prezados, tenho um conjunto de dados como segue abaixo:

dados<-structure(list(IndicatorName = structure(c(323L, 713L, 713L,
55L, 185L, 293L, 291L, 832L, 834L, 720L, 715L, 186L, 710L, 294L,
735L, 323L, 187L, 55L, 49L, 1112L, 414L, 944L, 709L, 715L, 723L
), .Label = c("2005 PPP conversion factor, GDP (LCU per international $)",
"2005 PPP conversion factor, private consumption (LCU per international 
$)",
"Access to electricity (% of population)", "Access to electricity, rural 
(% of rural population)",
"Access to electricity, urban (% of urban population)", "Access to 
non-solid fuel (% of population)",
"Access to non-solid fuel, rural (% of rural population)", "Access to 
non-solid fuel, urban (% of urban population)",
"Adequacy of social insurance programs (% of total welfare of 
beneficiary households)",
"Adequacy of social protection and labor programs (% of total welfare of 
beneficiary households)",
"Adequacy of social safety net programs (% of total welfare of 
beneficiary households)",
"Adequacy of unemployment benefits and ALMP (% of total welfare of 
beneficiary households)",
"Adjusted net enrolment rate, primary, both sexes (%)", "Adjusted net 
enrolment rate, primary, female (%)",
"Adjusted net enrolment rate, primary, male (%)", "Adjusted net national 
income (annual % growth)",
"Adjusted net national income (constant 2005 US$)", "Adjusted net 
national income (current US$)",

"Adjusted net national income per capita (annual % growth)",
"Adjusted net national income per capita (constant 2005 US$)",
"Adjusted net national income per capita (current US$)", "Adjusted net 
savings, excluding particulate emission damage (% of GNI)",
"Adjusted net savings, excluding particulate emission damage (current 
US$)",

"Adjusted net savings, including particulate emission damage (% of GNI)",
"Adjusted net savings, including particulate emission damage (current 
US$)",
"Adjusted savings: carbon dioxide damage (% of GNI)", "Adjusted savings: 
carbon dioxide damage (current US$)",

"Adjusted savings: consumption of fixed capital (% of GNI)",
"Adjusted savings: consumption of fixed capital (current US$)",
"Adjusted savings: education expenditure (% of GNI)", "Adjusted savings: 
education expenditure (current US$)",
"Adjusted savings: energy depletion (% of GNI)", "Adjusted savings: 
energy depletion (current US$)",
"Adjusted savings: gross savings (% of GNI)", "Adjusted savings: mineral 
depletion (% of GNI)",
"Adjusted savings: mineral depletion (current US$)", "Adjusted savings: 
natural resources depletion (% of GNI)",
"Adjusted savings: net forest depletion (% of GNI)", "Adjusted savings: 
net forest depletion (current US$)",
"Adjusted savings: net national savings (% of GNI)", "Adjusted savings: 
net national savings (current US$)",
"Adjusted savings: particulate emission damage (% of GNI)", "Adjusted 
savings: particulate emission damage (current US$)",

"Adolescent fertility rate (births per 1,000 women ages 15-19)",
"Adult literacy rate, population 15+ years, both sexes (%)",
"Adult literacy rate, population 15+ years, female (%)", "Adult literacy 
rate, population 15+ years, male (%)",
"Age dependency ratio (% of working-age population)", "Age dependency 
ratio, old (% of working-age population)",

"Age dependency ratio, young (% of working-age population)",
"Agricultural irrigated land (% of total agricultural land)",
"Agricultural land (% of land area)", "Agricultural land (sq. km)",
"Agricultural machinery, tractors", "Agricultural machinery, tractors 
per 100 sq. km of arable land",
"Agricultural methane emissions (% of total)", "Agricultural methane 
emissions (thousand metric tons of CO2 equivalent)",
"Agricultural nitrous oxide emissions (% of total)", "Agricultural 
nitrous oxide emissions (thousand metric tons of CO2 equivalent)",

"Agricultural raw materials exports (% of merchandise exports)",
"Agricultural raw materials imports (% of merchandise imports)",
"Agriculture value added per worker (constant 2005 US$)", "Agriculture, 
value added (% of GDP)",
"Agriculture, value added (annual % growth)", "Agriculture, value added 
(constant 2005 US$)",
"Agriculture, value added (constant LCU)", "Agriculture, value added 
(current LCU)",
"Agriculture, value added (current US$)", "Air transport, freight 
(million ton-km)",
"Air transport, passengers carried", "Air transport, registered carrier 
departures worldwide",
"All education staff compensation, primary (% of total expenditure in 
primary public institutions)",
"All education staff compensation, secondary (% of total expenditure in 
secondary public institutions)",
"All education staff compensation, tertiary (% of total expenditure in 
tertiary public institutions)",
"All education staff compensation, total (% of total expenditure in 
public institutions)",
"Alternative and nuclear energy (% of total energy use)", "Annual 
freshwater withdrawals, agriculture (% of total freshwater withdrawal)",
"Annual freshwater withdrawals, domestic (% of to

Re: [R-br] Distribuições Gamma e Inversa Gaussiana

2017-06-21 Por tôpico Felipe via R-br

Pode usar a função optim:

### Gamma
G <- function(par, x)
{
  sum(dgamma(x, shape = par[1], rate = par[2], log = TRUE))
}


emv.G   <- optim(par = c(1, 10), fn = G, x = dados,
  ,control=list("fnscale"=-1), hessian=TRUE)
emv.G$par


# standard error
sqrt(diag(solve(-emv.G$hessian)))



--
Atenciosamente,


==
Felipe E. Barletta Mendes
Estatístico(UFPR) - Conre3 9766-A
Mestrando em Bioestatística(UEM)
+55 (41)-92077191
+55 (41)-33287216
===

___
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e fornea cdigo mnimo 
reproduzvel.

Re: [R-br] Ajuda no calculo entre duas datas

2017-03-23 Por tôpico Felipe via R-br

Pode usar a função as.integer()

idade <-as.integer(difftime(data_hoje, data_nascimento)/365)


--

Atenciosamente,


==
Felipe E. Barletta Mendes
Estatístico(UFPR) - Conre3 9766-A
Mestrando em Bioestatística(UEM)
+55 (41)-92077191
+55 (41)-33287216
===

___
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e fornea cdigo mnimo 
reproduzvel.

Re: [R-br] Verificar multicolinearidade

2017-03-23 Por tôpico Felipe via R-br
Você pode analisar via matriz de correlação e análise dos autovalores 
desta matriz pois se existir uma ou mais dependências lineares significa 
um ou mais autovalores são pequenos, também pode analisar o determinante 
da matriz de correlação, sabemos das aulas de Álgebra Linear que quando 
o det = 0 significa que há dependência linear entre os vetores. Pode 
também fazer análise gráfica de de Xi vs Xj (i≢j ≢),


E também há o VIF - Fator de inflação da variância

VIFj=1/1-R²j


R²j é o coeficiente de determinação múltiplo obtido pela regressão deXj 
com as demais covariáveis no modelo.



# VIF ##

vif<-function (obj, digits = 5) {
Qr <- obj$qr
if (is.null(obj$terms) || is.null(Qr))
stop("invalid 'lm' object:  no terms or qr component")
tt <- terms(obj)
hasintercept <- attr(tt, "intercept") > 0
p <- Qr$rank
if (hasintercept)
p1 <- 2:p
else p1 <- 1:p
R <- Qr$qr[p1, p1, drop = FALSE]
if (length(p1) > 1)
R[row(R) > col(R)] <- 0
Rinv <- qr.solve(R)
vv <- apply(Rinv, 1, function(x) sum(x^2))
ss <- apply(R, 2, function(x) sum(x^2))
vif <- ss * vv
signif(vif, digits)
   }
x <- rnorm(100,2,.5)
x2 <- 1.5+x^2+x
y <- rnorm(100)
mod1 <- lm(y~x+x2)
summary(mod1)
vif(mod1)





Em 22/03/2017 22:29, Elias Carvalho via R-br escreveu:

Boa noite pessoal

Alguém poderia me indicar os melhores métodos via R para identificar 
multicolinearidade de dados ?


Pelo que pesquisei no forum a maioria das informações parece ser 
antigas (2011 a 2015) por isso gostaria de algo mais recente.


--
/In Jesu et Maria

/
/Obrigado/
/Prof. Elias Carvalho/
/
/
/
"Felix, qui potuit rerum cognoscere causas" (Virgil 29 BC)
"Blessed is he who has been able to understand the cause of things"
/


___
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forne�a c�digo 
m�nimo reproduz�vel.


--
Atenciosamente,


==
Felipe E. Barletta Mendes
Estatístico(UFPR) - Conre3 9766-A
Mestrando em Bioestatística(UEM)
+55 (41)-92077191
+55 (41)-33287216
===

___
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forne�a c�digo 
m�nimo reproduz�vel.

Re: [R-br] Problemas em cortar linhas iguais

2017-02-20 Por tôpico Felipe via R-br

dados$NOME2 <- gsub(" ","", dados$NOME)
dados2 <- dplyr::distinct(dados,NOME2,FILIACAO)



___
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e fornea cdigo mnimo 
reproduzvel.

Re: [R-br] Material para estudo (Modelos Aditivos linear generalizado)

2017-02-02 Por tôpico Felipe via R-br

Fernando segue algumas referências.

http://www.leg.ufpr.br/doku.php/projetos:mortalidade

https://cran.r-project.org/web/packages/mgcv/mgcv.pdf

http://plantecology.syr.edu/fridley/bio793/gam.html

http://www.petrkeil.com/?p=2385


Em 02/02/2017 16:11, Fernando Antonio de souza via R-br escreveu:

Caros colegas,

Alguém dispõe de material sobre modelos aditivos e que possuam 
exemplos voltados ao R que possa compartilhar? De preferência em português


Att


--
=
Fernando Souza
Zootecnista, DSc. Produção e Alimentação Animal
Celular: (31)99796-8781 (Vivo)
E-mail:nandodeso...@gmail.com 
Lattes: http://lattes.cnpq.br/6519538815038307
Blog: https://producaoanimalcomr.wordpress.com/
==


___
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forne�a c�digo 
m�nimo reproduz�vel.


--
Atenciosamente,


==
Felipe E. Barletta Mendes
Estatístico(UFPR) - Conre3 9766-A
Mestrando em Bioestatística(UEM)
+55 (41)-92077191
+55 (41)-33287216
===

___
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forne�a c�digo 
m�nimo reproduz�vel.

Re: [R-br] Loop para ler e trabalhar com diversos arquivos simultaneamente

2016-11-17 Por tôpico Felipe via R-br


Yuri, pode ler e carregar vários arquivos da seguinte maneira (e criar 
diretório):

(Não testei com seus dados)


### Indica diretório que vai trabalhar
setwd('~/caminho/')

# lista todos os arquivos com extensão .csv
input <- dir(pattern='.txt')
L <- length(input)

### Lendo arquivos e salvando em uma lista
dados <- NULL
for (i in 1:L){
dados[[i]] <- read.table(input[i],h=T)
cat(input[i],'\n')
}


agora é só fazer os cálculos que deseja e depois pode crira um diretório 
para salvar


### Cria diretório
dir.create('~/caminho/')


--

Atenciosamente,


==
Felipe E. Barletta Mendes
Estatístico(UFPR) - Conre3 9766-A
Mestrando em Bioestatística(UEM)
+55 (41)-92077191
+55 (41)-33287216
===

___
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forne�a c�digo 
m�nimo reproduz�vel.

Re: [R-br] Dúvida para gerar gráfico

2016-10-31 Por tôpico Felipe via R-br

## dados

dados <- structure(c(2.71776792884716, 2.80971971474984, 2.65490262437138,
2.81712246434492, 2.96314794044754, 2.48998766335135, 3.90971067836738,
3.56740293299039, 3.12240458083219, 2.44655356979548, 2.60740924526302,
3.04740091582981, 2.68533220439005, 3.11200959394312, 2.79089422500219,
3.31952328998178, 2.70689315323196, 2.9800351726207, 2.78334397202765,
2.701492681034, 2.8126203708, 2.06557636006153, 3.10254526952989,
2.6060370591154, 2.82776256991182, 2.55475281126045, 2.75669239356911,
2.17642127258464, 2.27914200068542, 2.34369002346959, 2.38569538401917,
2.20725309018804, 2.30034217251805, 2.31125265578062, 2.25004526681248,
2.82017666857997, 2.15477493636968, 2.13869253661224, 2.15582724426898,
2.04481764402476, 2.08895705916863, 1.98549711505164, 1.95236035664275,
1.85956001381077, 1.84849520585033, 1.73612037173621, 1.84606327731254,
2.06050010899242, 2.04340322596147, 1.48059542419918, 1.5897647349459,
1.83493113709698, 1.87723712290912, 1.86135270464316, 2.50520554686019,
1.49145374049223, 2.03706434893404, 1.98181583080439, 2.16558578443014,
1.92228278753351, 1.94135389144282, 1.85041568811821, 2.40033084397389,
2.22902645167497, 2.38070069752142, 2.46428303483512, 2.32698445546991,
2.97655298983297, 2.6730853845772, 2.58224425238168, 2.7792170454293,
2.35224398095467, 1.06029132663049, 1.94432371641046, 2.30470221885002,
2.95965145506887, 2.80586624373959, 2.58419197793719, 2.75901886105652,
2.38893524012871, 0, 2.52015355419062, 2.32376593912811, 2.74572912831904,
2.82729209155284, 3.15276574678139, 2.66311281766592, 3.44658279995033,
2.83634142101896, 0, 2.78936876560345, 3.10384386680356, 2.94733611308899,
3.23818940525282, 2.9025264542456, 2.92016810377702, 3.01739975150593,
2.51447627714607, 0, 3.14272836942838, 2.77071446571446, 2.82080993740916,
3.0813578745847, 3.09390782916134, 3.57884974438802, 3.4796451520399,
3.05046593961632, 0), .Dim = c(9L, 12L), .Dimnames = list(NULL,
c("JAN", "FEV", "MAR", "ABR", "MAI", "JUN", "JUL", "AGO",
  "SET", "OUT", "NOV", "DEZ")))

## O que você quer é isso?
xyplot(ts(dados))

## Ou isso?

xyplot(ts(dados), superpose = TRUE,main='Equação de Penman',
   auto.key = list(space = "left"))


--
Atenciosamente,


==
Felipe E. Barletta Mendes
Estatístico(UFPR) - Conre3 9766-A
Mestrando em Bioestatística(UEM)
+55 (41)-92077191
+55 (41)-33287216
===

___
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e fornea cdigo mnimo 
reproduzvel.

Re: [R-br] Ajuste de modelo não linear

2016-10-17 Por tôpico Felipe via R-br
Andre, segue minha contribuição com um modelo logístico com quatro 
parâmetros:


phi1+(phi2-phi1)/1+exp((phi3-x)/phi4), em que:

phi1 é a assíntota inferior;
phi2 é a assíntota superior;
phi3 é o ponto de inflexão;
phi4 é um parâmetro de escala.

Você pode tentar ajustar um modelo sem assíntota inferior e ver como o 
ajuste fica, note que assim o valor da função será zero somente em anos 
tendendo a menos infinito o que não faz sentido na prática.

Pode tentar ajustar com a variável anos em sua escala original também.

#==

Brasil <- c(13.63, 13.93, 14.09, 15.12, 15.98, 16.08, 16.45, 17.96,
18.83, 19.28, 19.18, 20.89, 21.87, 21.85, 23.43, 25.38,
25.64, 26.99, 28.68, 31.92, 32.92, 33.32, 34.37, 34.99,
36.08, 37.72, 40.41, 42.81, 44.18, 44.91, 48.97, 51.59,
53.44, 56.49, 62.2, 66.49, 67.01, 68.41, 74.14, 77.58,
80.39, 85.71, 89.58, 96.3, 100.9, 102.8, 107.69, 111.51,
111.42, 116.59, 118.85, 121.42, 127.53)

anos <- 1961:2013
anos2 <- anos - min(anos) + 1

library(nlme)
mod1 <- nls(Brasil~SSfpl(anos2,A,B,C,D))
parm <- coef(mod1)
phi1 <- parm[1]
phi2 <-parm[2]
phi3 <- parm[3]
phi4 <- parm[4]


plot(Brasil~anos2)
with(as.list(coef(mod1)),
 curve(phi1+(phi2-phi1)/(1+exp((phi3-anos2)/phi4)),
   xname = "anos2",
   add = TRUE,
   col = 4))




--

Atenciosamente,


==
Felipe E. Barletta Mendes
Estatístico(UFPR) - Conre3 9766-A
Mestrando em Bioestatística(UEM)
+55 (41)-92077191
+55 (41)-33287216
===

___
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e fornea cdigo mnimo 
reproduzvel.

Re: [R-br] Identificar variáveis dicotomicas

2016-10-03 Por tôpico Felipe via R-br
Se as variáveis dicotômicas tiverem valores 0 ou 1, pode tentar da 
seguinte maneira:



dados <- data.frame(x1=rbinom(100,1,.5),x2=rnorm(100))
sapply(dados, function(x) all(x%in%c(0,1)))
   x1x2
 TRUE FALSE
___
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e fornea cdigo mnimo 
reproduzvel.

Re: [R-br] Superfície de Resposta

2016-08-23 Por tôpico Felipe via R-br

Segue um exemplo simples com dados fictícios:
# Exemplo com x1:Tempo e x2:temperatura e y:reposta
x1 <- c(-1,-1,1,1,0,0,0,0,0,sqrt(2),-sqrt(2),0,0)
x2 <- c(-1,1,-1,1,0,0,0,0,0,0,0,sqrt(2),-sqrt(2))
y2 <- c(76.5,77,78,79.5,79.9,80.3,80,79.7,79.8,78.4,75.6,78.5,77)
mod <- lm(y2 ~ x1*x2+I(x1^2)+I(x2^2))

summary(mod)

alr3::pureErrorAnova(mod)


### Para construir a superficie de resposta, inicialmente, deve ser gerada
### uma sequencia valores dos niveis dos fatores
x <- seq(-sqrt(2),sqrt(2),l=30)
y <- seq(-sqrt(2),sqrt(2),l=30)

z <- function(x=x,y=y){
y <- mod$coef[1]+mod$coef[2]*x+mod$coef[3]*y+mod$coef[4]*x^2+
 mod$coef[5]*y^2+mod$coef[6]*x*y
}
mod

## Comando outer prepara os dados para serem utilizados pela função persp
z <- outer(x,y,z)
z
persp(x,y,z,theta=-35,phi=5,expand=0.5,xlab='Tempo',ticktype='detailed',
  ylab='Temperatura',zlab='Resposta',scale=T,col='gray80')


image(x,y,z,col=heat.colors(155))
contour(x,y,z,add=T)

# Incluindo legenda
fields::image.plot(x,y,z,col=rev(heat.colors(155)))



# Ponto estacionario
b <- matrix(c(mod$coef[2],mod$coef[3]));b
B <- matrix(c(mod$coef[4],mod$coef[6]/2,mod$coef[6]/2,mod$coef[5]),ncol=2);B

x0 <- -.5*solve(B)%*%b;x0

tempo <- x0[1]*5+85
temperatura <- x0[2]*5+175

image(x,y,z,col=heat.colors(115))
contour(x,y,z,add=T)
points(x0[1],x0[2],col='darkgreen',pch=19)

# Ponto de maximo
y0 <- mod$coef[1]+1/2%*%t(x0)%*%b
y0

--
Atenciosamente
Felipe E. Barletta Mendes
Estatístico(UFPR) - Conre3 9766-A
Mestrando em Bioestatística(UEM)
+55 (41)-92077191
+55 (41)-33287216

___
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e fornea cdigo mnimo 
reproduzvel.

Re: [R-br] Markdown

2016-08-10 Por tôpico Felipe via R-br

Oi Andre.

A sugestão do Leonard pode resolver pois pode ser problema com a 
instalação do pandoc


Em alguns sistemas, é necessário criar os links simbólicos que estão 
nessa pagina:


https://github.com/rstudio/rmarkdown/blob/master/PANDOC.md


--
Atenciosamente
Felipe E. Barletta Mendes
Estatístico(UFPR) - Conre3 9766-A
Mestrando em Bioestatística(UEM)
+55 (41)-92077191
+55 (41)-33287216

___
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e fornea cdigo mnimo 
reproduzvel.

Re: [R-br] Markdown

2016-08-07 Por tôpico Felipe via R-br

Tentou assim:

```{r,message=FALSE}
require(gdata)
```



Em 07-08-2016 11:04, Andre Oliveira via R-br escreveu:


boa dia,
como esconder estes avisos no R Markdown? Já pesquisei e não consegui 
resolver, quando carrego a gdata,  ficam estes estes avisos no texto.  
Minhas configurações no documento são:


```{r,include=F}
# Configuração global
require(knitr)
opts_chunk$set(echo = F,comment="",message=" ")
```
```{r}
require(gdata, quietly = TRUE)
gdata: read.xls support for 'XLS' (Excel 97-2004) files ENABLED.
gdata: read.xls support for 'XLSX' (Excel 2007+) files ENABLED.
Attaching package: ‘gdata’
The following object is masked from ‘package:stats’:
nobs
The following object is masked from ‘package:utils’:
object.size
The following object is masked from ‘package:base’:
startsWith
```


Obrigado!

André Oliveira Souza. Graduação em Matemática, mestrado em estatística 
aplicada.Instituto Federal de Educação, Ciência e Tecnologia do 
Espirito Santo.  IFES



___
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forne�a c�digo 
m�nimo reproduz�vel.


--
Atenciosamente
Felipe E. Barletta Mendes
Estatístico(UFPR) - Conre3 9766-A
Mestrando em Bioestatística(UEM)
+55 (41)-92077191
+55 (41)-33287216

___
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forne�a c�digo 
m�nimo reproduz�vel.

Re: [R-br] Extrair dados de ajuste

2016-07-05 Por tôpico Felipe via R-br

É isso que quer:

m.1 <- summary(model)
names(m.1)
m.1$parameters[,1]



Em 05-07-2016 15:21, Pedro Campelo via R-br escreveu:

Pessoal,

Estou rodando um script e preciso extrair os dados dos coeficientes 
ajustados para um modelo. No meu exemplo, quero extrair e separar os 
valores "k" e "n".


*/> data.frame(A)/*
*/ M R/*
*/1   10 24.61/*
*/2   20 29.41/*
*/3   30 33.07/*
*/4   40 37.37/*
*/5   50 38.22/*
*/6   60 41.14/*
*/7   70 41.61/*
*/8   80 43.41/*
*/9   90 47.18/*
*/10 100 48.77/*
*/11 110 51.02/*
*/12 120 52.95/*
*/13 130 52.98/*
*/14 140 52.92/*
*/
/*
*/> model<-nls(R~k*M^n, start=list(k=0.5,n=1))/*
*/> summary(model)/*


Obrigado


**
*
*
*
Pedro Henrique Campelo Felix*
/Bachelor of Food Engineering (UNI-BH)/
/Msc. Chemical Engineering (UFMG)/
/PhD Student of Food Science (UFLA)/

*+55 (31) 97560-1545 (TIM)*/
//"//Nós somos aquilo que fazemos repetidamente. Excelência, então, 
não é um modo de agir, mas um hábito." Aristóteles/



___
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forne�a c�digo 
m�nimo reproduz�vel.


--
Atenciosamente
Felipe E. Barletta Mendes
Estatístico(UFPR) - Conre3 9766-A
Mestrando em Bioestatística(UEM)
+55 (41)-92077191
+55 (41)-33287216

___
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forne�a c�digo 
m�nimo reproduz�vel.