statistics

Plot smooth cumulative distribution function using MATLAB

巧了我就是萌 提交于 2019-12-20 03:14:51
问题 How is it possible to make the following cumulative distribution function (CDF) curve smoother? Here's my code, using cdfplot: clear all; close all; y = [0.75862069 0.666666667 0.882352941 0.875 0.736842105 0.566666667 0.703703704 0.6 0 0.730769231 0.714285714 0.625 0.675 0.693877551 0.731707317 0.558823529 0.679245283 0.740740741 0.785714286 0.789473684 0.615384615 0.6 0.739130435 0.576923077 0 0.75]; cdfplot(y) The plot looks like: 回答1: data = [2 1 4 2 3]; sdata = sort(data); plot(sdata,(0

Constrained linear regression coefficients in R [duplicate]

大城市里の小女人 提交于 2019-12-20 02:43:19
问题 This question already has an answer here : R : constraining coefficients and error variance over multiple subsample regressions [closed] (1 answer) Closed 3 years ago . I'm estimating several ordinary least squares linear regressions in R. I want to constrain the estimated coefficients across the regressions such that they're the same. For example, I have the following: z1 ~ x + y z2 ~ x + y And I would like the estimated coefficient on y in the first regression to be equal to the estimated

Which statistics indicate an efficient run of Z3?

北战南征 提交于 2019-12-20 02:34:31
问题 The SMTLib2 directive (get-info all-statistics) displays several numbers, e.g. num. conflicts: 4 num. propagations: 0 (binary: 0) num. qa. inst: 23 In order to test different axiomatisations and encodings I'd like to know which of those numbers are appropriate to declare that one Z3 run is better/more efficient than another. Guessing from the names I'd say that num. qa. inst - the number of quantifier instantiations - is a good indicator (lower = better), but what about the others? 回答1:

Partial residual plots for linear model including an interaction term

北慕城南 提交于 2019-12-20 02:06:16
问题 My model includes one response variable, five predictors and one interaction term for predictor_1 and predictor_2. I would like to plot partial residual plots for every predictor variable which I would normally realize using the crPlots function from the package car . Unfortunately the function complains that it doesn't work with models that include interaction terms. Is there another way of doing what I want? EDIT: I created a small example illustrating the problem require(car) R <- c(0.53,0

How to generate a number representing the sum of a discrete uniform distribution

隐身守侯 提交于 2019-12-20 01:55:47
问题 Step 1: Let's say that I want to generate discrete uniform random numbers taking the value -1 or 1. So in other words I want to generate numbers having the following distribution: P(X = -1) = 0.5 P(X = 1) = 0.5 To generate an array of 100 of those numbers I can write this code: n = 100 DV = [-1,1]; % Discrete value RI = unidrnd(2,n,1); % Random uniform index DUD = DV(RI); % Discrete uniform distribution My DUD array looks like: [-1,1,1,1,-1,-1,1,-1,...] Step 2: Now I would like to generate 10

Calculating expectation for a custom distribution in Mathematica

房东的猫 提交于 2019-12-20 01:41:18
问题 This question builds on the great answers I got on an earlier question: Can one extend the functionality of PDF, CDF, FindDistributionParameters etc in Mathematica? To start I have PDFs and CDFs for two custom distributions: nlDist and dplDist as you can see from the code dplDist builds upon nlDist. nlDist /: PDF[nlDist[alpha_, beta_, mu_, sigma_], x_] := (1/(2*(alpha + beta)))*alpha* beta*(E^(alpha*(mu + (alpha*sigma^2)/2 - x))* Erfc[(mu + alpha*sigma^2 - x)/(Sqrt[2]*sigma)] + E^(beta*(-mu +

How to fit a model I built to another data set and get residuals?

为君一笑 提交于 2019-12-20 01:35:29
问题 I fitted a mixed model to Data A as follows: model <- lme(Y~1+X1+X2+X3, random=~1|Class, method="ML", data=A) Next, I want to see how the model fits Data B and also get the estimated residuals. Is there a function in R that I can use to do so? (I tried the following method but got all new coefficients.) model <- lme(Y~1+X1+X2+X3, random=~1|Class, method="ML", data=B) 回答1: The reason you are getting new coefficients in your second attempt with data=B is that the function lme returns a model

Using two streams in Java lambda to compute covariance

人走茶凉 提交于 2019-12-19 11:49:41
问题 Let's say I have two arrays of double. I've been experimenting with Stream from Java 8. I think I've understood the main ideas but then I realised that I'm not sure how to manipulate two Streams at the same time. For example, I want to calculate the covariance of both arrays. public class foo { public static double mean(double[] xs) { return Arrays.stream(xs).average().getAsDouble(); } public static void main(String[] args) { double[] xs = {1, 2, 3, 4, 5, 6, 7, 8, 9}; double[] ys = {1517.93,

Biased random in SQL?

做~自己de王妃 提交于 2019-12-19 11:36:19
问题 I have some entries in my database, in my case Videos with a rating and popularity and other factors. Of all these factors I calculate a likelihood factor or more to say a boost factor. So I essentially have the fields ID and BOOST.The boost is calculated in a way that it turns out as an integer that represents the percentage of how often this entry should be hit in in comparison. ID Boost 1 1 2 2 3 7 So if I run my random function indefinitely I should end up with X hits on ID 1, twice as

Is mldivide always the same as OLS in MATLAB?

孤人 提交于 2019-12-19 09:46:36
问题 I am doing a comparison of some alternate linear regression techniques. Clearly these will be bench-marked relative to OLS (Ordinary Least Squares). But I just want a pure OLS method, no preconditioning of the data to uncover ill-conditioning in the data as you find when you use regress() . I had hoped to simply use the classic (XX)^-1XY expression? However this would necessitate using the inv() function, but in the MATLAB guide page for inv() it recommends that you use mldivide when doing