[R] Help in customising the NLS function to spit out mean and SD of new fit!!

Jagarlamudi, Choudary choudary.jagar at swosu.edu
Fri Jan 7 19:50:23 CET 2005


 i'm coding in  R(first time) for a paper my colleague is publishing.
 i plotted a histogram for 6000 values. Taking the mean and sd of the  midpoints i did a dnorm and got the densities.
 pl<-dnorm(trimmedvals,mean=midsmean,sd=midsSD)
 (now in a loop of 5 times)
 i plotted these experimental values against theoretical values using
 the nls function the following way.
 nlsresult<-nlsModel(pl ~ 1/sqrt(2 *pi)*std)*2.71828^2/(2*std4^2)),data=answer,start=list(std4=std4,sm=sm))
 in the formula mean was mid point of 1st frequency bar and sd was sd  of 6000 values.I do this 5 times each time changing the mean in the formula to be the mid point of the next frequency bar.
 now i plotted plot(fittedvals ~trimmedvals)
 
I am told to plot experimental vs theoretical vlaues from the  histogram and get a non linear least square curve fit.
 I need the mean and sd of this new fit to proceed to my next  module.I'm not sure if i'm on track. Excuse me if this sounds too  naive.If nls is not what i should be using can you please give me some  pinters to solve this.

 Thanks in advance.

Choudary Jagarlamudi
Instructor
Southwestern Oklahoma State University
STF 254
100 campus Drive
Weatherford OK 73096
Tel 580-774-7136
 


More information about the R-help mailing list