search for: linfit

Displaying 8 results from an estimated 8 matches for "linfit".

Did you mean: linbit
2017 Jun 21
1
fitting cosine curve
...91, 17.85, 17.70, 17.67, 17.45, 17.58, 16.99, 17.10) t=c(7, 37, 58, 79, 96, 110, 114, 127, 146, 156, 161, 169, 176, 182, 190, 197, 209, 218, 232, 240) lidata <- data.frame(y=y, t=t) #I use the method to fit a curve, but it is different from the real curve, #which can be seen in the figure. linFit <- lm(y ~ cos(t)) library(nlsr) #fullFit <- nls(y ~ A*cos(omega*t+C) + B, #start=list(A=coef(linFit)[1],B=coef(linFit)[2],C=0,omega=.4)) #omega cannot be set to 1, don't know why. fullFit <- nlxb(y ~ A*cos(omega*t+C) + B, data=lidata, start=list(A=coef(linFit)[1],B=coef(linFit)[2],C...
2017 Jun 20
5
fitting cosine curve
...6.83, 17.41, 17.67, 17.62, 17.81, 17.91, 17.85, 17.70, 17.67, 17.45, 17.58, 16.99, 17.10) t=c(7, 37, 58, 79, 96, 110, 114, 127, 146, 156, 161, 169, 176, 182, 190, 197, 209, 218, 232, 240) I use the method to fit a curve, but it is different from the real curve, which can be seen in the figure. linFit <- lm(y ~ cos(t)) fullFit <- nls(y ~ A*cos(omega*t+C) + B, start=list(A=coef(linFit)[1],B=coef(linFit)[2],C=0,omega=.4)) #omega cannot be set to 1, don't know why. co <- coef(fullFit) fit <- function(x, a, b, c, d) {a*cos(b*x+c)+d} plot(x=t, y=y) curve(fit(x, a=co['A'], b=c...
2017 Jun 20
0
fitting cosine curve
....81, 17.91, 17.85, 17.70, 17.67, 17.45, 17.58, 16.99, 17.10) > t=c(7, 37, 58, 79, 96, 110, 114, 127, 146, 156, 161, 169, 176, 182, > 190, 197, 209, 218, 232, 240) > > I use the method to fit a curve, but it is different from the real curve, > which can be seen in the figure. > linFit <- lm(y ~ cos(t)) > fullFit <- nls(y ~ A*cos(omega*t+C) + B, > start=list(A=coef(linFit)[1],B=coef(linFit)[2],C=0,omega=.4)) #omega cannot > be set to 1, don't know why. > co <- coef(fullFit) > fit <- function(x, a, b, c, d) {a*cos(b*x+c)+d} > plot(x=t, y=y) >...
2017 Jun 21
1
fitting cosine curve
If you know the period and want to fit phase and amplitude, this is equivalent to fitting a * sin + b * cos > >>> > I don't know how to set the approximate starting values. I'm not sure what you meant by that, but I suspect it's related to phase and amplitude. > >>> > Besides, does the method work for sine curve as well? sin is the same as cos with
2012 Feb 06
1
Simple lm/regression question
...y(lm(y~x)) Call: lm(formula = y ~ x) Residuals: 1 2 3 4 1 -1 -1 1 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -5.0000 1.7321 -2.887 0.1020 x 5.0000 0.6325 7.906 0.0156 * So far, so good - IDL does much the same: IDL> vec=linfit(x,y,sigma=sig) IDL> print,vec,sig -5.00000 5.00000 1.73205 0.632456 Now, if the dependent variable has known (measurement) uncertainties (10, say) then it is appropriate to use weights defined as the inverse of the variances, right? > summary(lm(y~x,weights=c(.01,.0...
2017 Jun 21
0
fitting cosine curve
I'm trying the different parameters, but don't know what the error is: Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates Thanks for any suggestions. On Tue, Jun 20, 2017 at 7:37 PM, Don Cohen <don-r-help at isis.cs3-inc.com> wrote: > > If you know the period and want to fit phase and amplitude, this is > equivalent to
2017 Jun 21
2
fitting cosine curve
...79, 96, 110, 114, 127, 146, 156, 161, 169, 176, 182, >>> > 190, 197, 209, 218, 232, 240) >>> > >>> > I use the method to fit a curve, but it is different from the real >>> > curve, >>> > which can be seen in the figure. >>> > linFit <- lm(y ~ cos(t)) >>> > fullFit <- nls(y ~ A*cos(omega*t+C) + B, >>> > start=list(A=coef(linFit)[1],B=coef(linFit)[2],C=0,omega=.4)) #omega >>> > cannot >>> > be set to 1, don't know why. >>> > co <- coef(fullFit) >>&gt...
2009 Mar 05
1
Regressão linear
Ol?. Tenho um arquivo que a cada 6 linhas corresponde uma amostra da qual preciso dos coeficientes da regress?o linear. Como fa?o para que o programa distinga a cada 6 linhas como uma amostra e n?o calcule como um todo? Estou usando a fun??o: model=lm(y ~ x) Sueli Rodrigues Eng. Agr?noma - UNESP Mestranda - USP/ESALQ PPG-Solos e Nutri??o de Plantas Fones (19)93442981 (19)33719762