Community Profile # the cyclist

### No strings on me

Last seen: Today Active since 2011

Obsessive runner. Flâneur. Professional Interests: Predictive modeling, statistics. (I don't respond to email via author page, but will usually look at a question if you send me a link to it.)

Programming Languages:
Python
Spoken Languages:
English

#### Statistics

All
• • • • • • • • • • • • #### Content Feed

View by

Using a GLM model to predict the response factor from a fixed factor
I'm very confused about how you have coded the model. Specifically, The first input to fitglm should be the predictor variable,...

20 hours ago | 0

| accepted

Turning an entire script into a function
Put this code into a file named battleship.m function [] = battleship() clear all close all clc rowdim=input('give me...

1 day ago | 0

kstest for uniform distribution
From the documentation: "The one-sample Kolmogorov-Smirnov test is only valid for continuous cumulative distribution functions."...

3 days ago | 0

Using Linear Mixed Models with two fixed factors and a random factor
You can fit such a model using the fitlme function from the Statistics and Machine Learning Toolbox. I think the following code...

4 days ago | 1

| accepted

How to find area under curve
I did not open your text file, but assuming you got that plot using plot(x,y) then it should be as easy as trapz(x,y)

7 days ago | 0

| accepted

How to bin IDX based on previous IDX value?
Is this what you mean? a = [0 0 1 2 2 1 2 2 1 0 1 0 2]; loc2 = a(2:end)==2; pre = a(1:end-1); b = 1 + find(loc2 & (pre=...

8 days ago | 0

how do we make vector the same length ( i get the error: vector must be the same length)
I think you intended elementwise division. See the documentation for array vs. matrix operations. x=linspace(0,100); y=linspac...

9 days ago | 0

I have this code in matlab but it does not work alone. I think I need a script for it.
Works for me. Here is an example f = @(x) x.^2 - 1; df = @(x) 2*x; Newton_method(f,df,3,1.e-6,500) function x = Newton_...

10 days ago | 0

How to plot the figure in the while loop ?
Try putting the figure command and the hold on commands before the while loop (and put the figure command before the hold on). ...

11 days ago | 0

How to create a matrix using two arrays (x & y) and a formula that uses x & y
Use the meshgrid function to create 2-dimensional grids from the x and y vectors. The first example in the documentation is very...

12 days ago | 1

How do I show this matrix in Matlab?
N = 5; % Change this to 50000 for your case a = 3; % The diagonal value b = -1; % The off-diagonal value % Create the matr...

12 days ago | 0

Trying to multiply these matrices and getting error "Dimensions of arrays being concatenated are not consistent."
vqs_ is a 1x501 vector. You can't concatenate the scalar vds to it vertically, which is what you are trying to do.

12 days ago | 1

Generate random errors for data with specific covariance matrices
If you have the Statistics and Machine Learning Toolbox, you can generate correlated normal variables with the mvnrnd function.

12 days ago | 0

how to give title of the legends?
You can use the legend function.

13 days ago | 0

| accepted

How to create matrix with Standard deviation from every 5 columns of another matrix?
Here is one way: % Pretend data [Use your actual data instead] M = randn(100,20); % Reshape into the slices needed for stan...

15 days ago | 0

| accepted

Using Histogram to create a figure with multiple data sets
One possibility would be to use histcounts to get the bin counts (instead of histogram to plot the bins directly), and then a st...

15 days ago | 0

How to update array inside a database
I don't fully know the answer, but here are a couple thoughts. I highly doubt you need to explore JDBC. If ODBC works for fetch...

16 days ago | 0

Cost matrix from an array without for loop.
You can use implicit expansion to subtract the two vector from each other, by transposing one of them. cost = abs(domain-domain...

16 days ago | 1

| accepted

Is there a way to avoid this inaccuracy when converting an string to a double and then to an unsigned int? I have tried using str2num() but get the same result.Thanks!
The reason for this is that MATLAB uses double-precision arithmetic by default, which will typically give approximately 15 decim...

17 days ago | 0

Extract data from matrices and arrays using vectors of coordinates
Use the sub2ind function to convert the subscripts to a linear index into the matrix. Using your example: A = [1 2 3; 3 4 5; 8...

18 days ago | 1

| accepted

For loop for correlation - linear indexing
I think you need to use A{:,i} instead of A(:,i) in the call to corrcoef.

18 days ago | 1

| accepted

Why LDA model generate a topic include stop words although these words don't exist in the data ?
I don't think it is possible to answer this question well without seeing the data. I think it is extraordinarily unlikely that ...

18 days ago | 0

How to do a gauss partial pivot?
A = [1 2 3; 2 -1 1; 1 1 1] A./abs(max(A,[],2))

18 days ago | 0

| accepted

Question about sorting an array column by column
choose_data = sort(choose_data) will sort every column independently. Ascending sorting is the default, so you don't need to sp...

18 days ago | 0

Please explain how does this file work?
Because it does look like MATLAB code, it looks like you could add a .m extension to the file, and run it normally. I'm not sur...

18 days ago | 0

| accepted

What " *.form='full' " means in making structure??
This is a GAMS question, not a MATLAB question. It looks like this page from the GAMS documentation discussing the form field. ...

19 days ago | 0

| accepted

Error in line for CVX
I don't know CVX, but the error message seems straightforward. My best guess is that m is a variable of type cvx, and you are tr...

19 days ago | 0

How to change variable value for every iteration in a for loop?
for na = 1:length(a) for n=1:length(x) %Coefficient of Lift at each panel l(n) = f(n).*(a(na))-((z(n)).*(...

19 days ago | 0