[R-br] Erro em fit não linear
Michelle Bau Graczyk
mbgraczyk em gmail.com
Quinta Outubro 8 23:32:58 BRT 2015
Olá,
você diz eu colar aqui o dput ou mandar em anexo o data-set?
Em 8 de outubro de 2015 23:04, sznelwar <sznelwar em uol.com.br> escreveu:
> Tem o data-set para rodar?
>
>
> ------------------------------
>
>
> Caros,boa noite,
>
> estou tentando fazer um fit em um conjunto de dados mas ele me retorna o
> erro:
>
> Erro em nls(y ~ func(x, c, a, b), data = dados2, start = guess, trace =
> TRUE) :
> fator de passos 0.000488281 reduzido abaixo de 'minFactor' de 0.000976562
>
> Alguém, por favor, saberia me dizer como posso concertar isso?
> O programa segue abaixo:
> > require(lattice)
> > l<-1
> >
> file<-read.table(paste0("/Users/bau/ProjetoU-Shape/AA.N_Novo_MomentosEstatísticosSemestre",l,".txt"),
> header=TRUE)
> > media<-file[3:389,2]
> > media
> [1] 24117.500 13168.333 13861.667 18031.667 19581.667 18797.500
> 15147.500 16699.167 17911.667
> [10] 16430.000 15874.167 15470.000 16360.833 18240.000 15018.333
> 18155.833 14793.333 17348.333
> [19] 19142.500 21510.833 17417.500 17450.833 19335.833 14439.167
> 16995.000 14624.167 18152.500
> [28] 18240.000 16124.167 18489.167 14679.167 17181.667 18115.833
> 15302.500 13445.833 15159.167
> [37] 20161.667 15321.667 14252.500 15850.833 13745.000 13915.833
> 15810.833 13280.833 14680.833
> [46] 12119.167 12100.833 16263.333 13210.833 15323.333 12921.667
> 14374.167 12805.833 13955.000
> [55] 12920.833 12016.667 13795.000 14751.667 12735.833 12267.500
> 12896.667 11947.500 12723.333
> [64] 14574.167 12818.333 14187.500 11534.167 12134.167 10910.000
> 12596.667 11503.333 12515.833
> [73] 12709.167 14239.167 11495.000 13163.333 11990.000 10506.667
> 11984.167 10225.000 11447.500
> [82] 11966.667 12115.833 11273.333 10478.333 10375.000 12240.833
> 11178.333 10699.167 11474.167
> [91] 10075.000 12563.333 14194.167 13675.833 12290.000 11357.500
> 10956.667 12120.000 11663.333
> [100] 11078.333 11371.667 10549.167 12766.667 14523.333 10948.333
> 10809.167 10772.500 11190.000
> [109] 9748.333 14768.333 11070.000 10362.500 10942.500 9190.833
> 12433.333 10302.500 10838.333
> [118] 12184.167 8899.167 10073.333 10393.333 9760.000 10390.833
> 11309.167 9319.167 8183.333
> [127] 9531.667 9843.333 8924.167 10070.833 8730.000 10109.167
> 10507.500 11991.667 8540.833
> [136] 11396.667 9405.000 9284.167 9146.667 9640.000 8991.667
> 8352.500 7969.167 10366.667
> [145] 9319.167 8555.000 8578.333 7897.500 8881.667 8842.500
> 9579.167 9022.500 9914.167
> [154] 9933.333 10987.500 8835.000 8473.333 9029.167 8619.167
> 8782.500 9901.667 8566.667
> [163] 8490.833 7475.833 7510.833 8990.000 6865.833 6564.167
> 7418.333 7356.667 7485.000
> [172] 8482.500 9325.000 7989.167 7370.833 7921.667 8243.333
> 8005.833 8551.667 9119.167
> [181] 8760.000 7193.333 9693.333 7742.500 11112.500 7497.500
> 6685.000 8441.667 7150.000
> [190] 6189.167 6760.833 6255.833 8953.333 8413.333 7731.667
> 6546.667 7179.167 8060.000
> [199] 7023.333 9560.000 7071.667 7770.000 6640.000 5910.833
> 8896.667 7938.333 7098.333
> [208] 7282.500 7291.667 8557.500 7326.667 8196.667 12226.667
> 8380.000 6513.333 9100.833
> [217] 6303.333 7525.000 7297.500 7375.833 7224.167 7029.167
> 9325.833 5923.333 7674.167
> [226] 5882.500 8318.333 7263.333 7574.167 7268.333 7530.000
> 9355.833 8654.167 7426.667
> [235] 7794.167 7008.333 7974.167 10410.000 7181.667 7440.000
> 6345.000 5503.333 6674.167
> [244] 9780.000 7740.000 6981.667 5926.667 9352.500 10264.167
> 8406.667 6532.500 6478.333
> [253] 8561.667 8072.500 7700.000 7189.167 6443.333 8120.000
> 7190.833 6520.833 7539.167
> [262] 8013.333 7191.667 7660.000 7276.667 8233.333 7500.833
> 8582.500 8019.167 7231.667
> [271] 10179.167 8445.000 9302.500 7680.833 9114.167 8432.500
> 7475.000 7779.167 8895.000
> [280] 9171.667 9753.333 7490.000 10211.667 11380.000 8524.167
> 8077.500 10155.000 9406.667
> [289] 11199.167 8286.667 9850.000 10032.500 9740.833 7321.667
> 8494.167 10023.333 9450.000
> [298] 10995.833 10166.667 10881.667 8832.500 10015.000 11526.667
> 11015.833 10857.500 9627.500
> [307] 11716.667 10213.333 9765.000 8673.333 8560.833 10153.333
> 12676.667 11633.333 10933.333
> [316] 10492.500 10300.000 9853.333 10602.500 9778.333 9030.000
> 12785.833 10950.000 11523.333
> [325] 12445.000 10896.667 10875.833 11619.167 13154.167 11693.333
> 12561.667 11002.500 11017.500
> [334] 10700.833 14557.500 12236.667 10875.833 11762.500 12705.000
> 13452.500 11402.500 11232.500
> [343] 11739.167 13043.333 11583.333 11468.333 11772.500 13278.333
> 14787.500 13462.500 13837.500
> [352] 13491.667 12455.000 14412.500 14211.667 15135.000 13923.333
> 15175.000 16048.333 16182.500
> [361] 17939.167 17191.667 18522.500 18923.333 17106.667 15255.833
> 14752.500 15868.333 21636.667
> [370] 17807.500 19451.667 17064.167 20163.333 16959.167 17077.500
> 19470.833 17424.167 18996.667
> [379] 24262.500 21454.167 21115.833 18455.000 22215.000 27894.167
> 28049.167 30302.500 37730.000
> > y<-media
> > tempo<-c(-193:193/193)
> > tempo
> [1] -1.000000000 -0.994818653 -0.989637306 -0.984455959 -0.979274611
> -0.974093264 -0.968911917
> [8] -0.963730570 -0.958549223 -0.953367876 -0.948186528 -0.943005181
> -0.937823834 -0.932642487
> [15] -0.927461140 -0.922279793 -0.917098446 -0.911917098 -0.906735751
> -0.901554404 -0.896373057
> [22] -0.891191710 -0.886010363 -0.880829016 -0.875647668 -0.870466321
> -0.865284974 -0.860103627
> [29] -0.854922280 -0.849740933 -0.844559585 -0.839378238 -0.834196891
> -0.829015544 -0.823834197
> [36] -0.818652850 -0.813471503 -0.808290155 -0.803108808 -0.797927461
> -0.792746114 -0.787564767
> [43] -0.782383420 -0.777202073 -0.772020725 -0.766839378 -0.761658031
> -0.756476684 -0.751295337
> [50] -0.746113990 -0.740932642 -0.735751295 -0.730569948 -0.725388601
> -0.720207254 -0.715025907
> [57] -0.709844560 -0.704663212 -0.699481865 -0.694300518 -0.689119171
> -0.683937824 -0.678756477
> [64] -0.673575130 -0.668393782 -0.663212435 -0.658031088 -0.652849741
> -0.647668394 -0.642487047
> [71] -0.637305699 -0.632124352 -0.626943005 -0.621761658 -0.616580311
> -0.611398964 -0.606217617
> [78] -0.601036269 -0.595854922 -0.590673575 -0.585492228 -0.580310881
> -0.575129534 -0.569948187
> [85] -0.564766839 -0.559585492 -0.554404145 -0.549222798 -0.544041451
> -0.538860104 -0.533678756
> [92] -0.528497409 -0.523316062 -0.518134715 -0.512953368 -0.507772021
> -0.502590674 -0.497409326
> [99] -0.492227979 -0.487046632 -0.481865285 -0.476683938 -0.471502591
> -0.466321244 -0.461139896
> [106] -0.455958549 -0.450777202 -0.445595855 -0.440414508 -0.435233161
> -0.430051813 -0.424870466
> [113] -0.419689119 -0.414507772 -0.409326425 -0.404145078 -0.398963731
> -0.393782383 -0.388601036
> [120] -0.383419689 -0.378238342 -0.373056995 -0.367875648 -0.362694301
> -0.357512953 -0.352331606
> [127] -0.347150259 -0.341968912 -0.336787565 -0.331606218 -0.326424870
> -0.321243523 -0.316062176
> [134] -0.310880829 -0.305699482 -0.300518135 -0.295336788 -0.290155440
> -0.284974093 -0.279792746
> [141] -0.274611399 -0.269430052 -0.264248705 -0.259067358 -0.253886010
> -0.248704663 -0.243523316
> [148] -0.238341969 -0.233160622 -0.227979275 -0.222797927 -0.217616580
> -0.212435233 -0.207253886
> [155] -0.202072539 -0.196891192 -0.191709845 -0.186528497 -0.181347150
> -0.176165803 -0.170984456
> [162] -0.165803109 -0.160621762 -0.155440415 -0.150259067 -0.145077720
> -0.139896373 -0.134715026
> [169] -0.129533679 -0.124352332 -0.119170984 -0.113989637 -0.108808290
> -0.103626943 -0.098445596
> [176] -0.093264249 -0.088082902 -0.082901554 -0.077720207 -0.072538860
> -0.067357513 -0.062176166
> [183] -0.056994819 -0.051813472 -0.046632124 -0.041450777 -0.036269430
> -0.031088083 -0.025906736
> [190] -0.020725389 -0.015544041 -0.010362694 -0.005181347 0.000000000
> 0.005181347 0.010362694
> [197] 0.015544041 0.020725389 0.025906736 0.031088083 0.036269430
> 0.041450777 0.046632124
> [204] 0.051813472 0.056994819 0.062176166 0.067357513 0.072538860
> 0.077720207 0.082901554
> [211] 0.088082902 0.093264249 0.098445596 0.103626943 0.108808290
> 0.113989637 0.119170984
> [218] 0.124352332 0.129533679 0.134715026 0.139896373 0.145077720
> 0.150259067 0.155440415
> [225] 0.160621762 0.165803109 0.170984456 0.176165803 0.181347150
> 0.186528497 0.191709845
> [232] 0.196891192 0.202072539 0.207253886 0.212435233 0.217616580
> 0.222797927 0.227979275
> [239] 0.233160622 0.238341969 0.243523316 0.248704663 0.253886010
> 0.259067358 0.264248705
> [246] 0.269430052 0.274611399 0.279792746 0.284974093 0.290155440
> 0.295336788 0.300518135
> [253] 0.305699482 0.310880829 0.316062176 0.321243523 0.326424870
> 0.331606218 0.336787565
> [260] 0.341968912 0.347150259 0.352331606 0.357512953 0.362694301
> 0.367875648 0.373056995
> [267] 0.378238342 0.383419689 0.388601036 0.393782383 0.398963731
> 0.404145078 0.409326425
> [274] 0.414507772 0.419689119 0.424870466 0.430051813 0.435233161
> 0.440414508 0.445595855
> [281] 0.450777202 0.455958549 0.461139896 0.466321244 0.471502591
> 0.476683938 0.481865285
> [288] 0.487046632 0.492227979 0.497409326 0.502590674 0.507772021
> 0.512953368 0.518134715
> [295] 0.523316062 0.528497409 0.533678756 0.538860104 0.544041451
> 0.549222798 0.554404145
> [302] 0.559585492 0.564766839 0.569948187 0.575129534 0.580310881
> 0.585492228 0.590673575
> [309] 0.595854922 0.601036269 0.606217617 0.611398964 0.616580311
> 0.621761658 0.626943005
> [316] 0.632124352 0.637305699 0.642487047 0.647668394 0.652849741
> 0.658031088 0.663212435
> [323] 0.668393782 0.673575130 0.678756477 0.683937824 0.689119171
> 0.694300518 0.699481865
> [330] 0.704663212 0.709844560 0.715025907 0.720207254 0.725388601
> 0.730569948 0.735751295
> [337] 0.740932642 0.746113990 0.751295337 0.756476684 0.761658031
> 0.766839378 0.772020725
> [344] 0.777202073 0.782383420 0.787564767 0.792746114 0.797927461
> 0.803108808 0.808290155
> [351] 0.813471503 0.818652850 0.823834197 0.829015544 0.834196891
> 0.839378238 0.844559585
> [358] 0.849740933 0.854922280 0.860103627 0.865284974 0.870466321
> 0.875647668 0.880829016
> [365] 0.886010363 0.891191710 0.896373057 0.901554404 0.906735751
> 0.911917098 0.917098446
> [372] 0.922279793 0.927461140 0.932642487 0.937823834 0.943005181
> 0.948186528 0.953367876
> [379] 0.958549223 0.963730570 0.968911917 0.974093264 0.979274611
> 0.984455959 0.989637306
> [386] 0.994818653 1.000000000
> > x<-tempo
> >
> > dados
> > dados2
> >
> > xyplot(y~x, data=dados, type=c("p","smooth"))
> >
> > ## Valores iniciais.
> >
> > guess
> >
> > ## Modelo não linear.
> > func
> + y
> + return(y)
> + }
> > with(guess,
> + curve(func(x, c,a,b),min(dados$x), max(dados$x)))
> Mensagens de aviso perdidas:
> In atanh((sqrt((x + (b * (x^2)))^2)/c)^2) : NaNs produzidos
> > abline(v=194, lty=2)
> >
> >
> > ## Sobrepondo dados e função a partir dos valores iniciais.
> > plot(y~x, data=dados, xlab="tempo", ylab="volume/média")
> >
> >
> > f expression(atanh((sqrt((x+(b*(x^2)))^2)/c)^2) + a)
> >
> > fit
> 55389072390 : 1.000 1.000 0.001
> 6020970037 : -224.49929 10765.82603 49.04659
> Erro em nls(y ~ func(x, c, a, b), data = dados2, start = guess, trace =
> TRUE) :
> fator de passos 0.000488281 reduzido abaixo de 'minFactor' de 0.000976562
> >
>
> Muito Obrigada,
>
> Michelle
>
> _______________________________________________
> R-br mailing list
> R-br em 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.
>
> _______________________________________________
> R-br mailing list
> R-br em 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.
>
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20151008/08f21b10/attachment.html>
Mais detalhes sobre a lista de discussão R-br