Hello! I am doing a practice problem and I need help. With the practice data below, can someone show me how I would write the proc nlin for this? The initial estimates are a=20, b=20, r=.5 and I think the model is supposed to be something like g(t) = a/(1+b(e^rt))
| Heights | ||||||||||
ID | year1 | year2 | year3 | year4 | year5 | year6 | year7 | year8 | year9 | year10 | year11 |
1 | 2.12 | 4.8 | 7.4 | 9.1 | 12 | 13 | 14 | 15 | 15.5 | 16 | 16.5 |
2 | 2.95 | 5.5 | 8.4 | 9.6 | 11.5 | 13.5 | 15.5 | 17 | 17.8 | 18.5 | 19.1 |
3 | 1.95 | 4.6 | 6.6 | 8.75 | 10 | 11.5 | 13.5 | 14.5 | 15 | 15.5 | 16 |
4 | 1.85 | 3.3 | 6 | 8.6 | 10.5 | 13.5 | 17.5 | 19 | 20 | 20.5 | 21 |
5 | 2.55 | 4.5 | 5.8 | 7.47 | 9 | 11.5 | 14.5 | 16 | 16.5 | 17.5 | 18 |
6 | 3 | 5.5 | 8.5 | 9.85 | 11.5 | 13.5 | 15.5 | 17 | 18.5 | 19.5 | 20.2 |
7 | 2.72 | 4.1 | 6.6 | 9.32 | 11 | 13 | 15.5 | 16.5 | 17 | 17.5 | 17.8 |
9 | 2.05 | 3.3 | 6.6 | 8.7 | 10 | 12.5 | 14.5 | 16.5 | 17.5 | 18 | 18.6 |
10 | 2.71 | 5 | 7.1 | 9 | 10.5 | 13 | 14 | 15.5 | 17.5 | 18 | 18.5 |
This is an example of fitting a "growth model" to data. For an example that uses PROC NLIN, see "Fit a growth curve in SAS."
The article uses a different model, but the PROC NLIN syntax should be almost the same for your model.
However, in order to fit the data, the data should be in "long form." So your first step is to put the data into a data set that looks like this:
data Growth;
input ID Time Height;
datalines;
1 1 2.12
1 2 4.8
1 3 7.4
1 4 9.1
...ETC...
1 11 16.5
2 1 2.95
2 2 5.5
...ETC...
;
This is an example of fitting a "growth model" to data. For an example that uses PROC NLIN, see "Fit a growth curve in SAS."
The article uses a different model, but the PROC NLIN syntax should be almost the same for your model.
However, in order to fit the data, the data should be in "long form." So your first step is to put the data into a data set that looks like this:
data Growth;
input ID Time Height;
datalines;
1 1 2.12
1 2 4.8
1 3 7.4
1 4 9.1
...ETC...
1 11 16.5
2 1 2.95
2 2 5.5
...ETC...
;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.