instruction
stringlengths
9
38.7k
I'am getting more and more familiar with this kind of model (and others models too). I'm now used to fit this model with my data (rmgarch package in R). How is it done ? What is the theory behind parameters estimators ? I think about a maximum likelihood process, but I would like a confirmation and precision.
In experiment I have measured the grow of one plant on 40 locations. At one location different number of plants were measured, but always the same species. The distribution of response variable is log-normal. I wanted to show the distribution in the post but it is not possible because I'm new user of stats.stackexchang...
I am using forecast() package in R to predict future values. I have a time series data for approx 6-7 years. First, I split the data into training set and test set. Test set contained values of the last 12 months of original data. Then, applied ets() and auto.arima() on the training set. This can be done by iterating 1...
Hi I have a set of data(message with different size) in excel like (over 5000 entries): message Name MessageSize message1 0.5M message2 10.2M message3 2.1M ... message n-1 40.52M message n 12.12M I have successfully gen...
I've seen some statement where I got the impression that SVM with a quadratic loss is no more than having a kernel matrix where a multiple of the unit matrix is subtracted from the kernel. It was shown that in the dual problem the L2 loss constant can be merged into the kernel. But it wasn't clear to me. So the questio...
How can I generate events using the Poisson distribution in R? The events could be the occurrence of floods in the next 1000 years at a given rate of occurrence per year.
Within my logistic regression models I use cross-national data in order to say something about individual soft drug tolerance. In total I have 29 countries with 37.000 individuals. My supervisor wants me to find some theoretical fundament to the rule of thumb I have used (and she proposed), namely the fact that for ev...
it is straight forward to search for purely additive models using the rfe function in caret. Is it possible to include all interactions as part of the search? In the train method, we can simply say train(Y~.^2, data) to include interactions, but I have not found a way to do this in rfe. I could probably just make a dat...
I have a binary logistic regression model with a DV (disease: yes/no) and 5 predictors (demographics [age, gender, tobacco smoking (yes/no)], a medical index (ordinal) and one random treatment [yes/no]). I have also modeled all the two-sided interaction terms. The main variables are centered and there is no sign of mul...
I’m trying to model a time series (log_consommation) in a ARIMA(p,d,q) using Stata. So I start by determining d by transforming my time series to make it stationary. My question is, when performing an augmented Dickey Fuller test to test stationarity, I have to choose the number of lags. Is this number of lags related ...
Can anyone help me in re-scaling a five point likert scale into three categories using the mean scores. I have used a 5 point likert scale: (1) Not at all, (2) low, (3) moderate, (4) high and (5) very high Now I want to categorize these into Low, Moderate and High, but I am not sure how to use use the result. I p...
Is the following formula right if I want to measure the standard error of the median in case of a small sample with non normal distribution (I'm using python)? sigma=np.std(data) n=len(data) sigma_median=1.253*sigma/np.sqrt(n)
Just started getting into machine-learning, and I'm wondering if there is a relationship between the Perceptron learning algorithm and linear regression?
Let $X_1,...,X_N$ be independent normal random variables. $X_i$ is normal with mean $\mu_i$ and standard deviation $\sigma_i$. Let $x_i$ be a single random sample from $X_i$. Input: We get all $x_i$'s and all $\sigma_i$'s, but we don't get the $\mu_i$'s. Question 1 Estimate the histogram of the $\mu_i$'s. Question 2 As...
Follow the very useful answers from Peter Flom, Wayne and many others. I have now started using R and it gives me a feeling of python :) The results are below but I am not sure how should I go from here ? The density certain looks much better after log transformation. Can you please shed some light on how to do further...
I have a HLM model with significant variance in the level 1 intercepts across groups but no significant variance in the level 1 slopes across groups and find significant cross-level moderation effects. Does it make sense to interpret these or are random slopes a necessary condition for probing cross-level interaction e...
I was wondering what relation and differences are between a significance test and a hypothesis test? Are they the same concept, or is the former a special case of the latter, or ...? What does a significance test mean? Thanks and regards!
I apologize in advance if the question is rather simple, but I have been having a difficult time figuring it out. I am an experimental scientist interested in modeling human disease with induced pluripotent stem cells. The disease is fairly common, but doesn't have a common genetic basis. It is mainly driven by rare g...
Similar question here. The question I highlighted above provides an overview of how generalized linear models work. However, I find people often want more and ask about how the coefficients were calculated, and how the coefficients are then turned into odds-ratios or predicted probabilities. So if I were explaining log...
The Dirichlet process has, on expectation, $\alpha \log n$ "restaurants", when borrowing the Chinese restaurant process terminology, with $\alpha$ being the concentration parameter. Pitman-Yor, on the other hand, has $\alpha n^d$ "tables", with $\alpha$ being the concentration parameter, and $d$ being the discount para...
Does standardizing of a dependent variable within the identifying group make sense? The following working paper (Deforestation slowdown in the Legal Amazon; Prices or Policies?, pdf) uses a standardized dependent variable to analyze the effect of general policy change in Brazil on deforestation. Standardization is d...
I have two variables which show significant correlation (Spearman). I would like to graphically show the strength of the relationship, much like showing a linear regression fit with confidence bands. What would be the best correct way of doing that?
I am working with laboratory data that needs to be transformed due to skewness. It has been gathered at 2 time points and I am interested in the change from time #1 to Time #2. My question is, do I log transform the original values, then subtract the difference in the log-transformed data? Or do I calculate the diff...
I am trying use log-log regression with sample data, whereby a 1% increase in x is associated with a 25% increase in y - see example SAS code below. I expected the regression coefficient for log_x to be 25.0, but proc glimmix yielded 22.43. Please advise. I do not know how to interpret log-log regression coefficien...
Background I am comparing data on how ATPase activity from flight and leg muscle from locusts reacts to different concentrations of calcium. I plotted a scatter graph of each data set on the same graph (ATPase activity on the Y axis, calcium concentration on the X axis) and have a trend line for each. The trend line fo...
I want to fit a nonlinear mixed effects model for repeated measures data. The subjects on which the measures were repeated are spatially structured. Is there a package in R for this? I also have access to Stata, SAS, Mplus, and Mathematica. Alternatively, is it acceptable to just include random effects for membership ...
I have a logistic GLM model with 8 variables. I ran a chi-square test in R anova(glm.model,test='Chisq') and 2 of the variables turn out to be predictive when ordered at the top of the test and not so much when ordered at the bottom. The summary(glm.model) suggests that their coefficients are insignificant (high p-valu...
I have wood density data for a number of tree species given a tree's state of decay. I am presented with mean density and standard errors (SE). I am NOT provided with sample sizes. For example, a decay class 1 fir tree has a mean density of 0.305 with a standard error of 0.024. I am using R. I would like to generat...
I have a set of data points and I was told that for it to be valid, every data point should be within +/- say 5% of the average of the entire dataset. I have no problem of checking each data point and reach a conclusion if it is valid. My question is, how can I relate above statement to a statistic measure so that I ca...
I have a number of parameters for a model. The parameter values are presented as the mean and the 95% confidence interval. I am not provided with standard deviation or sample size. I am using R. I would like to sample an estimate for each parameter, similarly to using rnorm(n, mean, sd) to draw from a normal distribu...
I'm trying to perform a markov switching regression model in stata using the command switchr. The command syntax is the following one: switchr eq1 eq2 [weight] [if exp] [, cluster(string) strata(string) sigequal tol(real) tout(integer) noisyn(integer) ] where eq1 and eq2 are the regime equation (the equation in which t...
Is there a prior that's commonly used for "index" or "score" type variables that are user-defined as a weighted sum of a small number of variables (sometimes with pre-defined interaction contributions)? I know the gamma, inverse gamma, binomial, negative binomial, poisson, etc distributions are strictly positive, but ...
I would like to make/explore several alternative formulations of random forest (link) and am looking for the current state of the science for evaluating performance. In the reference file Leo provides "microarray", "DNA", "glass", and "spectral" data to exhibit the performance of his method. Are these available? How ...
From Wikipedia Omnibus tests ... test whether the explained variance in a set of data is significantly greater than the unexplained variance, overall. ... Omnibus test as a statistical test is implemented on an overall hypothesis that tends to find general significance between parameters' variance, while exam...
I'm looking for a Python module that performs a change-point analysis on a time-series. There are a number of different algorithms and I'd like to explore the efficacy of some of them without having to hand-roll each of the algorithms. Ideally I'd like some modules like the bcp (Bayesian Change Point) or strucchange pa...
I'm looking over some work performed by a consultancy and I'm unsure whether the standard error formula they have used is correct, and the subsequent conclusions they have drawn are erroneous. They have provided a Standard Error between the difference in observed claim frequencies and modelled claim frequencies, and th...
I was wondering if there wasn't some better way to get to the bottom of this question I had regarding the chances of reaching a certain threshold of guessing numbers correctly over a series of trials. This isn't my specialty, so would appreciate answers that are like you were talking to a 5 year old or at least google...
I have a Pearson's r for the same variables for 4 different periods of time. (4 different years). How can I find the Pearson's r for all of them put together? Here are the years and the related coefficients: 1969: -.169, 1975: .427, 1982: .308, 2006: .632. Can I average these to the overall Pearson's r coefficient?
I can't find any packages which allow me to implement bolasso in R, does anyone know of one? Otherwise, I am interested in model selection techniques which can be implemented in R for logistic models. My sole concern is predictive ability. The data has many covariates (or features) and I would like to investigate up t...
I'm a stats dummy, so please use small words. (-: This might not be a valid test, so I'm sure you'll let me know if that's the case. I have some survey responses in which the responses are rankings between 1 and 10. I have a frequency for each ranking (2 1's, 3 2's, 2 3's, 10 4's and so on). Intuitively, it looks lik...
Wikipedia says Methods which rely on an omnibus test before proceeding to multiple comparisons. Typically these methods require a significant ANOVA/Tukey's range test before proceeding to multiple comparisons. These methods have "weak" control of Type I error. Also The F-test in ANOVA is an example of an omnibus...
So I often do little self-experiments where I blind & randomize things; these can be formulated as your normal t-tests, but sometimes the measured metrics have extensive baselines which seem like they could be used for more accurate answers. A bunch of reading upon n-of-1 and single-subject designs suggested that peopl...
I am using interlibrary loan to get Cliff and Ord's book Spatial Processes, but the semester just ended and it is slow now. On page 18ish of this book, Cliff and Ord show how the variance for the join-count statistic is calculated and also how this variance was derived. I have the variance equation, but need to see t...
I am confused about the statistical statement I am making based on the following scenario: Scenario: The membership of a professional organisation is only open to the top 10% of students in a district. There are 400 members, coming from (say) 45 schools. Statement: The organisation represents the top 10% of students in...
The response values in my data set (100 data points) are all positive integers (should not be either negative or zero values). I have developed two statistical models: Linear Regression (LR) and K Nearest Neighbor (KNN, 2 neighbours) using the data set in R. The R methods I have used are lm() and knn.reg(). To select b...
I would like to know if it makes sense to run an ordered probit regression (dependent variable is ordinal with three outcomes) with only categorical explanatory variables (some are dichotomous e.g. gender; others are categories that have been entered as dummy variables e.g age).
My question is when to average samples or when it is allowed to apply a mixed effects model. I have the following constellation: there is a cell-line experiment conducted in a 96-wellplate, meaning that we have cell material from the same source but incubate samples in 96 individual wells on one large plate (the 96-wel...
I have many time series and a set of dates (key events eg public holidays or big sales days). There are too many for me to look as manually and determine if either an increase or decrease occured as a result of the event. Is there some algorithm that I could use? I am currently using R.
I recently got to hear about copulas which to me sounded like a nice tool to model relationships between variables. I decided to try to implement the likelihood function for a bivariate Gaussian copula with normally distributed marginals in R for use in MLE estimation or Bayesian estimation. In this case I would expec...
I am performing a binomial logistic regression with my outcome being a count with an upper bound which is 45. My data is of the following form: Now I am wondering whether the actual analysis happens on a crosstab or not? I am confused since I have 45 categories and also continuous variables so that would make to many...
Suppose I want to fit a function to measured data minimizing the chi^2. "It is known" that if it has too many correlated parameters the fit will not only have very large expected statistical errors on the fitted parameters but many times it will fail (e.g. stuck in a minimum more than 10 standard errors away from the "...
Just wondering how to setup xreg variables for ARIMAX models? I am particularly interested in whether I should be grouping together events for dummy variables. For example should I create 1 dummy variable and store all public holidays or should I create a dummy variable for each public holiday (this could lead to many ...
This is exercise 2.9.b from Time Series Analysis – With Applications in R (Cryer, Chan). First of all, for $m\in\mathbb N+2$, let us define the $m$-th difference of a discrete time series $\{A_t\}_{t\in\mathbb Z}$ as $$\nabla^{m+1}A_t\triangleq\nabla(\nabla^m A_t)\quad:\quad\nabla A_t\triangleq A_t-A_{t-1}\quad.$$ Let ...
From Wikipedia Traditional methods for multiple comparisons adjustments focus on correcting for modest numbers of comparisons, often in an analysis of variance. A different set of techniques have been developed for "large-scale multiple testing", in which thousands or even greater numbers of tests are perform...
Continue from my last question about an omnibus test. When the (global) null is the intersection of several individual nulls, I was wondering if the likelihood ratio test for the global null is considered to be an omnibus test. For more details, I quote from Casella and Berger's Statistical Inference: ... Thanks and ...
Suppose I have two sequences of characters of length L and M respectively, with the characters chosen i.i.d. from an alphabet of A through H, each with probability p=1/8. I want to find the probability that there exists a subsequence of length N which occurs simultaneously in both the length L and M sequences. I don'...
I have two time series of daily data. One is sign-ups and the other terminations of subscriptions. I'd like to predict the latter using the information contained in both variables. Looking at the graph of these series it's obvious that terminations are correlated with multiples of the sign-ups the months before. That i...
I've been using RStudio and I like it, but for the type of work I do a Notebook environment (like iPython Notebook) is more useful than an IDE. Is there an iPython Notebook equivalent for R?
I want to get results about population A. But all I can study is subpopulation C of B, where B is a subpopulation of A (that is, C $\subset$ B $\subset$ A). Each member of A is classified into one of the groups G1, G2, G3 and G4. Selection from A into B is not random, but selection from B into C is random, although som...
In the "Dynamic Linear Models with R" book, the Regression models section reads: "The static regression linear model corresponds to the case where $W_t = 0$ for any $t$, so that $\theta_t = \theta$ is constant over time." I am not understanding what this means, because when I fit a dlmModReg with dW = 0 (default valu...
Let's say I want to estimate $var(A)$ of a list of numbers $a_i \in A, i\in [0,N]$. However, I only have the variance of the non-overlapping, and complete ($B \cup C = A)$ subsets $B$ and $C$. Assume $B$ contains all $a_i \in [0, N/2]$ and $C$ contains all $a_i \in [N/2, N]$ How can I find $var(A)$ from $var(B)$ and $...
Can some one tell me when and why to use softmax=true option and entropy=T option? The model i am trying to build has binary outcome and softmax=true works only when the two outcomes are classified as two variables on its own. Otherwise entropy=T works. I could not get much help on this in the documentation. The questi...
Consider the model $$ Y_i^{(\lambda)} = \alpha+\beta x_i + \varepsilon_i,\qquad \varepsilon_i,\ (i=1,\ldots,n) \sim \mathrm{i.i.d.}\ N(0,\sigma^2) $$ where $$ \begin{align} y_i^{(\lambda)} & = \begin{cases} \dfrac{y_i^\lambda-1}{\lambda(\operatorname{GM}(y))^{\lambda -1}} , &\text{if } \lambda \neq 0 \\[12pt] \operato...
I've seen this question answered here but I do not understand the answer. Harrell recommends using deviance based measures. David Hand (referenced in the thread) says that that the AUC is inappropriate to compare different models, because it uses different misclassifications costs. I don't see how this would be the cas...
What I have: An iterative process based on the application of a very simple algebra to represent a rate, with total dependence among any iteration and its predecessor (one input parameter for (n)th iteration is the output parameter from the (n-1)th iteration). What I want: Some kind of shift on algebra allowing some le...
One approach to testing hypotheses suggested by the data is Scheffé's method. According to the Wikipedia article, the contrast $C = \sum_{i=1}^r c_i \mu_i$ (where $\sum_{i=1}^r c_i=0$) is estimated by the corresponding sample contrast $\hat C$, and the variance of the latter is estimated by $s^2_{\hat C} = \hat\sigma^...
Let's say we're running an A/B test on my website comparing blue button clicks (baseline) to green button clicks. I use http://www.evanmiller.org/ab-testing/sample-size.html to calculate my required number of subjects per branch with the following parameters: significance level of 5% statistical power of 80% an obser...
I had a few true / false questions on a practice test that I would like to discuss if possible. A value $R^2$ close to 1 indicates the linear regression is a good fit to data Yes, but I am not sure how to reason it other than intuitively. More precisely, why do we decide to define $R^2$ as 1-(sum of residuals/total s...
I'm trying to learn the Cox Proportional Hazards Model on my own, and found this link that describes it in clear terms. But when I get to Formula (5) ($S(t) = \exp(−H(t))$) I can't figure out where that's coming from. On the author's previous page, he shows that the survival function equals $S(t) = \exp(−H(t))$ if we...
A letter in a recent (2011) article of Nature doi:10.1038/nature09817 refers in several places to a Fisher's predicted least-square difference test. A google search returns 102 hits for "predicted least square difference" and 3 for "predicted least squares difference". The first two pages seem to mostly come from jou...
We are at a position in a game where there is a decision to be made. As there are relatively few game positions and possible moves, we have collected statistics from previous occasions the game was played and we found ourselves with the identical game position. For each move, we have recorded if selection eventually l...
I've got a data frame with 1000 observations and I am playing with classification methods using caret package. I'm mostly using the bootstrap method to check model quality. One of the questions I got is how does the initial sample size affect classification quality. I think I could check this effect by limiting the ite...
I have searched high and low for a practical example of using a particle filter to assist with short term price forecasting using the local trend of a time series. Could someone please share how a particle filter could be applied to time series using MATLAB. I greatly appreciate any help on this.
I'm trying to think of an example of a consistent estimator with var=0 but I'm having a hard time. I pretty sure it exists but I'm unable to find one. Any help\hints would be much appreciated.
From Wikipedia Post-hoc testing of ANOVAs Multiple comparison procedures are commonly used in an analysis of variance after obtaining a significant omnibus test result, like the ANOVA F-test. The significant ANOVA result suggests rejecting the global null hypothesis H0 that the means are the same across the gr...
I'm writing a paper on a method to determine the statistical significance of whether a sample of sources are in mutual agreement on specific premises. This is done by counting the number of sources in the sample that agree with the premise, and the number of sources that disagree, and subjecting them to a formula to de...
Here I perform a GLS regression in R and the degrees of freedom is reported as "Degrees of freedom: 60 total; 58 residual". In this regression I see five parameters that are being estimated: the slope of the regression line, the intercept of the regression line, the residual standard deviation, the constant of the vari...
On one hand, I have a temperature time series data (dataset1) for a week and I want to build the temporal correlation model by using time-series analysis and performing the prediction for oncoming values. The data is not sufficient and doesn't include seasonal and diurnal patterns to result accurate predictions. On...
I'm trying to get some intuition for multivariate analysis. Thought it would be good to visualise, say, the .95 probability contour for a multivariate normal. I'm looking for suggestions on an efficient way to do this in R. My attempt was to generate a bunch of vectors $\boldsymbol v=(cos(x), sin(x))'$ for evenly spa...
What is the sample standard error formula? I know only $s$ but I guess this is not it. I am confused about its formula. Please help me. Thank you.
Sorry for the long title, but my problem is quite specific and hard to explain in one title. I am currently learning about the Roy Model (treatment effect analysis). There is one derivation step at my slides, which I do not understand. We calculate the expected outcome with treatment in the tretment group (dummy D is t...
I am trying to build a classification model from a large dataset (50M instances) with a categorical independent variable (pred) and a binary dependent variable (class). The dependent variable is very skewed - only 2K positive instances. What confuses me is the very low predicted probability of logistic regression mod...
I am wondering if there is an easy way to compute the covariances between parameters in WinBUGS/OpenBUGS. It is easy to obtain the variances, but for subsequent analysis, I need the covariances. Consider the Salm example: model { for( i in 1 : doses ) { for( j in 1 : plates ) { y[i , j] ~ dpois(...
I am trying to estimate the sparse inverse covariance matrix of my gaussian graphical model. I installed the glasso package in R and tried out some examples. After that I ran the glasso software on my own data. So I fed it my empirical covariance matrix. However, it seems to get stuck and doesn't give me the results. S...
I'm doing biomedical research and I need to set a GAM Logistic Model which get the maximum AUC score as possible. I have 4 disease markers; $Y_1, Y_2, Y_3, Y_4$ with different data in each one, and the model must have the following specification: $\text{Model} = \log(\text{Odds Ratio} (\text{Illness}~|~Y_j,Y_i)) = \alp...
I have a 10 item knowledge scale (true/false). Can I do Cronbach alpha test?
I gave run the following codes in R console: #for built-in matrix ToothGrowth tooth.1mg <- subset(ToothGrowth, dose==1) var.test(len~supp,data=tooth.1mg,alternative="two.sided") I have found the result: F test to compare two variances data: len by supp F = 2.4176, num df = 9, denom df = 9, p-value = 0.2046 altern...
I have seen several ways to write (and calculate and interpret) a survivor function in discrete time survival analysis and I wonder which is correct or if they both are, but the interpretation and/or setup of the problem is different and I am missing it. Here is an example. Customers open an account at a bank. Record ...
I have this confusion, why are gaussian processes called smoothers. I mean I know they are also used for regression. But why are they called smoothers. Any guidance will be much appreciated
Suppose I have two time series (Series1 and Series2) which are identical from timePeriod -200 to timePeriod 0. Say that in timePeriod 0 they are both equal to 100. Series1is equal to 200 at timePeriod 50. Series2 is equal to 250 at timePeriod 50. They both go up and down over time, but Series2 is always equal to Series...
I am new to statistics especially in the topic of estimators and sufficient statistic. I am reading a note which says "unbiasedness is a desirable (but not necessary) property of a good estimator". Then it gives an example where unbiased estimators don't exist. Since there is no further explanation in the example, I am...
I have some numbers $X={x_1,x_2,...,x_n}$. I add some small numbers to them and get $Y={y_1,y_2,...,y_n}$ where $y_i=x_i+\epsilon_i$. How can I find $Z={z_1,z_2,...,z_n}$ to minimize $\sum_{i=1}^n(z_i-y_i)^2$ such that $\hat{\text{mean}}(Z)=\hat{\text{mean}}(X)$ and $\hat{\text{var}}(Z)=\hat{\text{var}}(X)$. I have sol...
I am a computer engineer, living in a digital world. I have no probabilistic background besides a probability course in the University and tried to grasp the Fisher's idea and have got the following questions. Why is this room called Ten Fold and Corss validation? Wikipedia says that "To compute a p-value from the tes...
I have an exam tomorrow about statistics for genome analysis and I'm having some troubles with some questions from an example exam. All help would be very welcome! These are the questions: The single step maxT procedure as explained in the course notes is a nonparametric exact correction and takes the dependence betwe...
Suppose we have N independently drawn samples from an unknown random variable $X$. What is the best way to estimate the expectation of $X$? For simplicity, we can assume that $X$ only returns values between 0 and 1. The standard way to estimate the mean is just to just take the average of all the samples. But I got to ...
I have two independent variables: "vaccination status" and "antibody titer assessment". Vaccination is coded as 0 and 1. The other variable is supposed to explain if the person has checked that whether the vaccination has increased his antibody titer sufficiently. The second variable has two states: yes or no. The prob...
In particular, is the $n$th cumulant equivalent to the $n$th central moment (i.e. about the mean)? There's little difference I can see between MGFs (moment generating) and CGFs (cumulant generating), apart from the former gives moments about the origin while the latter yields central moments.
I'm wondering if someone could let me know if I have calculated the confidence interval for the difference between two proportions correctly. The sample size is 34, of which 19 are females and 15 are males. Therefore, the difference in proportions is 0.1176471. I calculate the 95% confidence interval for the differenc...
As far as I understand the Wald test in the context of logistic regression is used to determine whether a certain predictor variable $X$ is significant or not. It rejects the null hypothesis of the corresponding coefficient being zero. The test consists of dividing the value of the coefficient by standard error $\sigm...
I've been told in my current textbook that for approximation of the exact distribution by means of $X^2$ or $G^2$ the expected frequencies have to be $\ge 5$. The book says that the approximation could be biased, but I wonder how and why?