Questions tagged [sql]

SQL (Structured Query Language) is a special-purpose programming language designed for managing data held in a relational database management system (RDBMS).

37 questions
Filter by
Sorted by
Tagged with
0 votes
1 answer
90 views

Normal Distribution - Implications of negative values

Consider a task, whereby we need to generate a normally distributed data set of 100 numbers. "tableFreq" is being used to hold the "frequency" data. The sum of the frequencies ...
0 votes
1 answer
95 views

How to detect outliers in skewed data?

I have a dataset I need to use to predict the probability of conversion based on the number of days an individual has spent using my app. I got a list of historical users and the number of session ...
2 votes
1 answer
85 views

Machine Learning with Aggregated Frequency Data as Training

I am trying to build a Deep Learning model in which I have the following structure user feature binary_label 1 100 0 2 200 1 3 140 0 ... ... ... 6000000 188 1 But the problem is that when I try ...
1 vote
1 answer
91 views

Approximate binomial dist in sql

What is the best way of approximating a binomial distribution, given I have the following functions available: normal_cdf ...
• 249
0 votes
0 answers
120 views

How does LOESS work in STL Decomposition Algorithm?

I am trying to write a SQL program to calculate STL Decomposition of monthly time series data. In going through the algorithm in the original paper, inner loop step 2 has the detrended series grouped ...
• 13
1 vote
0 answers
134 views

Single SQL query for case-control matching [closed]

I am running a case-control study for which I wish to choose 5 controls for each case, stratifying by age, sex, and date of measurement. Each case or control has a unique serial number and the ...
• 147
1 vote
0 answers
22 views

How do we create a query in MS Access that gives us the cumulative difference? [closed]

I tried using this query: Running Total: CDbl(DSum("[Cost_Replacement]","Cost of Replacement","[RR_Pipe_ID]<=" & [RR_Pipe_ID] & "")) This above query ...
0 votes
1 answer
37 views

SQL over Big data for datascience [closed]

I just started to learn data science, i am not able to decide if i should go with SQL or Big Data, which one would be more helpful for a data scientist. if anyone would help me to understand this then ...
1 vote
1 answer
79 views

Newbie Data Analyst Questions

I have recently applied to a Job by a startup that wants to higher a data analyst. I have been going through the rounds and it seems like they want to hire me for the position. I have recently ...
• 123
4 votes
1 answer
85 views

Electoral college simulation using SQL Server

As I'm sure will be apparent to most here, I'm not a statistician or a programmer, but one of my hobbies is politics. I've created a (very simple) USA electoral college simulation, seen below. The ...
0 votes
3 answers
48 views

Guessing the gender of someone submitting a multiple choice questionnaire

If I have 100 people fill out a multiple choice questionnaire (containing 10 questions with 5 answer choices for each question) and the respondent writes their gender on their questionnaire, what is ...
• 101
1 vote
1 answer
68 views

Weekly sales for different start dates automate report

I’m trying to develop a report with customer sales behaviour each time a new product is Launched. The columns in the report would be : sales in time t (the time product was launched ) , sales in time ...
• 11
1 vote
0 answers
2k views

How to aggregate multiple Z-scores

Is there a way to aggregate multiple Z-scores to get a single Z-score that corresponds to the probability that no null hypotheses are rejected? Backstory: We have a tool that has some error E that ...
• 23
1 vote
2 answers
4k views

Removing Double quote and adding Single Quote for string in R [closed]

I have a list which has to pass one of it's elements to a SQL Server Query, While in R list elements will be in double quotes, SQL Server will not accept double quotes in a query as pattern. So I need ...
1 vote
1 answer
615 views

Comparing distribution of sample proportions to population proportion

I'm trying to find out whether there is a statistical method for comparing a distribution of sample proportions to a distribution of population proportions. For example if I have only two groups, A ...
• 11
1 vote
3 answers
1k views

how to predict sales of an item changes based on a discount given to another item?

I am developing a system where the management of the supermarket can make decisions on past sales data. There I mainly want to focus on how to predict sales of an item changes based on a discount ...
1 vote
2 answers
896 views

Ensemble model of simple univariate linear regression models

Calculating univariate linear regression and correlation is simple in SQL. It can be done like so: ...
• 1,151
1 vote
0 answers
151 views

What algorithm could be used to recommend wine given past ratings [closed]

Description: given a user's history of 'likes', I would like to predict what product should I recommend to the user, based on past likes (content based). The idea is very similar to Pandora, except ...
• 11
1 vote
1 answer
451 views

Automating SAS to calculate dates in various formats and store in macro variables

