turn on suggestions

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

Showing results for

- JMP User Community
- :
- Discussions
- :
- JSL Fit Distribution ( <type> )

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Apr 6, 2017 11:02 AM
(974 views)

I'm trying to create a distribution plot from a column of data and fit a continuous distribution to it. The type of distribution I want to fit is variable, but known within the script. I can't for the life of me figure out how to pass a variable as the type of distribution to fit in Fit Distribution()

So far I've tried

fit_type = "Normal"; Distribution( Column( :data ), Fit Distribution( fit_type ) );

As well as

fit_type = "Normal"; Distribution( Column( :data ), EvalExpr( Fit Distribution( Expr(fit_type) ) ) );

And even

fit_type = "Normal"; string_expr = "Fit Distribution ( " || fit_type || " )"; Distribution( Column( :data ), EvalExpr( Expr( string_expr ) ) );

But none of these work. Any ideas out there?

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Apr 6, 2017 1:11 PM
(1911 views)

Solution

Here is one way to do it:

```
fit_type = "Normal";
Eval(
Substitute(
Expr(
Distribution(
Continuous Distribution( Column( :NPN1 ), Fit Distribution( __fit_type__ ) )
)
),
Expr( __fit_type__ ), Parse( fit_type )
)
);
```

Jim

2 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Apr 6, 2017 1:11 PM
(1912 views)

Here is one way to do it:

```
fit_type = "Normal";
Eval(
Substitute(
Expr(
Distribution(
Continuous Distribution( Column( :NPN1 ), Fit Distribution( __fit_type__ ) )
)
),
Expr( __fit_type__ ), Parse( fit_type )
)
);
```

Jim

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Apr 6, 2017 2:31 PM
(951 views)

That works. Seems more convoluted than it should be.

I have a Distribution() window with multiple Continuous Distribution() in it, and putting the Substitute around it all works well.

Thanks!