# p-value and estimation of parameters with non linear least squares

#### sanmath

##### New Member
Hi I am performing an estimation of some parameters . I Have the next data:

age force_of Mortality(x)
49 0.00549
51 0.00509
52 0.00630
53 0.00619
54 0.00745
55 0.00747
56 0.00638
57 0.00882
58 0.01000
59 0.00963
60 0.01015
61 0.01096
62 0.01334
63 0.01195
64 0.01370
65 0.01489
66 0.01701
67 0.01807
68 0.02079
69 0.02116
70 0.02377
71 0.02856
72 0.02955
73 0.03319
74 0.03507
75 0.04081
76 0.04706
77 0.05111
78 0.05645
79 0.05919
80 0.06638
81 0.07294
82 0.08422
83 0.09305
84 0.10766
85 0.10953
86 0.12264
87 0.13596
88 0.14954
89 0.16734
90 0.17821
91 0.18548
92 0.21280
93 0.24301
94 0.25349
95 0.26906
96 0.31477
97 0.37478
98 0.35918
99 0.39341
100 0.44759
101 0.46257
102 0.54545
103 0.37959
104 0.58065
105 0.58621
106 0.81818
107 0.47368
108 1.71429
109 0.00000
110 0.00000
111 0.75000
I am using nls.lm() function, and I am trying to fit this data to a logistic distribution.
In order to realize this I have defined the next things in R.

edad<-datos$Age u_x<-datos$mx (force_of_mortality(x))

A=0.08
k=5
alpha=0.3
gamma=0.27

library(minpack.lm)
######hazard function logistic#####
getPred<-function(p,xdata)p$gamma+((p$k*p$A*exp(p$alpha*xdata))/1+p$A*exp(p$alpha*xdata))
###function to minimize
residFun<-function(p1,observed,xdata)observed-getPred(p1,xdata)
#####Initial parameters
parStart<-list(A=A,k=k,alpha=alpha,gamma=gamma)

summary(nls.out)

Finally I got this Parameters:
Estimate Std. Error t value Pr(>|t|)
A 4.741e-03 1.012e+04 0.000 1.0000
k -1.161e-01 1.886e+06 0.000 1.0000
alpha 4.752e-02 1.844e-02 2.577 0.0125 *
gamma -7.520e-02 9.653e-02 -0.779 0.4391
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.1972 on 58 degrees of freedom
Number of iterations to termination: 74

I am not sure how to give an accurate interpretation of Pr(>|t|) , in this case I suposse that only the parameter alpha is signficative, then I should to eliminate the other parameters of the model??
In other cases I use another initial parameters, and I got all the parameters significative, i.e every Pr(>|t|) es lower than 0.05. However if I plot with all parameters significative the plot doesn´t seems well.
For instance I use this initial values:
A=0.021
k=4
alpha=0.299
gamma=0.002
I got this results :
Parameters:
Estimate Std. Error t value Pr(>|t|)
A 1.205e-02 2.027e-07 5.947e+04 < 2e-16 ***
k -1.000e+00 8.584e-14 -1.165e+13 < 2e-16 ***
alpha 2.990e-01 1.058e-05 2.827e+04 < 2e-16 ***
gamma 1.376e-01 3.507e-02 3.923e+00 0.000234 ***

I show both graphs:
View attachment 4813
View attachment 4814

Can you recomend how to give accurate intial values??
And how to proceed with the P values??