Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Novice here: Nonlinear Regression - fitting my data to a nonlinear lin...

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 01-14-2019 07:39 PM
(1548 views)

Hi all -

I have run a linear regression on my students' test score data and the r-squared value is high and p-value is low which would be great - except my residuals plot showed a different story. The residual plots did not show uniform randomness, my data appeared to be curved/not-linear. My residuals histogram is skewed a bit to the right.

Seems as though I need to transform a variable or create a nonlinear model. But I need help with SAS on how to do this. Some random, sample data is attached here that shows the types of data i'm using. I am using the following variables:

Dependent Variable: Mean Test Score

Independent Variable: % Free and Reduced Lunch

& I am separating my analyses by test subject (literacy or math).

I have NO idea how to run a procedure in SAS to help me build a nonlinear model. Is anyone able to assist me or point me in the right direction?

I tried PROC NLIN, but get lost with the parameters...

10 REPLIES 10

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

To give us an idea of the type of model required, could you post the graph resulting from a loess fit, something like:

```
proc sort data=myData; by subject frl; run;
proc sgpanel data=myData;
panelby subject / onepanel;
loess y=score x=frl;
run;
```

PG

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Absolutely! See attached for the Loess graphs.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Those relationships look fairly linear to me.Try exploring the linear effects with something like

```
proc glm data=myData plots=(diagnostics residuals);
where subject ne "Spanish Language Art...";
class subject level;
model ssAvg = FRLPercent subject|level FRLPercent*subject FRLPercent*level;
output out=myOutput r=resid p=pred;
run;
```

PG

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi Dave, thanks so much for responding.

Does this look right?

proc gampl data=cmasRegAnalysis;

class subject level;

model ssAvg = spline(FRLPercent);

run;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

However the proc gampl doesn't allow me to separate the output by subject and level?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. **Registration is now open through August 30th**. Visit the SAS Hackathon homepage.

What is ANOVA?

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.