The background is I need to pull data from several sources and put it together, using SQL in SAS. And, I want to automate it as much as possible. So, for one, I want to have a small number of inputs ...
• 802
2 votes
0 answers
214 views

Calculate value needed to reach target by the end of a year [closed]

I have a set of values (scores to a particular KPI), these are reported monthly. I need to calculate what I'd have to score every month from now until the end of the year to reach that target. I'm ...
2 votes
0 answers
1k views

How can I (numerically) approximate the quantile in a beta distribution in SQL? [closed]

I wrote some code in SAS that among other things, used the BETAINV function (or BETA.INV as it's called in Microsoft Excel) to calculate the quantile in a beta distribution corresponding to a random ...
• 73
0 votes
1 answer
974 views

How to apply an R prediction model to very big data from SQL database in parallel.

I dont need to load the entire dataset into memory. In fact I only need 1 row at a time to apply a trained model, get the predicted response and put that response somewhere, possibly back into another ...
1 vote
1 answer
188 views

Automatically classifying user activity/sessions on a website?

I have a large body of records pertaining to user activity on a website. What I want to do is some sort of classification on each user as they navigate my website. Every algorithm I found so far uses ...
• 13
0 votes
1 answer
1k views

Difference between prediction in R and SQL

I'm working on a prediction model for a continuous variable (amount of medicine injected) .I use R for modeling.My project flow is to multiply the prediction of a glm (logistic regression) model that ...
• 173
1 vote
0 answers
1k views

generate frequency distribution from database

In a MySQL database there's a table with a single numeric value column. I want to plot the distribution of these values as a bar chart/histogram with the following ...
• 111
0 votes
1 answer
791 views

How to translate R to SQL for a Cox Proportional Hazards model?

I have built a cox model in R using the coxph function in the survival package, and now I need to replicate the model in SQL for scoring. From my understanding, the model has the form described on ...
• 21
0 votes
1 answer
116 views

Freeware similar to MS Access for SQL-less data mining, querying and reporting [closed]

I am looking for freeware similar to MS Access for data mining, querying and reporting without really writing SQL (which I know very well but sometimes I feel lazy and would rather just drag and drop)....
• 133
0 votes
1 answer
36 views

Dealing with a variable amount of entries for a given attribute

I want to analyze a .csv file with the results of a customer survey. One of the questions is: "Tell us the top 3 reasons you chose us.". The answers are short paragraphs of text listing a ranging ...
• 103
2 votes
2 answers
4k views

Split dataset randomly

I have a database with 500 records. I want to split these records to 75% and 25% *randomly*in order to use the different datasets for training and testing to machine learning algorithms. Does anyone ...
1 vote
1 answer
251 views

When should I update a recommendation engine?

[I asked this on StackOverflow and was told it would be a better fit here] I am including a basic recommendation engine in a very small project for my final exam. I understand the code and the math ...
2 votes
2 answers
2k views

Does anybody use star-schema databases to collect and organize their data?

I've been reading about the star schema (or dimensional) database structure, which puts all measurements main in 'facts' table, and all context for those measurements in 'dimension' table linked to ...
• 255
1 vote
0 answers
110 views

A/B/C testing evaluation over time ans across groups

I'm needing to validate an inherited testing project correct use of confidence testing. Direct mail creatives are being evaluated at month end over a 90 day campaign cycle for several unique customer ...
• 11
1 vote
2 answers
664 views

Grouping a "other" group with R and ggplot2

I'm trying to figure out, how to best deal with an "other" group or how to create one. I'm using R and ggplot2. Data As an example: I'm analyzing the german Bundestagswahl (general election, ...
• 113
1 vote
1 answer
1k views

How can I determine which columns best correlate with target column in a SQL Server Table?

I have a table with a couple hundred columns and a few hundred thousand rows and want to determine which combination of 5-10 columns best correlate with a target column. I have SQL Server and Excel ...
• 119
18 votes
2 answers
101k views

Calculating the 95th percentile: Comparing normal distribution, R Quantile, and Excel approaches

I was trying to compute the 95th percentile on the following dataset. I came across a few online references of doing it. Approach 1: Based on sample data The first one tells me to obtain the ...
• 4,242
4 votes
2 answers
2k views

Conducting correlation and one way ANOVA using data from a PostgreSQL database

I am trying to discern the best way to calculate a correlation and perform a one-way ANOVA on data I am taking from a PostgreSQL database. What tools should I use? Can I do this using the SQL ...
• 221
7 votes
8 answers
207k views

How do I group a list of numeric values into ranges?

I do have a big list of numeric values (including duplicates) and I do want to group them into ranges in order to see if how do they distribute. Let's say there are 1000 values ranging from 0 to 2....
• 181